« Return to Thread: (no subject)

RE: MP factor table

by fish-8 :: Rate this Message:

Reply to Author | View in Thread

 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Proposed patch:


Index: control.c
===================================================================
- --- control.c (revision 5421)
+++ control.c (working copy)
@@ -6490,22 +6490,11 @@
 int        cputype;                     /* work                    
*/
 #endif /*defined(FEATURE_CONFIGURATION_TOPOLOGY_FACILITY)*/
 
- -
                            /*  "0    1    2    3    4    5    6  
7" */
 static BYTE hexebcdic[16] = {
0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,
                            /*  "8    9    A    B    C    D    E  
F" */
                             
0xF8,0xF9,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6 };
 
- -                        /* x'004B' = 75 = 75% for each subsequent
cpu */
- -static BYTE mpfact[32*2] = {
0x00,0x4B,0x00,0x4B,0x00,0x4B,0x00,0x4B,
- -                            
0x00,0x4B,0x00,0x4B,0x00,0x4B,0x00,0x4B,
- -                            
0x00,0x4B,0x00,0x4B,0x00,0x4B,0x00,0x4B,
- -                            
0x00,0x4B,0x00,0x4B,0x00,0x4B,0x00,0x4B,
- -                            
0x00,0x4B,0x00,0x4B,0x00,0x4B,0x00,0x4B,
- -                            
0x00,0x4B,0x00,0x4B,0x00,0x4B,0x00,0x4B,
- -                            
0x00,0x4B,0x00,0x4B,0x00,0x4B,0x00,0x4B,
- -                             0x00,0x4B,0x00,0x4B,0x00,0x4B,0x00,0x4B
};
- -
 #define STSI_CAPABILITY   stsi_capability(regs)
 
     S(inst, regs, b2, effective_addr2);
@@ -6697,9 +6686,11 @@
                 STORE_HW(sysib122->totcpu, MAX_CPU);
                 STORE_HW(sysib122->confcpu, sysblk.cpus);
                 STORE_HW(sysib122->sbcpu, MAX_CPU - sysblk.cpus);
- -                memcpy(sysib122->mpfact,mpfact,(MAX_CPU-1)*2);
+                // memcpy(sysib122->mpfact,mpfact,(MAX_CPU-1)*2);
+                get_mpfactors((BYTE*)sysib122->mpfact);
                 STORE_FW(sysib122->accap, STSI_CAPABILITY);
- -                memcpy(sysib122->ampfact,mpfact,(MAX_CPU-1)*2);
+                //memcpy(sysib122->ampfact,mpfact,(MAX_CPU-1)*2);
+                get_mpfactors((BYTE*)sysib122->ampfact);
                 regs->psw.cc = 0;
                 break;
 
Index: hexterns.h
===================================================================
- --- hexterns.h (revision 5421)
+++ hexterns.h (working copy)
@@ -304,6 +304,7 @@
 void set_sysname(BYTE *name);
 void set_systype(BYTE *name);
 void set_sysplex(BYTE *name);
+void get_mpfactors(BYTE *dest);
 
 /* Functions in module impl.c */
 IMPL_DLL_IMPORT void system_cleanup(void);
Index: loadparm.c
===================================================================
- --- loadparm.c (revision 5421)
+++ loadparm.c (working copy)
@@ -276,3 +276,106 @@
 {
     memcpy(dst, sysplex, sizeof(sysplex));
 }
+
+/*-------------------------------------------------------------------
*/
+/* Retrieve Multiprocessing CPU-Capability Adjustment Factors      
*/
+/*                                                                  
*/
+/* This function retrieves the Multiprocessing CPU-Capability      
*/
+/* Adjustment Factor values for SYSIB (System Information Block)    
*/
+/* 1.2.2 as described in the Principles of Operations manual for    
*/
+/* the STORE SYSTEM INFORMATION instruction.                        
*/
+/*                                                                  
*/
+/* Input:                                                          
*/
+/*      dest  Address of where to store the information.            
*/
+/* Output:                                                          
*/
+/*      The requested MP Factor values at the address specified.    
*/
+/* Used by:                                                        
*/
+/*      B27D STSI  Store System Information (Basic-machine All CPUs)
*/
+/*      B220 SERVC Service Call             (read_scpinfo)          
*/
+/*-------------------------------------------------------------------
*/
+void get_mpfactors(BYTE *dest)
+{
+    /* APAR OA20135:
+
+       SUPPORT THE NEW MP FACTOR RANGE (0-65535) OF Z10 SERVERS
+
+       http://www-01.ibm.com/support/docview.wss?uid=isg1OA20135
+
+       Granularity in MP Factors:
+       The base MP factor has been changed on z10 servers from 255
+       to  65535 for better granularity.  SRM gets the MP Factors
+       from the STSI instruction and stores them in the control
+       blocks IRACCT (primary MP factors) and IRALCCT (secondary
+       MP factors).  STSI provides the MP factors from CPU 2-n and
+       the first MP factor is derived from the second.  Modules
+       IEAVNP10 and IRAEVSSI have now been changed to set the
+       first MP factor based on the second MP factor to 100, 255
+       or 65535.  If the second MP factor is greater than 100 then
+       the first MP factor will be set to 255, if it is greater
+       than 255 the first MP factor will be set to 65535, which is
+       the new base value.
+
+       ------------------------------------------------------------
+
+         Multiprocessing CPU-Capability Adjustment Fac-
+         tors: Beginning with bytes 0 and 1 of word 11, the
+         SYSIB contains a series  of contiguous two-byte
+         fields, each containing a 16-bit unsigned binary inte-
+         ger used to form an adjustment factor (fraction) for
+         the value contained in the CPU-capability field. Such
+         a fraction is developed by using the value (V) of the
+         first two-byte field according to one of the following
+         methods:
+
+         * If V is in the range 0<V<=100, a denominator of
+           100 is indicated which produces a fraction of
+           V/100.
+
+         * If V is in the range 101<=V<255, a denominator of
+           255 is indicated which produces a fraction of
+           V/255.
+
+         * If V is in the range 255<=V<65,536, a denominator
+           of 65,536 is indicated which produces a fraction
+           of V/65,536.
+
+         Thus, the fraction represented by each two-byte field
+         is then developed by dividing the contents of a two-
+         byte field by the indicated denominator.
+
+         The number of adjustment-factor fields is one less
+         than the number of CPUs specified in the total-CPU-
+         count field. The adjustment-factor fields correspond
+         to configurations with increasing numbers of CPUs in
+         the configured state. The first adjustment-factor field
+         corresponds to a configuration with two CPUs in the
+         configured state. Each successive adjustment-factor
+         field corresponds to a configuration with a number of
+         CPUs in the configured state that is one more than
+         that for the preceding field.
+    */
+
+#define  MPFACTOR_BASE_VALUE    65536
+#define  MPFACTOR_PERCENT       95
+
+    static U16 mpfactors[MAX_CPU_ENGINES-1] = {0};
+    static BYTE didthis = 0;
+
+    if (!didthis)
+    {
+        /* First time: initialize array... */
+        U32 mpfactor = MPFACTOR_BASE_VALUE;
+        int i;
+        for (i=0; i < arraysize( mpfactors ); i++)
+        {
+            /* Calculate the value of each subsequent entry
+               as percentage of the previous entry's value. */
+            mpfactor = (mpfactor * MPFACTOR_PERCENT) / 100;
+            mpfactors[i] = CSWAP16( (U16) mpfactor );
+        }
+        didthis = 1;
+    }
+
+    /* Return the requested information... */
+    memcpy( dest, &mpfactors[0], (MAX_CPU-1) * sizeof(U16) );
+}
Index: service.c
===================================================================
- --- service.c (revision 5421)
+++ service.c (working copy)
@@ -1300,12 +1300,9 @@
 #if defined(FEATURE_MPF_INFO)
         /* Define machine capacity */
         STORE_FW(sccbscp->rcci, 10000);
+        /* Fill in the MP Factors array */
         sccbmpf = (SCCB_MPF_INFO*)(sccbcpu);
- -        /* We use an MP factor table of 95, 90, ... */
- -        /* the table has one entry less then the amount of installed
cpus ie t
- -         * there is no entry for the first cpu which is running at
rcci speed */
- -        for (i = 0; i < MAX_CPU-1; i++, sccbmpf++)
- -            STORE_HW(sccbmpf->mpfy, (95 - (i*5)));
+        get_mpfactors((BYTE*)sccbmpf);
 #endif /*defined(FEATURE_MPF_INFO)*/
 
         /* Set response code X'0010' in SCCB header */



- --
"Fish" (David B. Trout) - fish@...
Fight Spam! Join CAUCE! <http://www.cauce.org/>
7 reasons why HTML email is a bad thing
http://www.georgedillon.com/web/html_email_is_evil.shtml
PGP key fingerprints:
RSA: 6B37 7110 7201 9917 9B0D 99E3 55DB 5D58 FADE 4A52
DH/DSS: 9F9B BAB0 BA7F C458 1A89 FE26 48F5 D7F4 C4EE 3E2A

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.1

iQA/AwUBSj80NEj11/TE7j4qEQJ3TQCfeFnITRUR6nOTDS56v7RA8fhlDssAniIa
DWrocGwZFp+6Xa71EzAZ/iq3
=JgVZ
-----END PGP SIGNATURE-----

 « Return to Thread: (no subject)