All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: James Yang <James.Yang@freescale.com>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/ppc64: remove __volatile__ in  get_current()
Date: Fri, 23 Aug 2013 18:48:52 -0500	[thread overview]
Message-ID: <1377301732.20722.110.camel@snotra.buserror.net> (raw)
In-Reply-To: <alpine.LRH.2.00.1308231832570.4940@ra8135-ec1.am.freescale.net>

On Fri, 2013-08-23 at 18:40 -0500, James Yang wrote:
> On Sat, 10 Aug 2013, James Yang wrote:
> 
> > Uses of get_current() that normally get optimized away still result in
> > a load instruction of the current pointer in 64-bit because the inline
> > asm uses __volatile__.  This patch removes __volatile__ so that nop-ed
> > uses of get_current() don't actually result in a load of the pointer.
> > 
> > Signed-off-by: James Yang <James.Yang@freescale.com>
> > ---
> >  arch/powerpc/include/asm/current.h |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/arch/powerpc/include/asm/current.h b/arch/powerpc/include/asm/current.h
> > index e2c7f06..bb250c8 100644
> > --- a/arch/powerpc/include/asm/current.h
> > +++ b/arch/powerpc/include/asm/current.h
> > @@ -19,7 +19,7 @@ static inline struct task_struct *get_current(void)
> >  {
> >  	struct task_struct *task;
> >  
> > -	__asm__ __volatile__("ld %0,%1(13)"
> > +	__asm__ ("ld %0,%1(13)"
> >  	: "=r" (task)
> >  	: "i" (offsetof(struct paca_struct, __current)));
> 
> 
> Hello, 
> 
> Scott's been able to put enough doubt in me to think that this is not 
> entirely safe, even though the testing and code generation show it to 
> work.  Please reject this patch.
> 
> I think there is still value in getting the unnecessary loads to be 
> removed since it would also allow unnecessary conditional branches to 
> be removed.  I'll think about alternate ways to do this.

Actually, I changed my mind in the other direction in parallel. :-P

I think it's probably safe.

-Scott

  reply	other threads:[~2013-08-23 23:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-10  4:49 [PATCH] powerpc/ppc64: remove __volatile__ in get_current() James Yang
2013-08-23 23:40 ` James Yang
2013-08-23 23:48   ` Scott Wood [this message]
2013-08-24  0:22     ` Benjamin Herrenschmidt
2013-08-24  0:20   ` Benjamin Herrenschmidt

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=1377301732.20722.110.camel@snotra.buserror.net \
    --to=scottwood@freescale.com \
    --cc=James.Yang@freescale.com \
    --cc=linuxppc-dev@lists.ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.