linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	linux-arch@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: current_thread_info() vs task_thread_info(current)
Date: Mon, 18 Jul 2011 17:39:30 -0700	[thread overview]
Message-ID: <20110719003930.GF2312@linux.vnet.ibm.com> (raw)
In-Reply-To: <1311024983.25044.325.camel@pasglop>

On Tue, Jul 19, 2011 at 07:36:23AM +1000, Benjamin Herrenschmidt wrote:
> On Mon, 2011-07-18 at 07:37 -0700, Paul E. McKenney wrote:
> > On Mon, Jul 18, 2011 at 09:54:57PM +1000, Benjamin Herrenschmidt wrote:
> > > On Mon, 2011-07-18 at 13:23 +0200, Peter Zijlstra wrote:
> > > 
> > > > So how are we going to solve this? Naively I'd think that
> > > > current_thread_info() is short for task_thread_info(current), and thus
> > > > the platforms for where this isn't true are broken.
> > > > 
> > > > I mean, what use is the thread_info not of a thread?
> > > > 
> > > > Comments?
> > > 
> > > Thomas just hit a bug in the platform code of said platform (powerpc
> > > heh ?) :-)
> > > 
> > > We do it right for hard IRQs and for some reason never did it right for
> > > softirqs.
> > > 
> > > The code is like this for the former:
> > > 
> > > static inline void handle_one_irq(unsigned int irq)
> > > {
> > > 
> > >         .../...
> > > 
> > > 	call_handle_irq(irq, desc, irqtp, desc->handle_irq);
> > > 	current->thread.ksp_limit = saved_sp_limit;
> > > 	irqtp->task = NULL;
> > > 
> > > 	/* Set any flag that may have been set on the
> > > 	 * alternate stack
> > > 	 */
> > > 	if (irqtp->flags)
> > > 		set_bits(irqtp->flags, &curtp->flags);
> > > }
> > > 
> > > So what we need, I suppose is to add those two last line to
> > > do_softirq_onstack() as well.
> > 
> > Hmmm...  Would this explain preempt_count() inexplicably increasing by
> > three across a spin_unlock_irqrestore()?  I ran into this situation when
> > testing on Power over the weekend.
> 
> Hrm, no I don't see that happening no. The preempt count when exiting an
> irq or softirq stack should be the exact same as when entering it, which
> is why we don't bother copying it over. Do you see any case where that
> wouldn't hold ?

Nope, other than seeing preempt_count() transition from zero to three
across a spin_unlock_irqrestore() for no good reason that I could see.

							Thanx, Paul

  parent reply	other threads:[~2011-07-19  0:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-18 11:23 current_thread_info() vs task_thread_info(current) Peter Zijlstra
2011-07-18 11:36 ` Gleb Natapov
2011-07-18 11:44   ` Peter Zijlstra
2011-07-18 11:48     ` Gleb Natapov
2011-07-18 11:54 ` Benjamin Herrenschmidt
2011-07-18 14:37   ` Paul E. McKenney
2011-07-18 21:36     ` Benjamin Herrenschmidt
2011-07-18 21:36       ` Benjamin Herrenschmidt
2011-07-19  0:39       ` Paul E. McKenney [this message]
2011-07-19  0:57         ` Benjamin Herrenschmidt
2011-07-19  0:57           ` Benjamin Herrenschmidt
2011-07-19  3:04           ` Paul E. McKenney
2011-07-19  3:46             ` 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=20110719003930.GF2312@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.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).