Re: [PATCH 1/3] stop_machine: kill __stop_machine()

From: Tejun Heo
Date: Thu Jun 16 2011 - 14:28:15 EST


On Thu, Jun 16, 2011 at 11:17:40AM -0700, Suresh Siddha wrote:
> On Thu, 2011-06-16 at 10:55 -0700, Peter Zijlstra wrote:
> > the caller already did get_online_cpus(),
> >
> > do_optimize_kprobes()
> > get_online_cpus()
> > arch_optimize_kprobes()
> > text_poke_smp_batch()
> > put_online_cpus()

Peter, I don't think it's that simple. get_online_cpus() itself can't
create circular dependency by itself. It allows recursing. The chain
involves cpu_hotplug_begin() which returns with hotplug mutex held.

> So the circular dependency reported is not possible in practice right?
> Above patch is working around a false positive.

But I don't think the lockdep warning is spurious. text_mutex ->
hotplug.lock dependency is created during kprobe patching.
hotplug.lock -> smp_alt during CPU hotplug, and then the alternative
code calling get_online_cpus() creates reverse dependency through
get_online_cpus(). So, the reasoning and comment are wrong but
grapping hotplug mutex there does create a circular dependency.

This probably can be resolved in prettier way but let's leave it alone
for now.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at