Skip to contentSkip to conversation

pseries/lparcfg: Add resource group monitoring

PATCH Applied Srikar Dronamraju 4 participants 7 messages Jul 16, 2025 – Nov 21, 2025 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 $

Cc Madhavan Srinivasan <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Nicholas Piggin <[email protected]>
Cc Christophe Leroy <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc "Thomas Weißschuh" <[email protected]>
Cc Tyrel Datwyler <[email protected]>
---
 arch/powerpc/platforms/pseries/lparcfg.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
arch/powerpc/platforms/pseries/lparcfg.c +14 -3
index cc22924f159f..6554537984fb 100644
@@ -78,6 +78,8 @@ struct hvcall_ppp_data {
 	u8	capped;
 	u8	weight;
 	u8	unallocated_weight;
+	u8      resource_group_index;
+	u16     active_procs_in_resource_group;
 	u16	active_procs_in_pool;
 	u16	active_system_procs;
 	u16	phys_platform_procs;
@@ -86,7 +88,7 @@ struct hvcall_ppp_data {
 };
 
 /*
- * H_GET_PPP hcall returns info in 4 parms.
+ * H_GET_PPP hcall returns info in 5 parms.
  *  entitled_capacity,unallocated_capacity,
  *  aggregation, resource_capability).
  *
@@ -94,11 +96,11 @@ struct hvcall_ppp_data {
  *  R5 = Unallocated Processor Capacity Percentage.
  *  R6 (AABBCCDDEEFFGGHH).
  *      XXXX - reserved (0)
- *          XXXX - reserved (0)
+ *          XXXX - Active Cores in Resource Group
  *              XXXX - Group Number
  *                  XXXX - Pool Number.
  *  R7 (IIJJKKLLMMNNOOPP).
- *      XX - reserved. (0)
+ *      XX - Resource group Number
  *        XX - bit 0-6 reserved (0).   bit 7 is Capped indicator.
  *          XX - variable processor Capacity Weight
  *            XX - Unallocated Variable Processor Capacity Weight.
@@ -120,9 +122,11 @@ static unsigned int h_get_ppp(struct hvcall_ppp_data *ppp_data)
 	ppp_data->entitlement = retbuf[0];
 	ppp_data->unallocated_entitlement = retbuf[1];
 
+	ppp_data->active_procs_in_resource_group = (retbuf[2] >> 4 * 8) & 0xffff;
 	ppp_data->group_num = (retbuf[2] >> 2 * 8) & 0xffff;
 	ppp_data->pool_num = retbuf[2] & 0xffff;
 
+	ppp_data->resource_group_index = (retbuf[3] >> 7 *  8) & 0xff;
 	ppp_data->capped = (retbuf[3] >> 6 * 8) & 0x01;
 	ppp_data->weight = (retbuf[3] >> 5 * 8) & 0xff;
 	ppp_data->unallocated_weight = (retbuf[3] >> 4 * 8) & 0xff;
@@ -236,6 +240,13 @@ static void parse_ppp_data(struct seq_file *m)
 	seq_printf(m, "unallocated_capacity=%lld\n",
 		   ppp_data.unallocated_entitlement);
 
+	if (ppp_data.active_procs_in_resource_group)  {
+		seq_printf(m, "resource_group_number=%d\n",
+				ppp_data.resource_group_index);
+		seq_printf(m, "resource_group_active_processors=%d\n",
+				ppp_data.active_procs_in_resource_group);
+	}
+
 	/* The last bits of information returned from h_get_ppp are only
 	 * valid if the ibm,partition-performance-parameters-level
 	 * property is >= 1.
Signature · 1 line
2.43.0
#1 lore raw
Quoted 6 lines · Srikar Dronamraju

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.

Quoted 7 lines

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.

Could you please add a link to patch on power utils on how it is being consumed?

arch/powerpc/platforms/pseries/lparcfg.c

Quoted 31 lines

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 $

Cc Madhavan Srinivasan <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Nicholas Piggin <[email protected]>
Cc Christophe Leroy <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc "Thomas Weißschuh" <[email protected]>
Cc Tyrel Datwyler <[email protected]>
---
  arch/powerpc/platforms/pseries/lparcfg.c | 17 ++++++++++++++---
  1 file changed, 14 insertions(+), 3 deletions(-)
arch/powerpc/platforms/pseries/lparcfg.c +0 -0
index cc22924f159f..6554537984fb 100644

Does MODULE_VERS need to increased?

Quoted 45 lines
arch/powerpc/platforms/pseries/lparcfg.c +7 -3
@@ -78,6 +78,8 @@ struct hvcall_ppp_data {
  	u8	capped;
  	u8	weight;
  	u8	unallocated_weight;
+	u8      resource_group_index;
+	u16     active_procs_in_resource_group;
  	u16	active_procs_in_pool;
  	u16	active_system_procs;
  	u16	phys_platform_procs;
@@ -86,7 +88,7 @@ struct hvcall_ppp_data {
  };
 
  /*
- * H_GET_PPP hcall returns info in 4 parms.
+ * H_GET_PPP hcall returns info in 5 parms.
   *  entitled_capacity,unallocated_capacity,
   *  aggregation, resource_capability).
   *
@@ -94,11 +96,11 @@ struct hvcall_ppp_data {
   *  R5 = Unallocated Processor Capacity Percentage.
   *  R6 (AABBCCDDEEFFGGHH).
   *      XXXX - reserved (0)
- *          XXXX - reserved (0)
+ *          XXXX - Active Cores in Resource Group
   *              XXXX - Group Number
   *                  XXXX - Pool Number.
   *  R7 (IIJJKKLLMMNNOOPP).
- *      XX - reserved. (0)
+ *      XX - Resource group Number
   *        XX - bit 0-6 reserved (0).   bit 7 is Capped indicator.
   *          XX - variable processor Capacity Weight
   *            XX - Unallocated Variable Processor Capacity Weight.
@@ -120,9 +122,11 @@ static unsigned int h_get_ppp(struct hvcall_ppp_data *ppp_data)
  	ppp_data->entitlement = retbuf[0];
  	ppp_data->unallocated_entitlement = retbuf[1];
 
+	ppp_data->active_procs_in_resource_group = (retbuf[2] >> 4 * 8) & 0xffff;
  	ppp_data->group_num = (retbuf[2] >> 2 * 8) & 0xffff;
  	ppp_data->pool_num = retbuf[2] & 0xffff;
 
+	ppp_data->resource_group_index = (retbuf[3] >> 7 *  8) & 0xff;
  	ppp_data->capped = (retbuf[3] >> 6 * 8) & 0x01;
  	ppp_data->weight = (retbuf[3] >> 5 * 8) & 0xff;
  	ppp_data->unallocated_weight = (retbuf[3] >> 4 * 8) & 0xff;

arch/powerpc/platforms/pseries/lparcfg.c static void parse_ppp_data(struct seq_file *m) · line 243

Quoted 4 lines
arch/powerpc/platforms/pseries/lparcfg.c +1 -0
@@ -236,6 +240,13 @@ static void parse_ppp_data(struct seq_file *m)
  	seq_printf(m, "unallocated_capacity=%lld\n",
  		   ppp_data.unallocated_entitlement);
 
+	if (ppp_data.active_procs_in_resource_group)  {

ppp_data.active_procs_in_resource_group can ever be zero?

If the entry is absent in lparcfg, then lparstat will print it as 0 (which happens to be default RG, while default RG may have processors)

Quoted 9 lines
arch/powerpc/platforms/pseries/lparcfg.c +6 -0
+		seq_printf(m, "resource_group_number=%d\n",
+				ppp_data.resource_group_index);
+		seq_printf(m, "resource_group_active_processors=%d\n",
+				ppp_data.active_procs_in_resource_group);
+	}
+
  	/* The last bits of information returned from h_get_ppp are only
  	 * valid if the ibm,partition-performance-parameters-level
  	 * property is >= 1.
#2 lore raw
Quoted 11 lines · Shrikanth Hegde
Quoted 9 lines · Srikar Dronamraju

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.

Quoted 6 lines
Quoted 4 lines

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.

Could you please add a link to patch on power utils on how it is being consumed?

I am not sure I understood your query, it looks a bit ambiguous.

If your query is on how lparcfg data is being consumed.
All tools that are consuming lparcfg will continue to use the same way. Since this is not changing the way lparcfg is being consumed, I think it is redundant information that need not be carried in all the changes/commits to lparcfg. Such an information would be required when lparcfg file was created.

If your query is on how resource group data is being consumed by users. Kernel is being transparent and reporting the information from the firmware. This information is mostly for system administrators and they would already known this info since they would be people who would have configured the resource groups in the first place. Kernel doesnt provide a way to configure resource group settings. This is more of a handy way to recollect the information, rather than any action that needs to be taken.

Quoted 28 lines
Quoted 28 lines

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 $

Cc Madhavan Srinivasan <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Nicholas Piggin <[email protected]>
Cc Christophe Leroy <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc "Thomas Weißschuh" <[email protected]>
Cc Tyrel Datwyler <[email protected]>
---
  arch/powerpc/platforms/pseries/lparcfg.c | 17 ++++++++++++++---
  1 file changed, 14 insertions(+), 3 deletions(-)
Quoted 6 lines

arch/powerpc/platforms/pseries/lparcfg.c

Quoted 4 lines
arch/powerpc/platforms/pseries/lparcfg.c +0 -0
index cc22924f159f..6554537984fb 100644

Does MODULE_VERS need to increased?

All tools that are consuming lparcfg will continue to use the same way. If there was some conditional changes that need to be done by the tools, then we should have updated the same.
Hence there is not need to update MODULE_VERS.

Quoted 49 lines
Quoted 43 lines
arch/powerpc/platforms/pseries/lparcfg.c +7 -3
@@ -78,6 +78,8 @@ struct hvcall_ppp_data {
  	u8	capped;
  	u8	weight;
  	u8	unallocated_weight;
+	u8      resource_group_index;
+	u16     active_procs_in_resource_group;
  	u16	active_procs_in_pool;
  	u16	active_system_procs;
  	u16	phys_platform_procs;
@@ -86,7 +88,7 @@ struct hvcall_ppp_data {
  };
  /*
- * H_GET_PPP hcall returns info in 4 parms.
+ * H_GET_PPP hcall returns info in 5 parms.
   *  entitled_capacity,unallocated_capacity,
   *  aggregation, resource_capability).
   *
@@ -94,11 +96,11 @@ struct hvcall_ppp_data {
   *  R5 = Unallocated Processor Capacity Percentage.
   *  R6 (AABBCCDDEEFFGGHH).
   *      XXXX - reserved (0)
- *          XXXX - reserved (0)
+ *          XXXX - Active Cores in Resource Group
   *              XXXX - Group Number
   *                  XXXX - Pool Number.
   *  R7 (IIJJKKLLMMNNOOPP).
- *      XX - reserved. (0)
+ *      XX - Resource group Number
   *        XX - bit 0-6 reserved (0).   bit 7 is Capped indicator.
   *          XX - variable processor Capacity Weight
   *            XX - Unallocated Variable Processor Capacity Weight.
@@ -120,9 +122,11 @@ static unsigned int h_get_ppp(struct hvcall_ppp_data *ppp_data)
  	ppp_data->entitlement = retbuf[0];
  	ppp_data->unallocated_entitlement = retbuf[1];
+	ppp_data->active_procs_in_resource_group = (retbuf[2] >> 4 * 8) & 0xffff;
  	ppp_data->group_num = (retbuf[2] >> 2 * 8) & 0xffff;
  	ppp_data->pool_num = retbuf[2] & 0xffff;
+	ppp_data->resource_group_index = (retbuf[3] >> 7 *  8) & 0xff;
  	ppp_data->capped = (retbuf[3] >> 6 * 8) & 0x01;
  	ppp_data->weight = (retbuf[3] >> 5 * 8) & 0xff;
  	ppp_data->unallocated_weight = (retbuf[3] >> 4 * 8) & 0xff;

arch/powerpc/platforms/pseries/lparcfg.c static void parse_ppp_data(struct seq_file *m) · line 242

Quoted 3 lines
arch/powerpc/platforms/pseries/lparcfg.c +1 -0
@@ -236,6 +240,13 @@ static void parse_ppp_data(struct seq_file *m)
  	seq_printf(m, "unallocated_capacity=%lld\n",
  		   ppp_data.unallocated_entitlement);
+	if (ppp_data.active_procs_in_resource_group)  {

ppp_data.active_procs_in_resource_group can ever be zero?

Quoted 2 lines

If the entry is absent in lparcfg, then lparstat will print it as 0 (which happens to be default RG, while default RG may have processors)

If active_procs_in_resource_group is 0, then we are not printing the resource group information. If active_procs_in_resource_group is non-zero and resource_group_index is wrong, we need to report a bug to the firmware to update it. Kernel is very transparent with respect to this information. It can neither verify the information received nor should we even be doing this.

Quoted 11 lines
Quoted 10 lines
arch/powerpc/platforms/pseries/lparcfg.c +6 -0
+		seq_printf(m, "resource_group_number=%d\n",
+				ppp_data.resource_group_index);
+		seq_printf(m, "resource_group_active_processors=%d\n",
+				ppp_data.active_procs_in_resource_group);
+	}
+
  	/* The last bits of information returned from h_get_ppp are only
  	 * valid if the ibm,partition-performance-parameters-level
  	 * property is >= 1.
Signature · 2 lines
Thanks and Regards
Srikar Dronamraju
#3 lore raw
Quoted 6 lines · Srikar Dronamraju
Quoted 2 lines · Shrikanth Hegde

Could you please add a link to patch on power utils on how it is being consumed?

Quoted 8 lines

I am not sure I understood your query, it looks a bit ambiguous.

If your query is on how lparcfg data is being consumed.
All tools that are consuming lparcfg will continue to use the same way. Since this is not changing the way lparcfg is being consumed, I think it is redundant information that need not be carried in all the changes/commits to lparcfg. Such an information would be required when lparcfg file was created.

I was saying you could point to power utils patch that you have sent which says how one would consume this.

https://groups.google.com/g/powerpc-utils-devel/c/8b2Ixk8vk2w

Quoted 11 lines

If your query is on how resource group data is being consumed by users.

Quoted 2 lines

Does MODULE_VERS need to increased?

All tools that are consuming lparcfg will continue to use the same way. If there was some conditional changes that need to be done by the tools, then we should have updated the same.
Hence there is not need to update MODULE_VERS.

Since there are two new fields user scripts might need change is why i was suggesting we might need to increase MODULE_VERS

Quoted 52 lines
Quoted 49 lines
Quoted 43 lines
arch/powerpc/platforms/pseries/lparcfg.c +7 -3
@@ -78,6 +78,8 @@ struct hvcall_ppp_data {
   	u8	capped;
   	u8	weight;
   	u8	unallocated_weight;
+	u8      resource_group_index;
+	u16     active_procs_in_resource_group;
   	u16	active_procs_in_pool;
   	u16	active_system_procs;
   	u16	phys_platform_procs;
@@ -86,7 +88,7 @@ struct hvcall_ppp_data {
   };
   /*
- * H_GET_PPP hcall returns info in 4 parms.
+ * H_GET_PPP hcall returns info in 5 parms.
    *  entitled_capacity,unallocated_capacity,
    *  aggregation, resource_capability).
    *
@@ -94,11 +96,11 @@ struct hvcall_ppp_data {
    *  R5 = Unallocated Processor Capacity Percentage.
    *  R6 (AABBCCDDEEFFGGHH).
    *      XXXX - reserved (0)
- *          XXXX - reserved (0)
+ *          XXXX - Active Cores in Resource Group
    *              XXXX - Group Number
    *                  XXXX - Pool Number.
    *  R7 (IIJJKKLLMMNNOOPP).
- *      XX - reserved. (0)
+ *      XX - Resource group Number
    *        XX - bit 0-6 reserved (0).   bit 7 is Capped indicator.
    *          XX - variable processor Capacity Weight
    *            XX - Unallocated Variable Processor Capacity Weight.
@@ -120,9 +122,11 @@ static unsigned int h_get_ppp(struct hvcall_ppp_data *ppp_data)
   	ppp_data->entitlement = retbuf[0];
   	ppp_data->unallocated_entitlement = retbuf[1];
+	ppp_data->active_procs_in_resource_group = (retbuf[2] >> 4 * 8) & 0xffff;
   	ppp_data->group_num = (retbuf[2] >> 2 * 8) & 0xffff;
   	ppp_data->pool_num = retbuf[2] & 0xffff;
+	ppp_data->resource_group_index = (retbuf[3] >> 7 *  8) & 0xff;
   	ppp_data->capped = (retbuf[3] >> 6 * 8) & 0x01;
   	ppp_data->weight = (retbuf[3] >> 5 * 8) & 0xff;
   	ppp_data->unallocated_weight = (retbuf[3] >> 4 * 8) & 0xff;

arch/powerpc/platforms/pseries/lparcfg.c static void parse_ppp_data(struct seq_file *m) · line 242

Quoted 3 lines
arch/powerpc/platforms/pseries/lparcfg.c +1 -0
@@ -236,6 +240,13 @@ static void parse_ppp_data(struct seq_file *m)
   	seq_printf(m, "unallocated_capacity=%lld\n",
   		   ppp_data.unallocated_entitlement);
+	if (ppp_data.active_procs_in_resource_group)  {

ppp_data.active_procs_in_resource_group can ever be zero?

Quoted 2 lines

If the entry is absent in lparcfg, then lparstat will print it as 0 (which happens to be default RG, while default RG may have processors)

Quoted 8 lines

If active_procs_in_resource_group is 0, then we are not printing the resource group information. If active_procs_in_resource_group is non-zero and resource_group_index is wrong, we need to report a bug to the firmware to update it. Kernel is very transparent with respect to this information. It can neither verify the information received nor should we even be doing this.

Quoted 1 line

The comment was more on the necessity of if statement there.

+ if (ppp_data.active_procs_in_resource_group) {

If one runs lparstat in the LPAR, that means ppp_data.active_procs_in_resource_group is non zero. and when ppp_data.active_procs_in_resource_group is zero, i don't think one can run lparstat in any of such LPAR.

btw, ppp_data.active_procs_in_resource_group can be fraction between 0,1 or is it always an integer number?

#4 lore raw
Quoted 18 lines · Shrikanth Hegde
Quoted 6 lines · Srikar Dronamraju
Quoted 2 lines · Shrikanth Hegde

Could you please add a link to patch on power utils on how it is being consumed?

Quoted 8 lines

I am not sure I understood your query, it looks a bit ambiguous.

If your query is on how lparcfg data is being consumed.
All tools that are consuming lparcfg will continue to use the same way. Since this is not changing the way lparcfg is being consumed, I think it is redundant information that need not be carried in all the changes/commits to lparcfg. Such an information would be required when lparcfg file was created.

Quoted 4 lines

I was saying you could point to power utils patch that you have sent which says how one would consume this.

https://groups.google.com/g/powerpc-utils-devel/c/8b2Ixk8vk2w

I guess, power utils patch would need a linuxppc-dev mail reference and not vice-versa. Since this patch would sent first and the reviewers of the power utils patch would a need a reference to this patch.

Since this patch needs to be sent first, how do I generate a url for the second / subsequent patch?

Quoted 7 lines
Quoted 7 lines

If your query is on how resource group data is being consumed by users.

Quoted 2 lines

Does MODULE_VERS need to increased?

Quoted 8 lines
Quoted 5 lines

All tools that are consuming lparcfg will continue to use the same way. If there was some conditional changes that need to be done by the tools, then we should have updated the same.
Hence there is not need to update MODULE_VERS.

Since there are two new fields user scripts might need change is why i was suggesting we might need to increase MODULE_VERS

I still dont see a reason for increasing the MODULE_VERS

Quoted 65 lines
Quoted 53 lines
Quoted 50 lines
Quoted 44 lines
arch/powerpc/platforms/pseries/lparcfg.c +7 -3
@@ -78,6 +78,8 @@ struct hvcall_ppp_data {
   	u8	capped;
   	u8	weight;
   	u8	unallocated_weight;
+	u8      resource_group_index;
+	u16     active_procs_in_resource_group;
   	u16	active_procs_in_pool;
   	u16	active_system_procs;
   	u16	phys_platform_procs;
@@ -86,7 +88,7 @@ struct hvcall_ppp_data {
   };
   /*
- * H_GET_PPP hcall returns info in 4 parms.
+ * H_GET_PPP hcall returns info in 5 parms.
    *  entitled_capacity,unallocated_capacity,
    *  aggregation, resource_capability).
    *
@@ -94,11 +96,11 @@ struct hvcall_ppp_data {
    *  R5 = Unallocated Processor Capacity Percentage.
    *  R6 (AABBCCDDEEFFGGHH).
    *      XXXX - reserved (0)
- *          XXXX - reserved (0)
+ *          XXXX - Active Cores in Resource Group
    *              XXXX - Group Number
    *                  XXXX - Pool Number.
    *  R7 (IIJJKKLLMMNNOOPP).
- *      XX - reserved. (0)
+ *      XX - Resource group Number
    *        XX - bit 0-6 reserved (0).   bit 7 is Capped indicator.
    *          XX - variable processor Capacity Weight
    *            XX - Unallocated Variable Processor Capacity Weight.
@@ -120,9 +122,11 @@ static unsigned int h_get_ppp(struct hvcall_ppp_data *ppp_data)
   	ppp_data->entitlement = retbuf[0];
   	ppp_data->unallocated_entitlement = retbuf[1];
+	ppp_data->active_procs_in_resource_group = (retbuf[2] >> 4 * 8) & 0xffff;
   	ppp_data->group_num = (retbuf[2] >> 2 * 8) & 0xffff;
   	ppp_data->pool_num = retbuf[2] & 0xffff;
+	ppp_data->resource_group_index = (retbuf[3] >> 7 *  8) & 0xff;
   	ppp_data->capped = (retbuf[3] >> 6 * 8) & 0x01;
   	ppp_data->weight = (retbuf[3] >> 5 * 8) & 0xff;
   	ppp_data->unallocated_weight = (retbuf[3] >> 4 * 8) & 0xff;

arch/powerpc/platforms/pseries/lparcfg.c static void parse_ppp_data(struct seq_file *m) · line 242

Quoted 3 lines
arch/powerpc/platforms/pseries/lparcfg.c +1 -0
@@ -236,6 +240,13 @@ static void parse_ppp_data(struct seq_file *m)
   	seq_printf(m, "unallocated_capacity=%lld\n",
   		   ppp_data.unallocated_entitlement);
+	if (ppp_data.active_procs_in_resource_group)  {

ppp_data.active_procs_in_resource_group can ever be zero?

Quoted 2 lines

If the entry is absent in lparcfg, then lparstat will print it as 0 (which happens to be default RG, while default RG may have processors)

Quoted 8 lines

If active_procs_in_resource_group is 0, then we are not printing the resource group information. If active_procs_in_resource_group is non-zero and resource_group_index is wrong, we need to report a bug to the firmware to update it. Kernel is very transparent with respect to this information. It can neither verify the information received nor should we even be doing this.

Quoted 1 line

The comment was more on the necessity of if statement there.

arch/powerpc/platforms/pseries/lparcfg.c +1 -0
+	if (ppp_data.active_procs_in_resource_group)  {
Quoted 5 lines

If one runs lparstat in the LPAR, that means ppp_data.active_procs_in_resource_group is non zero. and when ppp_data.active_procs_in_resource_group is zero, i don't think one can run lparstat in any of such LPAR.

btw, ppp_data.active_procs_in_resource_group can be fraction between 0,1 or is it always an integer number?

ppp_data.active_procs_in_resource_group being 0 is valid, it means its running on an hypervisor, that doesn't support Resource group.

if ppp_data.active_procs_in_resource_group is non zero and ppp_data.resource_group_index is not present, then its a bug.

ppp_data.active_procs_in_resource_group can only be integers.

Signature · 2 lines
Thanks and Regards
Srikar Dronamraju
Tested-by on v1 1/1
#5 lore raw
In reply to Srikar Dronamraju
Quoted 109 lines · Srikar Dronamraju

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 $

Cc Madhavan Srinivasan <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Nicholas Piggin <[email protected]>
Cc Christophe Leroy <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc "Thomas Weißschuh" <[email protected]>
Cc Tyrel Datwyler <[email protected]>

---
arch/powerpc/platforms/pseries/lparcfg.c | 17 ++++++++++++++---

1 file changed, 14 insertions(+), 3 deletions(-)
arch/powerpc/platforms/pseries/lparcfg.c +14 -3
index cc22924f159f..6554537984fb 100644
@@ -78,6 +78,8 @@ struct hvcall_ppp_data {
 u8 capped;
 u8 weight;
 u8 unallocated_weight;
+ u8      resource_group_index;
+ u16     active_procs_in_resource_group;
 u16 active_procs_in_pool;
 u16 active_system_procs;
 u16 phys_platform_procs;
@@ -86,7 +88,7 @@ struct hvcall_ppp_data {
 };
 
 /*
- * H_GET_PPP hcall returns info in 4 parms.
+ * H_GET_PPP hcall returns info in 5 parms.
 *  entitled_capacity,unallocated_capacity,
 *  aggregation, resource_capability).
 *
@@ -94,11 +96,11 @@ struct hvcall_ppp_data {
 *  R5 = Unallocated Processor Capacity Percentage.
 *  R6 (AABBCCDDEEFFGGHH).
 *      XXXX - reserved (0)
- *          XXXX - reserved (0)
+ *          XXXX - Active Cores in Resource Group
 *              XXXX - Group Number
 *                  XXXX - Pool Number.
 *  R7 (IIJJKKLLMMNNOOPP).
- *      XX - reserved. (0)
+ *      XX - Resource group Number
 *        XX - bit 0-6 reserved (0).   bit 7 is Capped indicator.
 *          XX - variable processor Capacity Weight
 *            XX - Unallocated Variable Processor Capacity Weight.
@@ -120,9 +122,11 @@ static unsigned int h_get_ppp(struct hvcall_ppp_data *ppp_data)
 ppp_data->entitlement = retbuf[0];
 ppp_data->unallocated_entitlement = retbuf[1];
 
+ ppp_data->active_procs_in_resource_group = (retbuf[2] >> 4 * 8) & 0xffff;
 ppp_data->group_num = (retbuf[2] >> 2 * 8) & 0xffff;
 ppp_data->pool_num = retbuf[2] & 0xffff;
 
+ ppp_data->resource_group_index = (retbuf[3] >> 7 *  8) & 0xff;
 ppp_data->capped = (retbuf[3] >> 6 * 8) & 0x01;
 ppp_data->weight = (retbuf[3] >> 5 * 8) & 0xff;
 ppp_data->unallocated_weight = (retbuf[3] >> 4 * 8) & 0xff;
@@ -236,6 +240,13 @@ static void parse_ppp_data(struct seq_file *m)
 seq_printf(m, "unallocated_capacity=%lld\n",
  ppp_data.unallocated_entitlement);
 
+ if (ppp_data.active_procs_in_resource_group)  {
+ seq_printf(m, "resource_group_number=%d\n",
+ ppp_data.resource_group_index);
+ seq_printf(m, "resource_group_active_processors=%d\n",
+ ppp_data.active_procs_in_resource_group);
+ }
+
 /* The last bits of information returned from h_get_ppp are only
 * valid if the ibm,partition-performance-parameters-level
 * property is >= 1.
Signature · 1 line
2.43.0

<Resending to the right thread>

Greetings!!!

Tested this patch by applying on 6.16 kernel. Build and boot was fine.

Assigned the LPAR to different RG, and with this patch, RG Index and active_procs in RG reported the correct information. Hence,

Regards,
Venkat.

maintainer Applied
#6 lore raw
In reply to Srikar Dronamraju
Quoted 10 lines · Srikar Dronamraju

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.

[...]

Applied to powerpc/next.

[1/1] pseries/lparcfg: Add resource group monitoring

      https://git.kernel.org/powerpc/c/8127c4fdf169465b631b62f7e45a042ced32dc77

Thanks