[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <46BB6F65.8040204@redhat.com>
Date: Thu, 09 Aug 2007 15:47:49 -0400
From: Chris Snook <csnook@...hat.com>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
CC: Segher Boessenkool <segher@...nel.crashing.org>,
wjiang@...ilience.com, cfriesen@...tel.com, wensong@...ux-vs.org,
heiko.carstens@...ibm.com, linux-kernel@...r.kernel.org,
ak@...e.de, netdev@...r.kernel.org, paulmck@...ux.vnet.ibm.com,
horms@...ge.net.au, akpm@...ux-foundation.org,
linux-arch@...r.kernel.org, jesper.juhl@...il.com,
torvalds@...ux-foundation.org, zlynx@....org,
rpjday@...dspring.com, schwidefsky@...ibm.com, davem@...emloft.net
Subject: Re: [PATCH 1/24] make atomic_read() behave consistently on alpha
Geert Uytterhoeven wrote:
> On Thu, 9 Aug 2007, Chris Snook wrote:
>> Segher Boessenkool wrote:
>>>>> The only safe way to get atomic accesses is to write
>>>>> assembler code. Are there any downsides to that? I don't
>>>>> see any.
>>>> The assumption that aligned word reads and writes are atomic, and that
>>>> words are aligned unless explicitly packed otherwise, is endemic in the
>>>> kernel. No sane compiler violates this assumption. It's true that we're
>>>> not portable to insane compilers after this patch, but we never were in
>>>> the first place.
>>> You didn't answer my question: are there any downsides to using
>>> explicit coded-in-assembler accesses for atomic accesses? You
>>> can handwave all you want that it should "just work" with
>>> volatile accesses, but volatility != atomicity, volatile in C
>>> is really badly defined, GCC never officially gave stronger
>>> guarantees, and we have a bugzilla full of PRs to show what a
>>> minefield it is.
>>>
>>> So, why not use the well-defined alternative?
>> Because we don't need to, and it hurts performance.
>
> It hurts performance by implementing 32-bit atomic reads in assembler?
No, I misunderstood the question. Implementing 32-bit atomic reads in assembler
is redundant, because any sane compiler, *particularly* and optimizing compiler
(and we're only in this mess because of optimizing compilers) will give us that
automatically without the assembler. Yes, it is legal for a compiler to violate
this assumption. It is also legal for us to refuse to maintain compatibility
with compilers that suck this badly. That decision was made a very long time
ago, and I consider it the correct decision.
-- Chris
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists