public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Prateek Sood <prsood@codeaurora.org>
To: Tejun Heo <tj@kernel.org>
Cc: lizefan@huawei.com, cgroups@vger.kernel.org,
	linux-kernel@vger.kernel.org, sramana@codeaurora.org,
	mingo@kernel.org, longman@redhat.com, apkm@linux-foundation.org
Subject: Re: [PATCH] Workqueue lockup: Circular dependency in threads
Date: Wed, 6 Sep 2017 16:47:25 +0530	[thread overview]
Message-ID: <6de44880-c641-5e89-ff07-68ba206b692c@codeaurora.org> (raw)
In-Reply-To: <20170905132242.GA1774378@devbig577.frc2.facebook.com>

On 09/05/2017 06:52 PM, Tejun Heo wrote:
> Hello,
> 
> On Thu, Aug 31, 2017 at 06:43:56PM +0530, Prateek Sood wrote:
>>> 6) cpuset_mutex is acquired by task init:1 and is waiting for cpuhotplug lock.
> 
> Yeah, this is the problematic one.
> 
>>> We can reorder the sequence of locks as in the below diff to avoid this
>>> deadlock. But I am looking for inputs/better solution to fix this deadlock.
>>>
>>> ---
>>> diff --git a/kernel/cpuset.c b/kernel/cpuset.c
>>>  /**
>>>   * update_tasks_cpumask - Update the cpumasks of tasks in the cpuset.
>>>   * @cs: the cpuset in which each task's cpus_allowed mask needs to be changed
>>> @@ -930,7 +946,7 @@ static void update_cpumasks_hier(struct cpuset *cs, struct cpumask *new_cpus)
>>>  	rcu_read_unlock();
>>>  
>>>  	if (need_rebuild_sched_domains)
>>> -		rebuild_sched_domains_locked();
>>> +		rebuild_sched_domains_unlocked()(without taking cpuhotplug.lock)
>>>  }
>>>  
>>>  /**
>>> @@ -1719,6 +1735,7 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of,
>>> +	get_online_cpus();
>>>  	mutex_lock(&cpuset_mutex);
>>>  	if (!is_cpuset_online(cs))
>>>  		goto out_unlock;
>>> @@ -1744,6 +1761,7 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of,
>>>  	mutex_unlock(&cpuset_mutex);
>>> +	put_online_cpus();
>>>  	kernfs_unbreak_active_protection(of->kn);
>>>  	css_put(&cs->css);
>>>  	flush_workqueue(cpuset_migrate_mm_wq);
>>>
> 
> And the patch looks good to me.  Can you please format the patch with
> proper description and sob?
> 
> Thanks.
> 

Thanks for review Tejun

I will send updated patch.

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

      reply	other threads:[~2017-09-06 11:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-30 13:58 [PATCH] Workqueue lockup: Circular dependency in threads Prateek Sood
2017-08-31 13:13 ` Prateek Sood
2017-09-05 13:22   ` Tejun Heo
2017-09-06 11:17     ` Prateek Sood [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6de44880-c641-5e89-ff07-68ba206b692c@codeaurora.org \
    --to=prsood@codeaurora.org \
    --cc=apkm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=longman@redhat.com \
    --cc=mingo@kernel.org \
    --cc=sramana@codeaurora.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox