Resolves: RHEL-216318, Memory remove operation failed with continuous traces

This commit is contained in:
Than Ngo 2026-08-10 12:30:41 +02:00
parent 20983f36bf
commit 61df47fda3
3 changed files with 109 additions and 1 deletions

View File

@ -0,0 +1,68 @@
commit 8e0a9410baba62f16e9b9ac1a7096dc6c704ffa1
Author: Haren Myneni <haren@linux.ibm.com>
Date: Mon Feb 9 22:18:59 2026 -0800
drmgr: Remove only available LMBs from CPU less NUMA node
The current logic in remove_cpuless_lmbs() may remove more LMB
than requested.
todo = (count * node->ratio) / 100; --> can be 0
todo = min(todo, node->n_lmbs);
if (!todo && node->n_lmbs)
todo = (count - this_loop); -> todo may be > node->n_lmbs
Removing more lmbs than requested caused a decrement of count
(unsigned int) integer overflow, eventually leading to the drmgr
removing all available memory in the system. Existing testing
exposed the out of memory issue triggered by this counter
overflow.
This patch fixed this logic by adjusting todo per node dynamically
based on the count value and then determine todo value based on
number of available LMBs in the node.
Signed-off-by: Ryan Whittaker <ryancwmd@linux.ibm.com>
Reviewed-by: Mingming Cao <mmc@linux.ibm.com>
Signed-off-by: Haren Myneni <haren@linux.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
diff --git a/src/drmgr/drslot_chrp_mem.c b/src/drmgr/drslot_chrp_mem.c
index 179fb17..4a36c73 100644
--- a/src/drmgr/drslot_chrp_mem.c
+++ b/src/drmgr/drslot_chrp_mem.c
@@ -1565,11 +1565,16 @@ static int remove_cpuless_lmbs(uint32_t count)
continue;
todo = (count * node->ratio) / 100;
- todo = min(todo, node->n_lmbs);
- /* Fix rounded value to 0 */
- if (!todo && node->n_lmbs)
+ /*
+ * Fix rounded value to 0 and fix if a 0 ratio has
+ * been processed
+ */
+ if ((!todo && node->n_lmbs) || (count - this_loop < todo))
todo = (count - this_loop);
+ /* Donot request more than available */
+ todo = min(todo, node->n_lmbs);
+
if (todo)
todo = remove_lmb_from_node(node, todo);
@@ -1583,7 +1588,13 @@ static int remove_cpuless_lmbs(uint32_t count)
if (!this_loop)
break;
- count -= this_loop;
+ /*
+ * Should not happen, but in case prevent integer overflow
+ */
+ if (this_loop < count)
+ count -= this_loop;
+ else
+ count = 0;
}
say(DEBUG, "%d / %d LMBs removed from the CPU less nodes\n",

View File

@ -0,0 +1,31 @@
commit f74288cf94d73f58a338fc58d8e2907673bb36e5
Author: Haren Myneni <haren@linux.ibm.com>
Date: Mon Feb 9 22:18:58 2026 -0800
drmgr: Update cpuless_lmb_count NUMA counter during LMB removal
After removing LMBs from a NUMA node, LMB counters should be
decremented. In the case of CPU less node, cpuless_lmb_count
should be decremented. But the current code reduces
cpuless_node_count instead of cpuless_lmb_count. This patch
reduces cpuless_lmb_count NUMA counter based on number of LMBs
selected from that specific CPU less NUMA node.
Signed-off-by: Ryan Whittaker <ryancwmd@linux.ibm.com>
Reviewed-by: Mingming Cao <mmc@linux.ibm.com>
Signed-off-by: Haren Myneni <haren@linux.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
diff --git a/src/drmgr/drslot_chrp_mem.c b/src/drmgr/drslot_chrp_mem.c
index d37ee80..179fb17 100644
--- a/src/drmgr/drslot_chrp_mem.c
+++ b/src/drmgr/drslot_chrp_mem.c
@@ -1502,7 +1502,7 @@ static int remove_lmb_from_node(struct ppcnuma_node *node, uint32_t count)
if (node->n_cpus)
numa.lmb_count -= unlinked;
else
- numa.cpuless_node_count -= unlinked;
+ numa.cpuless_lmb_count -= unlinked;
if (!node->n_lmbs) {
node->ratio = 0; /* for sanity only */

View File

@ -1,6 +1,6 @@
Name: powerpc-utils
Version: 1.3.10
Release: 9%{?dist}
Release: 9%{?dist}.1
Summary: PERL-based scripts for maintaining and servicing PowerPC systems
Group: System Environment/Base
@ -43,6 +43,12 @@ Patch15: powerpc-utils-cpu_info_helpers-add-helper-function-to-retrieve-present-
# ppc64_cpu: Fix handling of non-contiguous CPU IDs
Patch16: powerpc-utils-ppc64_cpu-fix-handling-of-non-contiguous-CPU-IDs.patch
# drmgr: Update cpuless_lmb_count NUMA counter during LMB removal
Patch17: powerpc-utils-1.3.10-drmgr-Update-cpuless_lmb_count-NUMA-counter-during-LMB-removal.patch
# drmgr: Remove only available LMBs from CPU less NUMA node
Patch18: powerpc-utils-1.3.10-drmgr-Remove-only-available-LMBs-from-CPU-less-NUMA-node.patch
ExclusiveArch: ppc %{power64}
BuildRequires: gcc
@ -224,6 +230,9 @@ systemctl enable hcn-init.service >/dev/null 2>&1 || :
%{_mandir}/man8/lparnumascore.8*
%changelog
* Mon Aug 10 2026 Than Ngo <than@redhat.com> - 1.3.10-9.1
- Resolves: RHEL-216318, Memory remove operation failed with continuous traces
* Wed Apr 23 2025 Than Ngo <than@redhat.com> - 1.3.10-9
- Resolves: RHEL-86462, Fix handling of non contiguous CPU IDs