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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 13 May 2011 18:34:47 +0900
From:	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To:	Yong Zhang <yong.zhang0@...il.com>
CC:	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Oleg Nesterov <oleg@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Ingo Molnar <mingo@...e.hu>, Li Zefan <lizf@...fujitsu.com>,
	Miao Xie <miaox@...fujitsu.com>
Subject: Re: [PATCH 1/2] cpuset: fix cpuset_cpus_allowed_fallback() don't
 update tsk->rt.nr_cpus_allowed

(2011/05/13 16:43), Yong Zhang wrote:
> On Fri, May 13, 2011 at 3:33 PM, KOSAKI Motohiro
> <kosaki.motohiro@...fujitsu.com>  wrote:
>> Hello,
>>
>>>>>> (3) schedule() makes fallback and cpuset_cpus_allowed_fallback
>>>>>>      change task->cpus_allowed
>>>>>
>>>>> I'm failing to see how this is happening, surely that kthread isn't
>>>>> actually running that early?
>>>>
>>>> If my understand correctly, current call graph is below.
>>>>
>>>> kernel_init()
>>>>         smp_init();
>>>>                 cpu_up()
>>>>                         ... cpu hotplug notification
>>>>                                 kthread_create()
>>>>         sched_init_smp();
>>>>
>>>>
>>>> So, cpu hotplug event is happen before sched_init_smp(). The old rule is,
>>>> all kthreads of using cpu-up notification have to use kthread_bind(). It
>>>> protected from sched load balance.
>>>>
>>>> but, now cpuset_cpus_allowed_fallback() forcedly change kthread's
>>>> cpumask.
>>>> Why is this works? the point are two.
>>>>
>>>> - rcu_cpu_kthread_should_stop() call set_cpus_allowed_ptr() again
>>>> periodically.
>>>>   then, it can reset cpumask if cpuset_cpus_allowed_fallback() change it.
>>>>   my debug print obseve following cpumask change occur at boot time.
>>>>      1) kthread_bind: bind cpu1
>>>>      2) cpuset_cpus_allowed_fallback: bind possible cpu
>>>>      3) rcu_cpu_kthread_should_stop: rebind cpu1
>>>> - while tsk->rt.nr_cpus_allowed == 1, sched load balancer never be crash.
>>>
>>> Seems rcu_spawn_one_cpu_kthread() call wake_up_process() directly,
>>> which is under hotplug event CPU_UP_PREPARE. Maybe it should be
>>> under CPU_ONLINE.
>>
>> Hmm..
>>
>> I haven't catch your point. cpu_up() call both CPU_UP_PREPARE and CPU_ONLINE
>> notification. Thus, CPU_ONLINE still be called before sched_init_smp().
>
> The difference is that CPU_ONLINE will set cpu_online_mask and cpu_active_mask,
> so wake_up_process()->ttwu()->select_task_rq() will not go back to
> cpuset_cpus_allowed_fallback().

Right. Thank you. Now I got your point!

> But the comments for rcu_cpu_kthread_should_stop() shot me, since
> rcu_spawn_one_cpu_kthread() must be called under CPU_UP_PREPARE
> for some reason.
>
> Maybe we should find a more suitable way for your issue :)

ok, I'll try to read and understand rcu-kthread design and find it out.



--
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