Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/pseries: Add pool idle time at LPAR boot

When there are no options specified for lparstat, it is expected to
give reports since LPAR(Logical Partition) boot.

APP(Available Processor Pool) is an indicator of how many cores in the
shared pool are free to use in Shared Processor LPAR(SPLPAR). APP is
derived using pool_idle_time which is obtained using H_PIC call.

The interval based reports show correct APP value while since boot
report shows very high APP values. This happens because in that case APP
is obtained by dividing pool idle time by LPAR uptime. Since pool idle
time is reported by the PowerVM hypervisor since its boot, it need not
align with LPAR boot.

To fix that export boot pool idle time in lparcfg and powerpc-utils will
use this info to derive APP as below for since boot reports.

APP = (pool idle time - boot pool idle time) / (uptime * timebase)

Results:: Observe APP values.
====================== Shared LPAR ================================
lparstat
System Configuration
type=Shared mode=Uncapped smt=8 lcpu=12 mem=15573440 kB cpus=37 ent=12.00

reboot
stress-ng --cpu=$(nproc) -t 600
sleep 600
So in this case app is expected to close to 37-6=31.

====== 6.9-rc1 and lparstat 1.3.10 =============
%user %sys %wait %idle physc %entc lbusy app vcsw phint
----- ----- ----- ----- ----- ----- ----- ----- ----- -----
47.48 0.01 0.00 52.51 0.00 0.00 47.49 69099.72 541547 21

=== With this patch and powerpc-utils patch to do the above equation ===
%user %sys %wait %idle physc %entc lbusy app vcsw phint
----- ----- ----- ----- ----- ----- ----- ----- ----- -----
47.48 0.01 0.00 52.51 5.73 47.75 47.49 31.21 541753 21
=====================================================================

Note: physc, purr/idle purr being inaccurate is being handled in a
separate patch in powerpc-utils tree.

Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240412092047.455483-2-sshegde@linux.ibm.com

authored by

Shrikanth Hegde and committed by
Michael Ellerman
9c74ecfd 5a799af9

+30 -9
+30 -9
arch/powerpc/platforms/pseries/lparcfg.c
··· 170 170 kfree(buf); 171 171 } 172 172 173 - static unsigned h_pic(unsigned long *pool_idle_time, 174 - unsigned long *num_procs) 173 + static long h_pic(unsigned long *pool_idle_time, 174 + unsigned long *num_procs) 175 175 { 176 - unsigned long rc; 177 - unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 176 + long rc; 177 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE] = {0}; 178 178 179 179 rc = plpar_hcall(H_PIC, retbuf); 180 180 181 - *pool_idle_time = retbuf[0]; 182 - *num_procs = retbuf[1]; 181 + if (pool_idle_time) 182 + *pool_idle_time = retbuf[0]; 183 + if (num_procs) 184 + *num_procs = retbuf[1]; 183 185 184 186 return rc; 185 187 } 188 + 189 + unsigned long boot_pool_idle_time; 186 190 187 191 /* 188 192 * parse_ppp_data ··· 219 215 seq_printf(m, "pool_capacity=%d\n", 220 216 ppp_data.active_procs_in_pool * 100); 221 217 222 - h_pic(&pool_idle_time, &pool_procs); 223 - seq_printf(m, "pool_idle_time=%ld\n", pool_idle_time); 224 - seq_printf(m, "pool_num_procs=%ld\n", pool_procs); 218 + /* In case h_pic call is not successful, this would result in 219 + * APP values being wrong in tools like lparstat. 220 + */ 221 + 222 + if (h_pic(&pool_idle_time, &pool_procs) == H_SUCCESS) { 223 + seq_printf(m, "pool_idle_time=%ld\n", pool_idle_time); 224 + seq_printf(m, "pool_num_procs=%ld\n", pool_procs); 225 + seq_printf(m, "boot_pool_idle_time=%ld\n", boot_pool_idle_time); 226 + } 225 227 } 226 228 227 229 seq_printf(m, "unallocated_capacity_weight=%d\n", ··· 802 792 static int __init lparcfg_init(void) 803 793 { 804 794 umode_t mode = 0444; 795 + long retval; 805 796 806 797 /* Allow writing if we have FW_FEATURE_SPLPAR */ 807 798 if (firmware_has_feature(FW_FEATURE_SPLPAR)) ··· 812 801 printk(KERN_ERR "Failed to create powerpc/lparcfg\n"); 813 802 return -EIO; 814 803 } 804 + 805 + /* If this call fails, it would result in APP values 806 + * being wrong for since boot reports of lparstat 807 + */ 808 + retval = h_pic(&boot_pool_idle_time, NULL); 809 + 810 + if (retval != H_SUCCESS) 811 + pr_debug("H_PIC failed during lparcfg init retval: %ld\n", 812 + retval); 813 + 815 814 return 0; 816 815 } 817 816 machine_device_initcall(pseries, lparcfg_init);