All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arvind Sankar <nivedita@alum.mit.edu>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Arvind Sankar <nivedita@alum.mit.edu>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Ingo Molnar <mingo@redhat.com>, Arnd Bergmann <arnd@arndb.de>,
	Borislav Petkov <bp@alien8.de>,
	"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Zhenzhong Duan <zhenzhong.duan@oracle.com>,
	Kees Cook <keescook@chromium.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Juergen Gross <jgross@suse.com>,
	Andy Lutomirski <luto@kernel.org>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	LKML <linux-kernel@vger.kernel.org>,
	clang-built-linux <clang-built-linux@googlegroups.com>,
	Will Deacon <will@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] x86: work around clang IAS bug referencing __force_order
Date: Fri, 21 Aug 2020 19:25:05 -0400	[thread overview]
Message-ID: <20200821232505.GA66405@rani.riverdale.lan> (raw)
In-Reply-To: <CAKwvOdkoB+fT9tt7vgg1R6J-NEr77EWP5X8nFat_L-HvEzWGzA@mail.gmail.com>

On Fri, Aug 21, 2020 at 04:16:56PM -0700, Nick Desaulniers wrote:
> On Fri, Aug 21, 2020 at 4:04 PM Arvind Sankar <nivedita@alum.mit.edu> wrote:
> >
> > On Fri, Aug 21, 2020 at 02:37:48AM +0200, Thomas Gleixner wrote:
> > > On Thu, Aug 20 2020 at 09:06, Arvind Sankar wrote:
> > > > I don't think that's an issue, or at least, not one where force_order
> > > > helps.
> > > >
> > > > If the source for foo() is not visible to the compiler, the only reason
> > > > force_order prevents the reordering is because foo() might have
> > > > references to it, but equally foo() might have volatile asm, so the
> > > > reordering isn't possible anyway.
> > > >
> > > > If the source is visible, force_order won't prevent any reordering
> > > > except across references to force_order, but the only references are
> > > > from the volatile asm's which already prevent reordering.
> > > >
> > > > I think force_order can only help with buggy compilers, and for those it
> > > > should really have been an input-output operand -- it wouldn't currently
> > > > do anything to prevent cr writes from being reordered.
> 
> I agree 100%.  From the link to GCC docs, the code in question doesn't
> even follow the pattern from the doc from informing the compiler of
> any dependency, it just looks like !@#$.
> 
> > >
> > > Fair enough. Care to provide a patch which has the collected wisdom of
> > > this thread in the changelog?
> > >
> > > Thanks,
> > >
> > >         tglx
> >
> > The gcc bug I linked to earlier is only fixed in gcc-6 onwards. Is that
> 
> (based on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82602#c14)

I actually checked gcc's git repo too. The fix is not there in gcc-4.9
and gcc-5.

> 
> > good enough to remove force_order? I can test gcc-4.9 and gcc-5 to check
> > if it would currently have any impact.
> 
> I think checking the disassemblies with a pre-gcc-6 would be good
> enough then; that bug isn't specific to this particular case.
> 
> > CBL guys, can you confirm that clang also will not reorder volatile asm?
> 
> Full disassemblies of vmlinux pre vs post __force_order removal are
> the same.  That's pretty good actually; I was worried for a code base
> of this size whether two compiles would produce the exact same
> disassemblies; I know the version strings are timestamped, for
> instance, but I didn't compare data, just .text.  I should triple
> check i386, and some of the ko's that use modified functions.  I'd be
> happy to help provide a tested by tag for numerous configurations with
> Clang.
> 
> Attaching the diff I was testing, feel free to add a commit message.
> --
> Thanks,
> ~Nick Desaulniers

Thanks, will write it up over the weekend.

  reply	other threads:[~2020-08-21 23:25 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 13:53 [PATCH] x86: work around clang IAS bug referencing __force_order Arnd Bergmann
2020-08-01 11:50 ` Sedat Dilek
2020-08-06 22:13   ` Thomas Gleixner
2020-08-07  7:03     ` Sedat Dilek
2020-08-04  0:09 ` Nick Desaulniers
2020-08-14 17:29   ` Sedat Dilek
2020-08-14 21:19     ` Sedat Dilek
2020-08-14 22:57       ` Nick Desaulniers
2020-08-15  0:26         ` Nick Desaulniers
2020-08-15  3:28           ` Sedat Dilek
2020-08-15  8:23             ` Sedat Dilek
2020-08-15 10:46               ` Sedat Dilek
2020-08-15 14:39                 ` Sedat Dilek
2020-08-16  9:37                   ` Sedat Dilek
2020-08-06 22:11 ` Thomas Gleixner
2020-08-13  0:12   ` Nick Desaulniers
2020-08-13  8:49     ` David Laight
2020-08-13 17:20     ` Arvind Sankar
2020-08-13 17:28     ` Thomas Gleixner
2020-08-13 17:37       ` Paul E. McKenney
2020-08-13 18:09         ` Arvind Sankar
2020-08-13 18:20           ` Paul E. McKenney
2020-08-20 10:44           ` Thomas Gleixner
2020-08-20 13:06             ` Arvind Sankar
2020-08-21  0:37               ` Thomas Gleixner
2020-08-21 23:04                 ` Arvind Sankar
2020-08-21 23:16                   ` Nick Desaulniers
2020-08-21 23:25                     ` Arvind Sankar [this message]
2020-08-22  0:43                     ` Thomas Gleixner
2020-08-22  3:55                       ` Arvind Sankar
2020-08-22  8:41                         ` Segher Boessenkool
2020-08-22  9:23                           ` Sedat Dilek
2020-08-22  9:51                             ` Sedat Dilek
2020-08-22 10:26                               ` Segher Boessenkool
2020-08-22 10:35                                 ` Arnd Bergmann
2020-08-22 18:17                               ` Miguel Ojeda
2020-08-22 21:08                                 ` Linus Torvalds
2020-08-22 23:10                                   ` Arvind Sankar
2020-08-23  0:10                                     ` Linus Torvalds
2020-08-23  1:16                                       ` Arvind Sankar
2020-08-23 21:25                                         ` [PATCH] x86/asm: Replace __force_order with memory clobber Arvind Sankar
2020-08-24 17:50                                           ` Nathan Chancellor
2020-08-24 19:13                                           ` Miguel Ojeda
2020-08-25 15:19                                             ` Arvind Sankar
2020-08-25 15:21                                               ` Sedat Dilek
2020-09-02 15:33                                           ` [PATCH v2] " Arvind Sankar
2020-09-02 15:58                                             ` David Laight
2020-09-02 16:14                                               ` Arvind Sankar
2020-09-02 16:08                                             ` Arvind Sankar
2020-09-02 20:26                                               ` David Laight
2020-09-02 17:16                                             ` Segher Boessenkool
2020-09-02 17:36                                               ` Arvind Sankar
2020-09-02 18:19                                             ` Miguel Ojeda
2020-09-02 18:24                                               ` Arvind Sankar
2020-09-02 23:21                                           ` [PATCH v3] " Arvind Sankar
2020-09-03  2:17                                             ` Kees Cook
2020-09-03  5:34                                             ` Miguel Ojeda
2020-09-30 20:50                                             ` Kees Cook
2020-10-01 10:12                                             ` [tip: x86/asm] x86/asm: Replace __force_order with a " tip-bot2 for Arvind Sankar
2020-10-13  9:30                                             ` tip-bot2 for Arvind Sankar
2020-08-22 21:17                                 ` [PATCH] x86: work around clang IAS bug referencing __force_order Arvind Sankar
2020-08-23 13:31                                   ` David Laight
2020-09-08 22:25                               ` Pavel Machek

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=20200821232505.GA66405@rani.riverdale.lan \
    --to=nivedita@alum.mit.edu \
    --cc=andrew.cooper3@citrix.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=keescook@chromium.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=ndesaulniers@google.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    --cc=zhenzhong.duan@oracle.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.