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

pseries/lparcfg: Add resource group monitoring

Systems can now be partitioned into resource groups. By default all
systems will be part of default resource group. Once a resource group is
created, and resources allocated to the resource group, those resources
will be removed from the default resource group. If a LPAR moved to a
resource group, then it can only use resources in the resource group.

So maximum processors that can be allocated to a LPAR can be equal or
smaller than the resources in the resource group.

lparcfg can now exposes the resource group id to which this LPAR belongs
to. It also exposes the number of processors in the current resource
group. The default resource group id happens to be 0. These would be
documented in the upcoming PAPR update.

Example of an LPAR in a default resource group
root@ltcp11-lp3 $ grep resource_group /proc/powerpc/lparcfg
resource_group_number=0
resource_group_active_processors=50
root@ltcp11-lp3 $

Example of an LPAR in a non-default resource group
root@ltcp11-lp5 $ grep resource_group /proc/powerpc/lparcfg
resource_group_number=1
resource_group_active_processors=30
root@ltcp11-lp5 $

Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20250716104600.59102-1-srikar@linux.ibm.com

authored by

Srikar Dronamraju and committed by
Madhavan Srinivasan
8127c4fd e9a6fb0b

+14 -3
+14 -3
arch/powerpc/platforms/pseries/lparcfg.c
··· 78 78 u8 capped; 79 79 u8 weight; 80 80 u8 unallocated_weight; 81 + u8 resource_group_index; 82 + u16 active_procs_in_resource_group; 81 83 u16 active_procs_in_pool; 82 84 u16 active_system_procs; 83 85 u16 phys_platform_procs; ··· 88 86 }; 89 87 90 88 /* 91 - * H_GET_PPP hcall returns info in 4 parms. 89 + * H_GET_PPP hcall returns info in 5 parms. 92 90 * entitled_capacity,unallocated_capacity, 93 91 * aggregation, resource_capability). 94 92 * ··· 96 94 * R5 = Unallocated Processor Capacity Percentage. 97 95 * R6 (AABBCCDDEEFFGGHH). 98 96 * XXXX - reserved (0) 99 - * XXXX - reserved (0) 97 + * XXXX - Active Cores in Resource Group 100 98 * XXXX - Group Number 101 99 * XXXX - Pool Number. 102 100 * R7 (IIJJKKLLMMNNOOPP). 103 - * XX - reserved. (0) 101 + * XX - Resource group Number 104 102 * XX - bit 0-6 reserved (0). bit 7 is Capped indicator. 105 103 * XX - variable processor Capacity Weight 106 104 * XX - Unallocated Variable Processor Capacity Weight. ··· 122 120 ppp_data->entitlement = retbuf[0]; 123 121 ppp_data->unallocated_entitlement = retbuf[1]; 124 122 123 + ppp_data->active_procs_in_resource_group = (retbuf[2] >> 4 * 8) & 0xffff; 125 124 ppp_data->group_num = (retbuf[2] >> 2 * 8) & 0xffff; 126 125 ppp_data->pool_num = retbuf[2] & 0xffff; 127 126 127 + ppp_data->resource_group_index = (retbuf[3] >> 7 * 8) & 0xff; 128 128 ppp_data->capped = (retbuf[3] >> 6 * 8) & 0x01; 129 129 ppp_data->weight = (retbuf[3] >> 5 * 8) & 0xff; 130 130 ppp_data->unallocated_weight = (retbuf[3] >> 4 * 8) & 0xff; ··· 239 235 seq_printf(m, "capped=%d\n", ppp_data.capped); 240 236 seq_printf(m, "unallocated_capacity=%lld\n", 241 237 ppp_data.unallocated_entitlement); 238 + 239 + if (ppp_data.active_procs_in_resource_group) { 240 + seq_printf(m, "resource_group_number=%d\n", 241 + ppp_data.resource_group_index); 242 + seq_printf(m, "resource_group_active_processors=%d\n", 243 + ppp_data.active_procs_in_resource_group); 244 + } 242 245 243 246 /* The last bits of information returned from h_get_ppp are only 244 247 * valid if the ibm,partition-performance-parameters-level