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

From: Suresh Siddha
Date: Thu Jun 16 2011 - 14:17:38 EST


On Thu, 2011-06-16 at 10:55 -0700, Peter Zijlstra wrote:
> On Thu, 2011-06-16 at 10:37 -0700, Suresh Siddha wrote:
> > On Thu, 2011-06-16 at 05:12 -0700, Peter Zijlstra wrote:
> > > On Tue, 2011-06-14 at 19:06 +0200, Tejun Heo wrote:
> > > Please have a look at:
> > >
> > > ---
> > > commit d91309f69b7bdb64aeb30106fde8d18c5dd354b5
> > > Author: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> > > Date: Fri Feb 11 22:07:46 2011 +0100
> > >
> > > x86: Fix text_poke_smp_batch() deadlock
> > >
> > > Fix this deadlock - we are already holding the mutex:
> > >
> > ...
> > > diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
> > > index 1236085..7038b95 100644
> > > --- a/arch/x86/kernel/alternative.c
> > > +++ b/arch/x86/kernel/alternative.c
> > > @@ -671,7 +671,7 @@ void __kprobes text_poke_smp_batch(struct text_poke_param *params, int n)
> > >
> > > atomic_set(&stop_machine_first, 1);
> > > wrote_text = 0;
> > > - stop_machine(stop_machine_text_poke, (void *)&tpp, NULL);
> > > + __stop_machine(stop_machine_text_poke, (void *)&tpp, NULL);
> > > }
> > >
> > > #if defined(CONFIG_DYNAMIC_FTRACE) || defined(HAVE_JUMP_LABEL)
> > >
> >
> > Peter, So it looks like we are allowing a new cpu to come online in
> > parallel, while we poke the text? Isn't it a problem? What am I missing?
>
> the caller already did get_online_cpus(),
>
> do_optimize_kprobes()
> get_online_cpus()
> arch_optimize_kprobes()
> text_poke_smp_batch()
> put_online_cpus()

So the circular dependency reported is not possible in practice right?

Above patch is working around a false positive.

thanks,
suresh

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/