lkml.org 
[lkml]   [2012]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] Fix the race between smp_call_function and CPU booting
Date


> -----Original Message-----
> From: Peter Zijlstra [mailto:peterz@infradead.org]
> Sent: Friday, March 16, 2012 5:49 PM
> To: Liu, Chuansheng
> Cc: linux-kernel@vger.kernel.org; Yanmin Zhang; tglx@linutronix.de
> Subject: RE: [PATCH] Fix the race between smp_call_function and CPU booting
>
> On Fri, 2012-03-16 at 06:24 +0000, Liu, Chuansheng wrote:
>
> > Based on your patch, I did a little modification, how do you think of that?
>
> > --- a/kernel/cpu.c
> > +++ b/kernel/cpu.c
> > @@ -640,8 +640,10 @@ void set_cpu_present(unsigned int cpu, bool
> > present)
> >
> > void set_cpu_online(unsigned int cpu, bool online) {
> > - if (online)
> > + if (online) {
> > cpumask_set_cpu(cpu, to_cpumask(cpu_online_bits));
> > + cpumask_set_cpu(cpu, to_cpumask(cpu_active_bits));
> > + }
> > else
> > cpumask_clear_cpu(cpu, to_cpumask(cpu_online_bits));
> > }
>
> I'm thinking this lacks rationale. What was wrong, Why does this fix it.
> If you can't answer that stop tinkering and start thinking.
Your patch advance the setting active bit before online setting, that will cause
an warning error, I just move the setting active bit after setting online setting, it can fix
the warning error, and it can fix the race issue between smp_call_function and CPU booting.

I have tested it by some stress tests.



\
 
 \ /
  Last update: 2012-03-19 02:01    [W:0.170 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site