From: Chris Metcalf <cmetcalf@tilera.com>
To: Will Deacon <will.deacon@arm.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Tejun Heo <tj@kernel.org>,
Christoph Lameter <cl@linux-foundation.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
"rob.herring@calxeda.com" <rob.herring@calxeda.com>,
Nicolas Pitre <nico@linaro.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] tile: use a more conservative __my_cpu_offset in CONFIG_PREEMPT
Date: Mon, 30 Sep 2013 14:01:13 -0400 [thread overview]
Message-ID: <5249BC69.6080506@tilera.com> (raw)
In-Reply-To: <20130930094459.GC26036@mudshark.cambridge.arm.com>
On 9/30/2013 5:45 AM, Will Deacon wrote:
> On Fri, Sep 27, 2013 at 09:13:15PM +0100, Chris Metcalf wrote:
>> On 9/26/2013 1:57 PM, Will Deacon wrote:
>>> Hi Chris,
>>>
>>> On Thu, Sep 26, 2013 at 06:24:53PM +0100, Chris Metcalf wrote:
>>>> [...]
>>>> +static inline unsigned long __my_cpu_offset(void)
>>>> +{
>>>> + unsigned long tp;
>>>> + register unsigned long *sp asm("sp");
>>>> + asm("move %0, tp" : "=r" (tp) : "m" (*sp));
>>>> + return tp;
>>>> +}
>>> Hehe, nice to see this hack working out for you too. One thing to check is
>>> whether you have any funky addressing modes (things like writeback or
>>> post-increment), since the "m" constraint can bite you if you don't actually
>>> use it in the asm.
>> Well, we do have post increments, though I don't see why this is a problem here.
>> We define a target specific constraint "U" that excludes post-increments, but
>> again I don't see why "m" would cause trouble here. What was your experience?
> GCC assumes that each "m" operand is used *exactly once* in the asm, so if
> it decided to generate a post-increment/writeback addressing mode, you can
> end up with pointers off by a word if you didn't make use of the constraint
> in the code. You can try using "o", but GCC sometimes decides that's
> impossible during reload, so we end up combining it with the (undocumented,
> ARM-specific) "Q" constraint which is simply a [rN] addressing mode.
OK, makes sense. I've changed the code to use a "U" constraint (pushed up to the linux-tile tree).
Thanks!
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com
prev parent reply other threads:[~2013-09-30 18:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-26 17:24 [PATCH] tile: use a more conservative __my_cpu_offset in CONFIG_PREEMPT Chris Metcalf
2013-09-26 17:57 ` Will Deacon
2013-09-27 20:13 ` Chris Metcalf
2013-09-30 9:45 ` Will Deacon
2013-09-30 18:01 ` Chris Metcalf [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=5249BC69.6080506@tilera.com \
--to=cmetcalf@tilera.com \
--cc=benh@kernel.crashing.org \
--cc=cl@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nico@linaro.org \
--cc=rob.herring@calxeda.com \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=will.deacon@arm.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.