From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: James Yang <James.Yang@freescale.com>
Cc: scottwood@freescale.com, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/ppc64: remove __volatile__ in get_current()
Date: Sat, 24 Aug 2013 10:20:10 +1000 [thread overview]
Message-ID: <1377303610.3819.4.camel@pasglop> (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:
> 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.
Hrm, The problem has to do with PACA accesses moving around accross
preempt boundaries, it's a bit tricky, but in the case of "current"
shouldn't be a problem... while the rest of the PACA might change (CPU#
etc...) current remains stable for the point of view of a given thread.
So I think the patch is fine.
Scott ?
Now, we do need some serious rework of PACA accesses. I'm very *VERY*
nervous with what we have now. A bit of grepping shows dozens of cases
where gcc copies r13 into another register or even saves/restores it, it
scares the shit out of me :-)
My thinking is to make r13 a hidden reg like we do (or used to) on ppc32
with r2 and break down paca access into two forms:
- Direct access of a single field -> asm loads/stores inline
- Anything else, uses a get_paca/put_paca construct that includes a
preempt_disable/enable (and maybe along with a __get_paca/__put_paca
pair that doesn't). This basically does a mr of r13 into another
register and basically hides the whole lot from gcc.
The former would be used for single fields, the latter, while adding a
potentially unnecessary mr, will be much safer vs. gcc playing games
with r13.
Any volunteer ? Haven't had time to do it myself so far :-)
Cheers,
Ben.
prev parent reply other threads:[~2013-08-24 0:20 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
2013-08-24 0:22 ` Benjamin Herrenschmidt
2013-08-24 0:20 ` Benjamin Herrenschmidt [this message]
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=1377303610.3819.4.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=James.Yang@freescale.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=scottwood@freescale.com \
/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.