[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200902182449.GA3586123@rani.riverdale.lan>
Date: Wed, 2 Sep 2020 14:24:49 -0400
From: Arvind Sankar <nivedita@...m.mit.edu>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Arvind Sankar <nivedita@...m.mit.edu>,
Linus Torvalds <torvalds@...ux-foundation.org>,
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>,
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>, nadav.amit@...il.com,
Nathan Chancellor <natechancellor@...il.com>
Subject: Re: [PATCH v2] x86/asm: Replace __force_order with memory clobber
On Wed, Sep 02, 2020 at 08:19:25PM +0200, Miguel Ojeda wrote:
> On Wed, Sep 2, 2020 at 5:33 PM Arvind Sankar <nivedita@...m.mit.edu> wrote:
> >
> > + * The compiler should not reorder volatile asm, however older versions of GCC
> > + * had a bug (which was fixed in 8.1, 7.3 and 6.5) where they could sometimes
> > + * reorder volatile asm. The write functions are not a problem since they have
> > + * memory clobbers preventing reordering. To prevent reads from being reordered
> > + * with respect to writes, use a dummy memory operand.
>
> I see you added the information to the commit message, but I'd still
> reword this to something like:
Ah sorry, I forgot to change the comment in the source as well.
>
> "The compiler should not reorder volatile asm, however GCC 4.9.x and
> 5.x have a bug where they could sometimes reorder volatile asm. The
> bug was fixed in 8.1, 7.3 and 6.5. The write functions are not a
> problem since they have memory clobbers preventing reordering. To
> prevent reads from being reordered with respect to writes, use a dummy
> memory operand."
>
> The important point is that 4.9.x and 5.x *have* the bug and that is
> the reason for having the hack. In the old wording it seems like the
> bug is no more. Then one wonders why the hack is still there (i.e.
> perhaps because we don't trust it, perhaps to support the rest of the
> minor versions which are newer, perhaps to avoid regressions, perhaps
> only the comment was updated, etc.).
>
> Cheers,
> Miguel
Powered by blists - more mailing lists