mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>, Tejun Heo <tj@kernel.org>
Cc: Qais Yousef <qais.yousef@arm.com>,
	Xuewen Yan <xuewen.yan@unisoc.com>,
	rafael@kernel.org, viresh.kumar@linaro.org, mingo@redhat.com,
	peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	bsegall@google.com, mgorman@suse.de, bristot@redhat.com,
	linux-kernel@vger.kernel.org, ke.wang@unisoc.com,
	xuewyan@foxmail.com, linux-pm@vger.kernel.org
Subject: Re: [PATCH] sched/schedutil: Fix deadlock between cpuset and cpu hotplug when using schedutil
Date: Tue, 12 Jul 2022 23:02:48 -0400	[thread overview]
Message-ID: <a51a0a2e-d50d-c172-9403-034b13dff1a4@redhat.com> (raw)
In-Reply-To: <20220711171130.6390600b@gandalf.local.home>

On 7/11/22 17:11, Steven Rostedt wrote:
> On Mon, 11 Jul 2022 10:58:28 -1000
> Tejun Heo <tj@kernel.org> wrote:
>
>> I don't think lockdep would be able to track CPU1 -> CPU2 dependency here
>> unfortunately.
>>
>>> AFAIU:
>>>
>>>
>>> CPU0                                     CPU1                                   CPU2
>>>
>>> // attach task to a different
>>> // cpuset cgroup via sysfs
>>> __acquire(cgroup_threadgroup_rwsem)
>>>
>>>                                           // pring up CPU2 online
>>>                                           __acquire(cpu_hotplug_lock)
>>>                                           // wait for CPU2 to come online
> Should there be some annotation here that tells lockdep that CPU1 is now
> blocked on CPU2?
>
> Then this case would be caught by lockdep.
>
> -- Steve
>
>
>>>                                                                                  // bringup cpu online
>>>                                                                                  // call cpufreq_online() which tries to create sugov kthread
>>> __acquire(cpu_hotplug_lock)                                                     copy_process()
>>>                                                                                     cgroup_can_fork()
>>>                                                                                        cgroup_css_set_fork()
>>>                                                                                        __acquire(cgroup_threadgroup_rwsem)
>>> // blocks forever                        // blocks forever                            // blocks forever

Actually, the dependency can probably be coded by calling 
lockdep_acquire_cpus_lock() in cpu2 (task 2) before acquiring 
cgroup_threadgroup_rwsem to indicate the dependency between CPU1 and 
CPU2 (task 1 and task 2). lockdep_release_cpus_lock() can then called 
after release the rwsem.

Cheers,
Longman


  parent reply	other threads:[~2022-07-13  3:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-05 12:37 Xuewen Yan
2022-07-11  7:21 ` Xuewen Yan
2022-07-11  7:32   ` Lukasz Luba
2022-07-11  7:43     ` Xuewen Yan
2022-07-11  7:47       ` Viresh Kumar
2022-07-11  7:50       ` Lukasz Luba
2022-07-11 17:46 ` Qais Yousef
2022-07-11 20:58   ` Tejun Heo
2022-07-11 21:11     ` Steven Rostedt
2022-07-12  5:42       ` Xuewen Yan
2022-07-12  5:57       ` Xuewen Yan
2022-07-13  3:02       ` Waiman Long [this message]
2022-07-12 12:57     ` Qais Yousef
2022-07-12 16:13       ` Tejun Heo
2022-07-12 17:14         ` Qais Yousef
2022-07-27 22:01         ` Peter Zijlstra
2022-07-27 22:05           ` Tejun Heo
2022-07-13  2:49     ` Waiman Long
2022-07-13  3:00       ` Tejun Heo
2022-07-20  7:45         ` Xuewen Yan
2022-07-27 20:09           ` Tejun Heo
2022-07-29  7:33             ` Xuewen Yan
2022-07-29  8:39               ` Qais Yousef
2022-07-29 19:59                 ` Tejun Heo
2022-08-09  2:02                   ` Xuewen Yan

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=a51a0a2e-d50d-c172-9403-034b13dff1a4@redhat.com \
    --to=longman@redhat.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=ke.wang@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=qais.yousef@arm.com \
    --cc=rafael@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    --cc=xuewen.yan@unisoc.com \
    --cc=xuewyan@foxmail.com \
    /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

Powered by JetHome