Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1728069

Re: [PATCH] cgroup/cpuset: remove circular dependency deadlock

From Prateek Sood <prsood@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH] cgroup/cpuset: remove circular dependency deadlock
Date 2017-09-07 11:10 +0200
Message-ID <un0YY-6kj-57@gated-at.bofh.it> (permalink)
References <umYaK-4pA-33@gated-at.bofh.it> <umZq9-5em-5@gated-at.bofh.it> <un0Pf-61N-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 09/07/2017 02:26 PM, Boqun Feng wrote:
> On Thu, Sep 07, 2017 at 09:28:48AM +0200, Peter Zijlstra wrote:
>> On Thu, Sep 07, 2017 at 11:34:12AM +0530, Prateek Sood wrote:
>>> Remove circular dependency deadlock in a scenario where hotplug of CPU is
>>> being done while there is updation in cgroup and cpuset triggered from
>>> userspace.
>>>
>>> Example scenario:
>>> kworker/0:0 => kthreadd => init:729 => init:1 => kworker/0:0
>>>
>>> kworker/0:0 - percpu_down_write(&cpu_hotplug_lock)  [held]
>>>               flush(work)   [no high prio workqueue available on CPU]
>>>               wait_for_completion()
> 
> Hi Prateek,
> 
> so this is:
> 
> 	_cpu_down():
> 	  cpus_write_lock(); // percpu_down_write(&cpu_hotlug_lock)
> 	  cpuhp_invoke_callbacks():
> 	    workqueue_offine_cpu():
> 	      wq_update_unbound_numa():
> 	        alloc_unbound_pool():
> 	          get_unbound_pool():
> 		    create_worker():
> 		      kthread_create_on_node():
> 		        wake_up_process(kthreadd_task);
> 		        wait_for_completion(); // create->done
> 
> , right?
> 
> Wonder running in a kworker is necessary to trigger this, I mean running
> a cpu_down() in a normal process context could also trigger this, no?
> Just ask out of curiosity.
> 
> Regards,
> Boqun

Hi Boqun,

cpu_down() in normal process can also trigger this.



Regards
Prateek
> 
>>>
>>> kthreadd    - percpu_down_read(cgroup_threadgroup_rwsem)  [waiting]
>>>
>>> init:729    - percpu_down_write(cgroup_threadgroup_rwsem)   [held]
>>>               lock(cpuset_mutex)   [waiting]
>>>
>>> init:1      - lock(cpuset_mutex)   [held]
>>>               percpu_down_read(&cpu_hotplug_lock)   [waiting]
>>
>> That's both unreadable and useless :/ You want to tell what code paths
>> that were, not which random tasks happened to run them.
>>
>>
> [...]
> 


-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation
Center, Inc., is a member of Code Aurora Forum, a Linux Foundation
Collaborative Project

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] cgroup/cpuset: remove circular dependency deadlock Prateek Sood <prsood@codeaurora.org> - 2017-09-07 08:10 +0200
  Re: [PATCH] cgroup/cpuset: remove circular dependency deadlock Peter Zijlstra <peterz@infradead.org> - 2017-09-07 09:30 +0200
    Re: [PATCH] cgroup/cpuset: remove circular dependency deadlock Boqun Feng <boqun.feng@gmail.com> - 2017-09-07 11:00 +0200
      Re: [PATCH] cgroup/cpuset: remove circular dependency deadlock Prateek Sood <prsood@codeaurora.org> - 2017-09-07 11:10 +0200
    Re: [PATCH] cgroup/cpuset: remove circular dependency deadlock Prateek Sood <prsood@codeaurora.org> - 2017-09-07 11:10 +0200

csiph-web