From: Haren Myneni <haren@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: devicetree@vger.kernel.org, maddy@linux.ibm.com, robh@kernel.org,
mpe@ellerman.id.au, npiggin@gmail.com, saravanak@kernel.org,
ritesh.list@gmail.com, hbabu@us.ibm.com, haren@linux.ibm.com
Subject: [PATCH 2/2] powerpc/pseries/dlpar: Remove DT entries if failure from CPU ADD notifier
Date: Tue, 15 Sep 2026 21:32:49 -0700 [thread overview]
Message-ID: <20260916043249.2062676-2-haren@linux.ibm.com> (raw)
In-Reply-To: <20260916043249.2062676-1-haren@linux.ibm.com>
For CPU ADD, the device tree entries are retrieved with
configure-connector RTAS call and attached to the device tree.
Then the CPU is added as part of DT node notification. If the CPU
ADD notifier returns failure, the corresponding CPU node entries
should be deleted from the device-tree. See pseries_add_processor()
for the possible failure cases.
The current code does not remove CPU node entries during CPU ADD
notifier failure and causing the following issues:
- Can not add this CPU later since already present in the
device-tree.
- Trying to free memory allocated to CPU node without detaching
the node and it causes freeing its sibling node (existing CPU
nodes).
This patch fixes this issue by calling of_detach_node_no_notify()
for the failure from CPU ADD notifier which removes CPU node
entries without calling CPU REMOVE notifier.
Signed-off-by: Haren Myneni <haren@linux.ibm.com>
---
arch/powerpc/platforms/pseries/dlpar.c | 9 ++++++---
arch/powerpc/platforms/pseries/hotplug-cpu.c | 4 ++--
arch/powerpc/platforms/pseries/mobility.c | 2 +-
arch/powerpc/platforms/pseries/pmem.c | 2 +-
arch/powerpc/platforms/pseries/pseries.h | 2 +-
5 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index f4d33b8dffd8..01a9849773cd 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -247,15 +247,18 @@ int dlpar_attach_node(struct device_node *dn, struct device_node *parent)
return 0;
}
-int dlpar_detach_node(struct device_node *dn)
+int dlpar_detach_node(struct device_node *dn, bool notify)
{
struct device_node *child;
int rc;
for_each_child_of_node(dn, child)
- dlpar_detach_node(child);
+ dlpar_detach_node(child, notify);
- rc = of_detach_node(dn);
+ if (notify)
+ rc = of_detach_node(dn);
+ else
+ rc = of_detach_node_no_notify(dn);
if (rc)
return rc;
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index bc6926dbf148..db359fa3f922 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -603,7 +603,7 @@ static ssize_t dlpar_cpu_add(u32 drc_index)
rc = dlpar_release_drc(drc_index);
if (!rc)
- dlpar_free_cc_nodes(dn);
+ dlpar_detach_node(dn, false);
return saved_rc;
}
@@ -616,7 +616,7 @@ static ssize_t dlpar_cpu_add(u32 drc_index)
pr_warn("Failed to online cpu %pOFn, rc: %d, drc index: %x\n",
dn, rc, drc_index);
- rc = dlpar_detach_node(dn);
+ rc = dlpar_detach_node(dn, true);
if (!rc)
dlpar_release_drc(drc_index);
diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index b5c2abd12432..e0e4ef04c679 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -112,7 +112,7 @@ static int delete_dt_node(struct device_node *dn)
}
pr_debug("removing node %pOFfp\n", dn);
- dlpar_detach_node(dn);
+ dlpar_detach_node(dn, true);
return 0;
}
diff --git a/arch/powerpc/platforms/pseries/pmem.c b/arch/powerpc/platforms/pseries/pmem.c
index 0f1d45f32e4a..b60a01745137 100644
--- a/arch/powerpc/platforms/pseries/pmem.c
+++ b/arch/powerpc/platforms/pseries/pmem.c
@@ -85,7 +85,7 @@ static ssize_t pmem_drc_remove_node(u32 drc_index)
pr_debug("Attempting to remove %pOF, drc index: %x\n", dn, drc_index);
/* * NB: tears down the ibm,pmemory device as a side-effect */
- rc = dlpar_detach_node(dn);
+ rc = dlpar_detach_node(dn, true);
if (rc)
return rc;
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
index 3968a6970fa8..6f80e58e6186 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -50,7 +50,7 @@ extern void dlpar_free_cc_property(struct property *);
extern struct device_node *dlpar_configure_connector(__be32,
struct device_node *);
extern int dlpar_attach_node(struct device_node *, struct device_node *);
-extern int dlpar_detach_node(struct device_node *);
+extern int dlpar_detach_node(struct device_node *, bool);
extern int dlpar_acquire_drc(u32 drc_index);
extern int dlpar_release_drc(u32 drc_index);
extern int dlpar_unisolate_drc(u32 drc_index);
--
2.55.0
next prev parent reply other threads:[~2026-09-16 4:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 4:32 [PATCH 1/2] drivers/of: Add of_detach_node_no_notify() Haren Myneni
2026-09-16 4:32 ` Haren Myneni [this message]
2026-09-16 4:47 ` [PATCH 2/2] powerpc/pseries/dlpar: Remove DT entries if failure from CPU ADD notifier sashiko-bot
2026-09-17 3:57 ` Haren Myneni
2026-09-16 21:33 ` Rob Herring
2026-09-17 3:42 ` Haren Myneni
2026-09-16 4:43 ` [PATCH 1/2] drivers/of: Add of_detach_node_no_notify() sashiko-bot
2026-09-17 4:11 ` Haren Myneni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260916043249.2062676-2-haren@linux.ibm.com \
--to=haren@linux.ibm.com \
--cc=devicetree@vger.kernel.org \
--cc=hbabu@us.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=ritesh.list@gmail.com \
--cc=robh@kernel.org \
--cc=saravanak@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox