[PATCH] drmgr: Remove/add memory based on drc-index request

12 views
Skip to first unread message

Haren Myneni

<haren@linux.ibm.com>
unread,
Mar 31, 2026, 12:38:40 AMMar 31
to powerpc-utils-devel@googlegroups.com, tyreld@linux.ibm.com, hbabu@us.ibm.com, Haren Myneni, Shirisha G, Sourabh Jain
The user space can request to remove or add memory based on
drc-index with the following command:
drmgr -c mem [-r/-a] -s <drc-name>

The current code ignores this option unlike in DLPAR CPU code. This
patch considers drc-index if the drc-name starts with "0x" and uses
this value to add /remove the corresponding LMB.

Signed-off-by: Haren Myneni <ha...@linux.ibm.com>
Reported-by: Shirisha G <shir...@linux.ibm.com>
Tested-by: Sourabh Jain <soura...@linux.ibm.com>
---
src/drmgr/drslot_chrp_mem.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/drmgr/drslot_chrp_mem.c b/src/drmgr/drslot_chrp_mem.c
index d37ee80..55687a7 100644
--- a/src/drmgr/drslot_chrp_mem.c
+++ b/src/drmgr/drslot_chrp_mem.c
@@ -1815,8 +1815,12 @@ int drslot_chrp_mem(void)
/* The recursive nature of the routines that add/remove lmbs
* require that the quantity be non-zero.
*/
- if (usr_drc_name)
+ if (usr_drc_name) {
+ /* The -s option can specify a drc name or drc index */
+ if (!strncmp(usr_drc_name, "0x", 2))
+ usr_drc_index = strtoul(usr_drc_name, NULL, 16);
usr_drc_count = 1;
+ }

if (kernel_dlpar_exists()) {
rc = do_mem_kernel_dlpar();
--
2.50.1

Dave Marquardt

<davemarq@linux.ibm.com>
unread,
Mar 31, 2026, 10:07:15 AMMar 31
to Haren Myneni, powerpc-utils-devel@googlegroups.com, tyreld@linux.ibm.com, hbabu@us.ibm.com, Shirisha G, Sourabh Jain
Haren Myneni <ha...@linux.ibm.com> writes:

> The user space can request to remove or add memory based on
> drc-index with the following command:
> drmgr -c mem [-r/-a] -s <drc-name>
>
> The current code ignores this option unlike in DLPAR CPU code. This
> patch considers drc-index if the drc-name starts with "0x" and uses
> this value to add /remove the corresponding LMB.
>
> Signed-off-by: Haren Myneni <ha...@linux.ibm.com>
> Reported-by: Shirisha G <shir...@linux.ibm.com>
> Tested-by: Sourabh Jain <soura...@linux.ibm.com>

Reviewed-by: Dave Marquardt <dave...@linux.ibm.com>

Tyrel Datwyler

<tyreld@linux.ibm.com>
unread,
May 20, 2026, 8:10:26 PM (5 days ago) May 20
to Haren Myneni, powerpc-utils-devel@googlegroups.com, hbabu@us.ibm.com, Shirisha G, Sourabh Jain
The valid_mem_options(), which is called in drmgr main(), already converts
usr_drc_name to usr_drc_index if there is a "0x" prefix. It does however then
set usr_drc_name = NULL. So, I think that we are maybe just band aiding over
some other flow logic that needs to be fixed such that the code properly
distinguishes between if we intended to use a drc_name or a drc_index.

-Tyrel

Haren Myneni

<haren@linux.ibm.com>
unread,
May 22, 2026, 3:03:18 AM (4 days ago) May 22
to Tyrel Datwyler, powerpc-utils-devel@googlegroups.com, Shirisha G, Sourabh Jain
Thanks Tyrel for pointing. I will take a look and repost the fix later.
Reply all
Reply to author
Forward
0 new messages