lkml.org 
[lkml]   [2013]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 1/2] sched: fix init NOHZ_IDLE flag
From
2013/2/8 Vincent Guittot <vincent.guittot@linaro.org>:
> On 8 February 2013 16:35, Frederic Weisbecker <fweisbec@gmail.com> wrote:
>> What if the following happen (inventing function names but you get the idea):
>>
>> CPU 0 CPU 1
>>
>> dom = new_domain(...) {
>> nr_cpus_busy = 0;
>> set_idle(CPU 1); old_dom =get_dom()
>> clear_idle(CPU 1)
>> }
>> rcu_assign_pointer(cpu1_dom, dom);
>>
>>
>> Can this scenario happen?
>
> This scenario will be:
>
> CPU 0 CPU 1
>
> detach_and_destroy_domain {
> rcu_assign_pointer(cpu1_dom, NULL);
> }
>
> dom = new_domain(...) {
> nr_cpus_busy = 0;
> set_idle(CPU 1); old_dom =get_dom()
> old_dom is null
> //clear_idle(CPU
> 1) can't happen because a null domain is attached so we will never
> call nohz_kick_needed which is the only place where we can clear_idle
> }
> rcu_assign_pointer(cpu1_dom, dom);

So is the following possible?

= CPU 0 = = CPU 1=

detach_and_destroy_domain {
rcu_assign_pointer(cpu1_dom, NULL);
}

dom = new_domain(...) {
nr_cpus_busy = 0;
set_idle(CPU 1);
}

clear_idle(CPU 1)

dom = rcu_dereference(cpu1_dom)

//dom == NULL, return

rcu_assign_pointer(cpu1_dom, NULL);


set_idle(CPU 1)

dom = rcu_dereference(cpu1_dom)

//dec nr_cpus_busy, making it negative


\
 
 \ /
  Last update: 2013-02-18 16:01    [W:0.072 / U:0.624 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site