lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKfTPtC3c50yo8AcQ7K9m73gP95dEsetjbhNXDN4RiR-nZ8UqA@mail.gmail.com>
Date:	Mon, 18 Feb 2013 16:06:58 +0100
From:	Vincent Guittot <vincent.guittot@...aro.org>
To:	Frederic Weisbecker <fweisbec@...il.com>
Cc:	linux-kernel@...r.kernel.org, linaro-dev@...ts.linaro.org,
	peterz@...radead.org, mingo@...nel.org,
	Mike Galbraith <efault@....de>,
	Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH v2 1/2] sched: fix init NOHZ_IDLE flag

On 18 February 2013 15:38, Frederic Weisbecker <fweisbec@...il.com> wrote:
> 2013/2/18 Frederic Weisbecker <fweisbec@...il.com>:
>> 2013/2/8 Vincent Guittot <vincent.guittot@...aro.org>:
>>> On 8 February 2013 16:35, Frederic Weisbecker <fweisbec@...il.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
>
> Sorry, gmail messed up as usual.
>
> I pasted the original at: http://pastebin.com/DMm5U8J8

We can clear the idle flag only in the nohz_kick_needed which will not
be called if the sched_domain is NULL so the sequence 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);
}
                                                    dom =
rcu_dereference(cpu1_dom)
                                                    //dom == NULL, return

rcu_assign_pointer(cpu1_dom, dom);

                                                    dom =
rcu_dereference(cpu1_dom)
                                                    //dom != NULL,
                                                    nohz_kick_needed {

set_idle(CPU 1)
                                                                   dom
= rcu_dereference(cpu1_dom)

//dec nr_cpus_busy,
                                                    }

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ