[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wh=x7oCk05JD1=6XNsvvgpsidRWupoqySw1zODmvNy9Ug@mail.gmail.com>
Date: Thu, 17 Mar 2022 14:21:36 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Bill Wendling <morbo@...gle.com>
Cc: Nick Desaulniers <ndesaulniers@...gle.com>,
"H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Juergen Gross <jgross@...e.com>,
Peter Zijlstra <peterz@...radead.org>,
Andy Lutomirski <luto@...nel.org>, llvm@...ts.linux.dev,
LKML <linux-kernel@...r.kernel.org>,
linux-toolchains <linux-toolchains@...r.kernel.org>
Subject: Re: [PATCH v5] x86: use builtins to read eflags
On Thu, Mar 17, 2022 at 2:10 PM Bill Wendling <morbo@...gle.com> wrote:
> >
> > As a result, we mark pretty much all system instructions as being
> > memory clobbers, because that actually works.
>
> For now.
No. Forever.
If you change the compiler to ignore memory clobbers in inline asms,
we'll stop using clang again.
This is not some kind of "threat". This is literally just a plain fact.
If you turn your compiler into garbage, we can't use it.
End of discussion.
> > Whether they actually clobber memory or not is immaterial, and is not
> > why we do it.
>
> I understand that. My point is that it's not a guarantee that the
> compiler won't change in the future.
YES IT DAMN WELL IS.
If I have an inline asm thing, and I tell the compiler "this inline
asm reads or writes memory in ways you don't understand", and you then
move externally visible memory operations around it - or move other
inline asms that do the same thing around it - then your compiler is
simply not a compiler any more.
IT IS BROKEN SHIT.
See?
That memory clobber is not a "please mister compiler, can you pretty
please take this into account".
That memory clobber is a "if you don't take this into account, you are
now no longer a working compiler, and thank Gods we have
alternatives".
This is not a "in ten years things can change" kind of issue. This is
a very fundamental and simple thing.
I don't understand why you can't just admit that.
This is as simple as 2+2 being 4. That's black and white.
There is no "the compiler might optimize it to be 3 at some future date".
Linus
Powered by blists - more mailing lists