[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200305090136.09f4bebf@gandalf.local.home>
Date: Thu, 5 Mar 2020 09:01:36 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: "Paul E. McKenney" <paulmck@...nel.org>, mingo@...hat.com,
juri.lelli@...hat.com, vincent.guittot@...aro.org,
dietmar.eggemann@....com, bsegall@...gle.com, mgorman@...e.de,
linux-kernel@...r.kernel.org
Subject: Re: Pinning down a blocked task to extract diagnostics
On Thu, 5 Mar 2020 09:13:37 +0100
Peter Zijlstra <peterz@...radead.org> wrote:
> > Close, the thing pi_lock actually guards is the t->state transition *to*
> > TASK_WAKING/TASK_RUNNING, so something like this:
>
> Almost, we must indeed also check ->on_rq, otherwise it might change the
> state back itself.
>
> >
> > raw_spin_lock_irq(&t->pi_lock);
> > switch (t->state) {
> > case TASK_RUNNING:
> > case TASK_WAKING:
> > /* ignore */
> > break;
> >
> > default:
Don't we need a smp_rmb() here, otherwise we could have the same issue as
described in the comment in try_to_wake_up()?
-- Steve
> if (t->on_rq)
> break;
>
> > /* Extract consistent diagnostic information. */
> > break;
> > }
> > raw_spin_unlock_irq(&t->pi_lock);
> >
> > ought to work. But if you're going to do this, please add a reference to
> > that code in a comment on top of try_to_wake_up(), such that we can
> > later find all the code that relies on this.
Powered by blists - more mailing lists