From: Peter Zijlstra <peterz@infradead.org>
To: Sodagudi Prasad <psodagud@codeaurora.org>
Cc: mingo@kernel.org, gregkh@linuxfoundation.org,
bigeasy@linutronix.de, tglx@linutronix.de, isaacm@codeaurora.org,
linux-kernel@vger.kernel.org
Subject: Re: cpu stopper threads and setaffinity leads to deadlock
Date: Thu, 2 Aug 2018 11:49:08 +0200 [thread overview]
Message-ID: <20180802094908.GK2494@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <24eebe1d874cb8e3b9a18087554544fa@codeaurora.org>
On Wed, Aug 01, 2018 at 06:34:40PM -0700, Sodagudi Prasad wrote:
> Due to cross migration of tasks between cpu7 and cpu3, migration/7 has
> started executing and waits for the migration/3 task, so that they can
> proceed within the multi cpu stop state machine together.
> Unfortunately stress-ng-affin is affine to cpu7, and since migration 7 has
> started running, and has monopolized cpu7’s execution, stress-ng will never
> run on cpu7, and cpu3’s migration task is never woken up.
> diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
> index e190d1e..f932e1e 100644
> --- a/kernel/stop_machine.c
> +++ b/kernel/stop_machine.c
> @@ -87,9 +87,9 @@ static bool cpu_stop_queue_work(unsigned int cpu, struct
> cpu_stop_work *work)
> __cpu_stop_queue_work(stopper, work, &wakeq);
> else if (work->done)
> cpu_stop_signal_done(work->done);
> - raw_spin_unlock_irqrestore(&stopper->lock, flags);
>
> wake_up_q(&wakeq);
> + raw_spin_unlock_irqrestore(&stopper->lock, flags);
>
So why didn't you do the 'obvious' parallel to what you did for
cpu_stop_queue_two_works(), namely:
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -81,6 +81,7 @@ static bool cpu_stop_queue_work(unsigned
unsigned long flags;
bool enabled;
+ preempt_disable();
raw_spin_lock_irqsave(&stopper->lock, flags);
enabled = stopper->enabled;
if (enabled)
@@ -90,6 +91,7 @@ static bool cpu_stop_queue_work(unsigned
raw_spin_unlock_irqrestore(&stopper->lock, flags);
wake_up_q(&wakeq);
+ preempt_enable();
return enabled;
}
next prev parent reply other threads:[~2018-08-02 9:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-02 1:34 cpu stopper threads and setaffinity leads to deadlock Sodagudi Prasad
2018-08-02 8:12 ` Peter Zijlstra
2018-08-02 8:27 ` Mike Galbraith
2018-08-02 8:45 ` Peter Zijlstra
2018-08-02 9:49 ` Peter Zijlstra [this message]
2018-08-03 11:41 ` Thomas Gleixner
2018-08-03 18:57 ` Sodagudi Prasad
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=20180802094908.GK2494@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bigeasy@linutronix.de \
--cc=gregkh@linuxfoundation.org \
--cc=isaacm@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=psodagud@codeaurora.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).