public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cacheinfo: Remove of_node_put() for fw_token
@ 2026-01-02 19:34 Petr Malat
  2026-01-05 10:50 ` Sudeep Holla
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Malat @ 2026-01-02 19:34 UTC (permalink / raw)
  To: stable; +Cc: pierre.gondois, wen.yang, sudeep.holla, Petr Malat

fw_token is used for DT/ACPI systems to identify CPUs sharing caches.
For DT based systems, fw_token is set to a pointer to a DT node.

Commit 22def0b492e6 ("arch_topology: Build cacheinfo from primary CPU")
removed clearing of per_cpu_cacheinfo(cpu), which leads to reference
underrun in cache_shared_cpu_map_remove() during repeated cpu
offline/online as the reference is no longer incremented, because
allocate_cache_info() is now skipped in the online path.

The same problem existed on upstream but had a different root cause,
see 2613cc29c572 ("cacheinfo: Remove of_node_put() for fw_token").

Fixes the following splat:
  OF: ERROR: Bad of_node_put() on /cpus/l2-cache0
  CPU: 3 PID: 29 Comm: cpuhp/3 Tainted: G           O       6.1.159-arm64 #1
  Hardware name: AXM56xx Victoria (DT)
  Call trace:
   dump_backtrace+0xd8/0x12c
   show_stack+0x1c/0x34
   dump_stack_lvl+0x70/0x88
   dump_stack+0x14/0x2c
   of_node_release+0x134/0x138
   kobject_put+0xa8/0x21c
   of_node_put+0x1c/0x28
   cache_shared_cpu_map_remove+0x19c/0x220
   cacheinfo_cpu_pre_down+0x60/0xa0
   cpuhp_invoke_callback+0x140/0x570
   cpuhp_thread_fun+0xc8/0x19c
   smpboot_thread_fn+0x218/0x23c
   kthread+0x108/0x118
   ret_from_fork+0x10/0x20

Fixes: 22def0b492e6 ("arch_topology: Build cacheinfo from primary CPU")
Signed-off-by: Petr Malat <oss@malat.biz>
---
 drivers/base/cacheinfo.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c
index 9e11d42b0d64..b57f64725f25 100644
--- a/drivers/base/cacheinfo.c
+++ b/drivers/base/cacheinfo.c
@@ -404,8 +404,6 @@ static void cache_shared_cpu_map_remove(unsigned int cpu)
 				}
 			}
 		}
-		if (of_have_populated_dt())
-			of_node_put(this_leaf->fw_token);
 	}
 
 	/* cpu is no longer populated in the shared map */
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cacheinfo: Remove of_node_put() for fw_token
  2026-01-02 19:34 [PATCH] cacheinfo: Remove of_node_put() for fw_token Petr Malat
@ 2026-01-05 10:50 ` Sudeep Holla
  2026-01-05 13:06   ` Petr Malat
  0 siblings, 1 reply; 3+ messages in thread
From: Sudeep Holla @ 2026-01-05 10:50 UTC (permalink / raw)
  To: Petr Malat; +Cc: stable, pierre.gondois, wen.yang, Sudeep Holla

On Fri, Jan 02, 2026 at 08:34:57PM +0100, Petr Malat wrote:
> fw_token is used for DT/ACPI systems to identify CPUs sharing caches.
> For DT based systems, fw_token is set to a pointer to a DT node.
> 
> Commit 22def0b492e6 ("arch_topology: Build cacheinfo from primary CPU")
> removed clearing of per_cpu_cacheinfo(cpu), which leads to reference
> underrun in cache_shared_cpu_map_remove() during repeated cpu
> offline/online as the reference is no longer incremented, because
> allocate_cache_info() is now skipped in the online path.
> 
> The same problem existed on upstream but had a different root cause,
> see 2613cc29c572 ("cacheinfo: Remove of_node_put() for fw_token").
> 

Please let us know which stable versions you need this for ? I assume it
is for stable only, but it not clear from the subject.

Or do you want this to be applied only for v6.1.x as 22def0b492e6 exist
in v6.1.x ?

-- 
Regards,
Sudeep

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cacheinfo: Remove of_node_put() for fw_token
  2026-01-05 10:50 ` Sudeep Holla
@ 2026-01-05 13:06   ` Petr Malat
  0 siblings, 0 replies; 3+ messages in thread
From: Petr Malat @ 2026-01-05 13:06 UTC (permalink / raw)
  To: Sudeep Holla; +Cc: stable, pierre.gondois, wen.yang

Hi!
On Mon, Jan 05, 2026 at 10:50:57AM +0000, Sudeep Holla wrote:
> On Fri, Jan 02, 2026 at 08:34:57PM +0100, Petr Malat wrote:
> > fw_token is used for DT/ACPI systems to identify CPUs sharing caches.
> > For DT based systems, fw_token is set to a pointer to a DT node.
> >
> > Commit 22def0b492e6 ("arch_topology: Build cacheinfo from primary CPU")
> > removed clearing of per_cpu_cacheinfo(cpu), which leads to reference
> > underrun in cache_shared_cpu_map_remove() during repeated cpu
> > offline/online as the reference is no longer incremented, because
> > allocate_cache_info() is now skipped in the online path.
> >
> > The same problem existed on upstream but had a different root cause,
> > see 2613cc29c572 ("cacheinfo: Remove of_node_put() for fw_token").
> >
>
> Please let us know which stable versions you need this for ? I assume it
> is for stable only, but it not clear from the subject.
>
> Or do you want this to be applied only for v6.1.x as 22def0b492e6 exist
> in v6.1.x ?

Yes, the problem appeared after update from 6.1.158 to 6.1.159 due to
the introduction of 22def0b492e6.

I haven't run into that problem on other branhes as they have 2613cc29c572,
which is the same code change, but just for a different reason.

BR,
  Petr

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-05 13:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-02 19:34 [PATCH] cacheinfo: Remove of_node_put() for fw_token Petr Malat
2026-01-05 10:50 ` Sudeep Holla
2026-01-05 13:06   ` Petr Malat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox