From: "Paul E. McKenney" <paulmck@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
bsegall@google.com, mgorman@suse.de,
linux-kernel@vger.kernel.org
Subject: Re: Pinning down a blocked task to extract diagnostics
Date: Wed, 4 Mar 2020 20:25:40 -0800 [thread overview]
Message-ID: <20200305042540.GZ2935@paulmck-ThinkPad-P72> (raw)
In-Reply-To: <20200304225226.6d631baa@oasis.local.home>
On Wed, Mar 04, 2020 at 10:52:26PM -0500, Steven Rostedt wrote:
> On Wed, 4 Mar 2020 16:50:49 -0800
> "Paul E. McKenney" <paulmck@kernel.org> wrote:
>
> > Hello!
> >
> > Suppose that I need to extract diagnostics information from a blocked
> > task, but that I absolutely cannot tolerate this task awakening in the
> > midst of this extraction process. Is the following code the right way
> > to make this work given a task "t"?
> >
> > raw_spin_lock_irq(&t->pi_lock);
> > if (t->on_rq) {
> > /* Task no longer blocked, so ignore it. */
> > } else {
> > /* Extract consistent diagnostic information. */
> > }
> > raw_spin_unlock_irq(&t->pi_lock);
> >
> > It looks like all the wakeup paths acquire ->pi_lock, but I figured I
> > should actually ask...
>
> IIUC, the rtmutex code uses pi_lock to tinker with the task while it is
> blocked (not woken). But the on_rq test may not be correct. It appears
> that can change without holding the task's pi_lock. I'm looking at the
> ttwu_do_activate() code which modifies the t->on_rq without holding the
> pi_lock. Seems you may need to check the p->state as well. See the
> comment in try_to_wake_up() about testing on_rq vs the state.
Thank you, Steve!
Thanx, Paul
next prev parent reply other threads:[~2020-03-05 4:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-05 0:50 Paul E. McKenney
2020-03-05 3:52 ` Steven Rostedt
2020-03-05 4:25 ` Paul E. McKenney [this message]
2020-03-05 8:07 ` Peter Zijlstra
2020-03-05 8:13 ` Peter Zijlstra
2020-03-05 14:01 ` Steven Rostedt
2020-03-05 14:22 ` Paul E. McKenney
2020-03-05 14:28 ` Steven Rostedt
2020-03-05 15:36 ` Paul E. McKenney
2020-03-06 1:40 ` Paul E. McKenney
2020-03-06 16:56 ` Steven Rostedt
2020-03-06 21:01 ` Paul E. McKenney
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=20200305042540.GZ2935@paulmck-ThinkPad-P72 \
--to=paulmck@kernel.org \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.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
all inboxes | Powered by JetHome®