lkml.org 
[lkml]   [2008]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/11] Add generic helpers for arch IPI function calls
Hi!

>> Something like this will close the window to right up until the point
>> where the other CPUs have 'almost' called halt().
>>
>> diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
>> index 5398385..94ec9bf 100644
>> --- a/arch/x86/kernel/smp.c
>> +++ b/arch/x86/kernel/smp.c
>> @@ -155,8 +155,9 @@ static void stop_this_cpu(void *dummy)
>> /*
>> * Remove this CPU:
>> */
>> - cpu_clear(smp_processor_id(), cpu_online_map);
>> disable_local_APIC();
>> + cpu_clear(smp_processor_id(), cpu_online_map);
>> + smp_wmb();
>> if (hlt_works(smp_processor_id()))
>> for (;;) halt();
>> for (;;);
>> @@ -175,6 +176,12 @@ static void native_smp_send_stop(void)
>> local_irq_save(flags);
>> smp_call_function(stop_this_cpu, NULL, 0, 0);
>> +
>> + while (cpus_weight(cpu_online_map) > 1) {
>> + cpu_relax();
>> + smp_rmb();
>> + }
>> +
>> disable_local_APIC();
>> local_irq_restore(flags);
>> }
> ..
>
> Yup, that looks like it oughta work consistently.
> Now we just need to hear from some of the folks who
> have danced around this code in the past.
>
> (added Pavel & Rafael to Cc:).

I can't see anything wrong with this one, but I'm not smp expert...
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


\
 
 \ /
  Last update: 2008-04-25 13:11    [W:0.567 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site