[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whEb2xVU7uGOFwLxPgX-U2asMu1bJQA8QUEZPrL7zWwQQ@mail.gmail.com>
Date: Sat, 22 Aug 2020 17:10:21 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Arvind Sankar <nivedita@...m.mit.edu>
Cc: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
Sedat Dilek <sedat.dilek@...il.com>,
Segher Boessenkool <segher@...nel.crashing.org>,
Thomas Gleixner <tglx@...utronix.de>,
Nick Desaulniers <ndesaulniers@...gle.com>,
"Paul E. McKenney" <paulmck@...nel.org>,
Ingo Molnar <mingo@...hat.com>, Arnd Bergmann <arnd@...db.de>,
Borislav Petkov <bp@...en8.de>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Zhenzhong Duan <zhenzhong.duan@...cle.com>,
Kees Cook <keescook@...omium.org>,
Peter Zijlstra <peterz@...radead.org>,
Juergen Gross <jgross@...e.com>,
Andy Lutomirski <luto@...nel.org>,
Andrew Cooper <andrew.cooper3@...rix.com>,
LKML <linux-kernel@...r.kernel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>,
Will Deacon <will@...nel.org>
Subject: Re: [PATCH] x86: work around clang IAS bug referencing __force_order
On Sat, Aug 22, 2020 at 4:11 PM Arvind Sankar <nivedita@...m.mit.edu> wrote:
>
> Actually, is a memory clobber required for correctness? Memory accesses
> probably shouldn't be reordered across a CRn write. Is asm volatile
> enough to stop that or do you need a memory clobber?
You do need a memory clobber if you really care about ordering wrt
normal memory references.
That said, I'm not convinced we do care here. Normal memory accesses
(as seen by the compiler) should be entirely immune to any changes we
do wrt CRx registers.
Because code that really fundamentally changes kernel mappings or
access rules is already written in low-level assembler (eg the entry
routines or bootup).
Anything that relies on the more subtle changes (ie user space
accesses etc) should already be ordered by other things - usually by
the fact that they are also "asm volatile".
But hey, maybe somebody can come up with an exception to that.
Linus
Powered by blists - more mailing lists