Re: [PATCH 2/2] powerpc/pseries/dlpar: Remove DT entries if failure from CPU ADD notifier
From: Haren Myneni <haren@linux.ibm.com>
Date: 2026-09-17 03:42:21
Also in:
linux-devicetree
On Wed, 2026-09-16 at 16:33 -0500, Rob Herring wrote:
On Tue, Sep 15, 2026 at 09:32:49PM -0700, Haren Myneni wrote:quoted
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.Would using the of_changeset_ API directly solve your issue? It's better designed for handling reverting a changeset. The of_attach_node/ of_detach_node() APIs have limited users and I'd really like to remove them. Or make them PPC specific perhaps. Looks like there is 1 non- PPC user that snuck in.
Thanks for your comments. of_changeset_apply(): After adding all entries, calls notifiers for each node and continue even after one notifier failure and returns failure. The caller does not know whether the failure is from attach node or notifier and from which node. So __of_changeset_revert_entries() can be used to revert entries if stopped on the first failure. of_changeset_revert(): always calls notifier for each node. I can use __of_changeset_revert_entries() since CPU add has just one notifier but not a standard interface. pseries_cpuhp_attach_nodes(): if (!of_node_check_flag(np, OF_DETACHED)) __of_changeset_revert_entries(&cs, *ret); The current code calls dlpar_detach_node() if online CPU failed after success from of_changeset_apply(). Hence added of_detach_node_no_notify(). PPC code calls of_changeset_apply() for multiple nodes and of_attach_node/of_detach_node for single node. Or defining some other node flag OF_NOTIFIED to call the notifier for revert / detach in of_changeset_*. Please let me know if you prefer to change of_changeset_*() instead of of_detach_node_no_notify(0. - Haren
Rob