Re: [PATCH] powerpc: workaround clang codegen bug in dcbz

2019-07-30 Thread Segher Boessenkool
On Tue, Jul 30, 2019 at 08:24:14PM +0200, Arnd Bergmann wrote: > On Tue, Jul 30, 2019 at 6:16 PM Segher Boessenkool > wrote: > > in_le32 and friends? Yeah, huh. If LLVM copies that to the stack as > > well, its (not byte reversing) read will be atomic just fine, so things > > will still work

Re: [PATCH] powerpc: workaround clang codegen bug in dcbz

2019-07-30 Thread Arnd Bergmann
On Tue, Jul 30, 2019 at 7:07 PM Segher Boessenkool wrote: > > On Tue, Jul 30, 2019 at 11:16:37AM -0500, Segher Boessenkool wrote: > > in_le32 and friends? Yeah, huh. If LLVM copies that to the stack as > > well, its (not byte reversing) read will be atomic just fine, so things > > will still

Re: [PATCH] powerpc: workaround clang codegen bug in dcbz

2019-07-30 Thread Arnd Bergmann
On Tue, Jul 30, 2019 at 6:16 PM Segher Boessenkool wrote: > > On Tue, Jul 30, 2019 at 04:30:29PM +0200, Arnd Bergmann wrote: > > On Tue, Jul 30, 2019 at 3:49 PM Segher Boessenkool > > wrote: > > > > > > On Tue, Jul 30, 2019 at 09:34:28AM +0200, Arnd Bergmann wrote: > > > > Upon a second look, I

Re: [PATCH] powerpc: workaround clang codegen bug in dcbz

2019-07-30 Thread Segher Boessenkool
On Tue, Jul 30, 2019 at 11:16:37AM -0500, Segher Boessenkool wrote: > in_le32 and friends? Yeah, huh. If LLVM copies that to the stack as > well, its (not byte reversing) read will be atomic just fine, so things > will still work correctly. > > The things defined with DEF_MMIO_IN_D (instead of

Re: [PATCH] powerpc: workaround clang codegen bug in dcbz

2019-07-30 Thread Segher Boessenkool
On Tue, Jul 30, 2019 at 04:30:29PM +0200, Arnd Bergmann wrote: > On Tue, Jul 30, 2019 at 3:49 PM Segher Boessenkool > wrote: > > > > On Tue, Jul 30, 2019 at 09:34:28AM +0200, Arnd Bergmann wrote: > > > Upon a second look, I think the issue is that the "Z" is an input argument > > > when it should

Re: [PATCH] powerpc: workaround clang codegen bug in dcbz

2019-07-30 Thread Arnd Bergmann
On Tue, Jul 30, 2019 at 3:49 PM Segher Boessenkool wrote: > > On Tue, Jul 30, 2019 at 09:34:28AM +0200, Arnd Bergmann wrote: > > Upon a second look, I think the issue is that the "Z" is an input argument > > when it should be an output. clang decides that it can make a copy of the > > input and

Re: [PATCH] powerpc: workaround clang codegen bug in dcbz

2019-07-30 Thread Segher Boessenkool
On Tue, Jul 30, 2019 at 09:34:28AM +0200, Arnd Bergmann wrote: > Upon a second look, I think the issue is that the "Z" is an input argument > when it should be an output. clang decides that it can make a copy of the > input and pass that into the inline asm. This is not the most efficient > way,

Re: [PATCH] powerpc: workaround clang codegen bug in dcbz

2019-07-30 Thread Michael Ellerman
Arnd Bergmann writes: > On Mon, Jul 29, 2019 at 11:52 PM Segher Boessenkool > wrote: >> On Mon, Jul 29, 2019 at 01:32:46PM -0700, Nathan Chancellor wrote: >> > For the record: >> > >> > https://godbolt.org/z/z57VU7 >> > >> > This seems consistent with what Michael found so I don't think a revert

Re: [PATCH] powerpc: workaround clang codegen bug in dcbz

2019-07-30 Thread Arnd Bergmann
On Mon, Jul 29, 2019 at 11:52 PM Segher Boessenkool wrote: > > On Mon, Jul 29, 2019 at 01:32:46PM -0700, Nathan Chancellor wrote: > > For the record: > > > > https://godbolt.org/z/z57VU7 > > > > This seems consistent with what Michael found so I don't think a revert > > is entirely unreasonable.

Re: [PATCH] powerpc: workaround clang codegen bug in dcbz

2019-07-29 Thread Christophe Leroy
Le 29/07/2019 à 22:32, Nathan Chancellor a écrit : On Mon, Jul 29, 2019 at 01:25:41PM -0700, Nick Desaulniers wrote: Commit 6c5875843b87 ("powerpc: slightly improve cache helpers") exposed what looks like a codegen bug in Clang's handling of `%y` output template with `Z` constraint. This is

Re: [PATCH] powerpc: workaround clang codegen bug in dcbz

2019-07-29 Thread Segher Boessenkool
On Mon, Jul 29, 2019 at 01:32:46PM -0700, Nathan Chancellor wrote: > For the record: > > https://godbolt.org/z/z57VU7 > > This seems consistent with what Michael found so I don't think a revert > is entirely unreasonable. Try this: https://godbolt.org/z/6_ZfVi This matters in non-trivial

Re: [PATCH] powerpc: workaround clang codegen bug in dcbz

2019-07-29 Thread Nick Desaulniers
On Mon, Jul 29, 2019 at 1:47 PM Nathan Chancellor wrote: > > On Mon, Jul 29, 2019 at 01:45:35PM -0700, Nick Desaulniers wrote: > > On Mon, Jul 29, 2019 at 1:32 PM Nathan Chancellor > > wrote: > > > > > > On Mon, Jul 29, 2019 at 01:25:41PM -0700, Nick Desaulniers wrote: > > > > But I'm not sure

Re: [PATCH] powerpc: workaround clang codegen bug in dcbz

2019-07-29 Thread Nathan Chancellor
On Mon, Jul 29, 2019 at 01:45:35PM -0700, Nick Desaulniers wrote: > On Mon, Jul 29, 2019 at 1:32 PM Nathan Chancellor > wrote: > > > > On Mon, Jul 29, 2019 at 01:25:41PM -0700, Nick Desaulniers wrote: > > > But I'm not sure how the inlined code generated would be affected. > > > > For the record:

Re: [PATCH] powerpc: workaround clang codegen bug in dcbz

2019-07-29 Thread Nathan Chancellor
On Mon, Jul 29, 2019 at 01:25:41PM -0700, Nick Desaulniers wrote: > Commit 6c5875843b87 ("powerpc: slightly improve cache helpers") exposed > what looks like a codegen bug in Clang's handling of `%y` output > template with `Z` constraint. This is resulting in panics during boot > for 32b powerpc