From 61df47fda30ca73993716193e91ca6a16ac1dee3 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Mon, 10 Aug 2026 12:30:41 +0200 Subject: [PATCH] Resolves: RHEL-216318, Memory remove operation failed with continuous traces --- ...ailable-LMBs-from-CPU-less-NUMA-node.patch | 68 +++++++++++++++++++ ...ount-NUMA-counter-during-LMB-removal.patch | 31 +++++++++ powerpc-utils.spec | 11 ++- 3 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 powerpc-utils-1.3.10-drmgr-Remove-only-available-LMBs-from-CPU-less-NUMA-node.patch create mode 100644 powerpc-utils-1.3.10-drmgr-Update-cpuless_lmb_count-NUMA-counter-during-LMB-removal.patch diff --git a/powerpc-utils-1.3.10-drmgr-Remove-only-available-LMBs-from-CPU-less-NUMA-node.patch b/powerpc-utils-1.3.10-drmgr-Remove-only-available-LMBs-from-CPU-less-NUMA-node.patch new file mode 100644 index 0000000..789774f --- /dev/null +++ b/powerpc-utils-1.3.10-drmgr-Remove-only-available-LMBs-from-CPU-less-NUMA-node.patch @@ -0,0 +1,68 @@ +commit 8e0a9410baba62f16e9b9ac1a7096dc6c704ffa1 +Author: Haren Myneni +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 + Reviewed-by: Mingming Cao + Signed-off-by: Haren Myneni + Signed-off-by: Tyrel Datwyler + +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", diff --git a/powerpc-utils-1.3.10-drmgr-Update-cpuless_lmb_count-NUMA-counter-during-LMB-removal.patch b/powerpc-utils-1.3.10-drmgr-Update-cpuless_lmb_count-NUMA-counter-during-LMB-removal.patch new file mode 100644 index 0000000..7cb6ad5 --- /dev/null +++ b/powerpc-utils-1.3.10-drmgr-Update-cpuless_lmb_count-NUMA-counter-during-LMB-removal.patch @@ -0,0 +1,31 @@ +commit f74288cf94d73f58a338fc58d8e2907673bb36e5 +Author: Haren Myneni +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 + Reviewed-by: Mingming Cao + Signed-off-by: Haren Myneni + Signed-off-by: Tyrel Datwyler + +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 */ diff --git a/powerpc-utils.spec b/powerpc-utils.spec index bd18e4d..86d1d74 100644 --- a/powerpc-utils.spec +++ b/powerpc-utils.spec @@ -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 - 1.3.10-9.1 +- Resolves: RHEL-216318, Memory remove operation failed with continuous traces + * Wed Apr 23 2025 Than Ngo - 1.3.10-9 - Resolves: RHEL-86462, Fix handling of non contiguous CPU IDs