Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-12 Thread Russell King - ARM Linux admin
On Sat, Oct 12, 2019 at 12:15:42PM +0200, Stefan Wahren wrote: > Hi, > > Am 03.10.19 um 18:36 schrieb Will Deacon: > > On Wed, Oct 02, 2019 at 01:39:40PM -0700, Linus Torvalds wrote: > >> On Wed, Oct 2, 2019 at 5:56 AM Geert Uytterhoeven > >> wrote: > Then use the C preprocessor to force th

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-12 Thread Masahiro Yamada
On Sat, Oct 12, 2019 at 7:21 PM Stefan Wahren wrote: > > Hi, > > Am 03.10.19 um 18:36 schrieb Will Deacon: > > On Wed, Oct 02, 2019 at 01:39:40PM -0700, Linus Torvalds wrote: > >> On Wed, Oct 2, 2019 at 5:56 AM Geert Uytterhoeven > >> wrote: > Then use the C preprocessor to force the inlini

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-12 Thread Stefan Wahren
Hi, Am 03.10.19 um 18:36 schrieb Will Deacon: > On Wed, Oct 02, 2019 at 01:39:40PM -0700, Linus Torvalds wrote: >> On Wed, Oct 2, 2019 at 5:56 AM Geert Uytterhoeven >> wrote: Then use the C preprocessor to force the inlining. I'm sorry it's not as pretty as static inline functions. >>

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-04 Thread Geert Uytterhoeven
Hi Miguel, On Thu, Oct 3, 2019 at 10:21 PM Miguel Ojeda wrote: > On Thu, Oct 3, 2019 at 7:29 PM Linus Torvalds > wrote: > > On Thu, Oct 3, 2019 at 10:24 AM Masahiro Yamada > > wrote: > > > > > > I just want to annotate __always_inline for the case > > > "2. code that if not inlined is somehow n

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-03 Thread Miguel Ojeda
On Thu, Oct 3, 2019 at 7:29 PM Linus Torvalds wrote: > > On Thu, Oct 3, 2019 at 10:24 AM Masahiro Yamada > wrote: > > > > I just want to annotate __always_inline for the case > > "2. code that if not inlined is somehow not correct." > > Oh, I support that entirely - if only for documentation. > >

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-03 Thread Linus Torvalds
On Thu, Oct 3, 2019 at 10:24 AM Masahiro Yamada wrote: > > I just want to annotate __always_inline for the case > "2. code that if not inlined is somehow not correct." Oh, I support that entirely - if only for documentation. But I do *not* support the dismissal of the architecture maintainers co

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-03 Thread Masahiro Yamada
On Fri, Oct 4, 2019 at 2:02 AM Linus Torvalds wrote: > > On Wed, Oct 2, 2019 at 7:11 PM Masahiro Yamada > wrote: > > > > Macrofying the 'inline' is a horrid mistake that makes incorrect code work. > > It would eternally prevent people from writing portable, correct code. > > Please do not encoura

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-03 Thread Linus Torvalds
On Thu, Oct 3, 2019 at 10:01 AM Linus Torvalds wrote: > > If this is purely about the fact that x86 is different from other > architectures, then let's remove the "compiler can do stupid things" > option on x86 too. It was never clear that it was a huge advantage. Side note: what might be an actu

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-03 Thread Will Deacon
On Wed, Oct 02, 2019 at 01:39:40PM -0700, Linus Torvalds wrote: > On Wed, Oct 2, 2019 at 5:56 AM Geert Uytterhoeven > wrote: > > > > > > > > Then use the C preprocessor to force the inlining. I'm sorry it's not > > > as pretty as static inline functions. > > > > Which makes us lose the baby^H^H^

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-03 Thread Linus Torvalds
On Wed, Oct 2, 2019 at 7:11 PM Masahiro Yamada wrote: > > Macrofying the 'inline' is a horrid mistake that makes incorrect code work. > It would eternally prevent people from writing portable, correct code. > Please do not encourage to hide problems. Honestly, if the alternative to hiding problem

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-02 Thread Masahiro Yamada
On Thu, Oct 3, 2019 at 5:46 AM Linus Torvalds wrote: > > On Wed, Oct 2, 2019 at 5:56 AM Geert Uytterhoeven > wrote: > > > > > > > > Then use the C preprocessor to force the inlining. I'm sorry it's not > > > as pretty as static inline functions. > > > > Which makes us lose the baby^H^H^H^Htype

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-02 Thread Linus Torvalds
On Wed, Oct 2, 2019 at 5:56 AM Geert Uytterhoeven wrote: > > > > > Then use the C preprocessor to force the inlining. I'm sorry it's not > > as pretty as static inline functions. > > Which makes us lose the baby^H^H^H^Htype checking performed > on function parameters, requiring to add more ugly c

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-02 Thread Will Deacon
On Wed, Oct 02, 2019 at 02:55:50PM +0200, Geert Uytterhoeven wrote: > On Wed, Oct 2, 2019 at 6:33 AM Nick Desaulniers > wrote: > > On Tue, Oct 1, 2019 at 11:14 AM Russell King - ARM Linux admin > > wrote: > > > On Tue, Oct 01, 2019 at 11:00:11AM -0700, Nick Desaulniers wrote: > > > > On Tue, Oct

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-02 Thread Geert Uytterhoeven
Hi Nick, On Wed, Oct 2, 2019 at 6:33 AM Nick Desaulniers wrote: > On Tue, Oct 1, 2019 at 11:14 AM Russell King - ARM Linux admin > wrote: > > On Tue, Oct 01, 2019 at 11:00:11AM -0700, Nick Desaulniers wrote: > > > On Tue, Oct 1, 2019 at 10:55 AM Russell King - ARM Linux admin > > > wrote: > > >

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-01 Thread Russell King - ARM Linux admin
On Tue, Oct 01, 2019 at 02:32:54PM -0700, Nick Desaulniers wrote: > On Tue, Oct 1, 2019 at 2:26 PM Russell King - ARM Linux admin > wrote: > > > > On Tue, Oct 01, 2019 at 09:59:38PM +0100, Russell King - ARM Linux admin > > wrote: > > > On Tue, Oct 01, 2019 at 01:21:44PM -0700, Nick Desaulniers w

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-01 Thread Nick Desaulniers
On Tue, Oct 1, 2019 at 2:26 PM Russell King - ARM Linux admin wrote: > > On Tue, Oct 01, 2019 at 09:59:38PM +0100, Russell King - ARM Linux admin > wrote: > > On Tue, Oct 01, 2019 at 01:21:44PM -0700, Nick Desaulniers wrote: > > > On Tue, Oct 1, 2019 at 11:14 AM Russell King - ARM Linux admin > >

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-01 Thread Russell King - ARM Linux admin
On Tue, Oct 01, 2019 at 09:59:38PM +0100, Russell King - ARM Linux admin wrote: > On Tue, Oct 01, 2019 at 01:21:44PM -0700, Nick Desaulniers wrote: > > On Tue, Oct 1, 2019 at 11:14 AM Russell King - ARM Linux admin > > wrote: > > > > > > On Tue, Oct 01, 2019 at 11:00:11AM -0700, Nick Desaulniers w

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-01 Thread Nick Desaulniers
On Tue, Oct 1, 2019 at 2:06 PM Miguel Ojeda wrote: > > On Tue, Oct 1, 2019 at 10:53 PM Arnd Bergmann wrote: > > > > 1. is clearly the most common case, but there is also > > > > 4. Some compiler version (possibly long gone, possibly still current) > > makes bad inlining decisions that result in h

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-01 Thread Miguel Ojeda
On Tue, Oct 1, 2019 at 10:53 PM Arnd Bergmann wrote: > > 1. is clearly the most common case, but there is also > > 4. Some compiler version (possibly long gone, possibly still current) > makes bad inlining decisions that result in horrible but functionally > correct object code for a particular fu

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-01 Thread Russell King - ARM Linux admin
On Tue, Oct 01, 2019 at 01:21:44PM -0700, Nick Desaulniers wrote: > On Tue, Oct 1, 2019 at 11:14 AM Russell King - ARM Linux admin > wrote: > > > > On Tue, Oct 01, 2019 at 11:00:11AM -0700, Nick Desaulniers wrote: > > > On Tue, Oct 1, 2019 at 10:55 AM Russell King - ARM Linux admin > > > wrote: >

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-01 Thread Arnd Bergmann
On Tue, Oct 1, 2019 at 10:21 PM 'Nick Desaulniers' via Clang Built Linux wrote: > On Tue, Oct 1, 2019 at 11:14 AM Russell King - ARM Linux admin > wrote: > > > > On Tue, Oct 01, 2019 at 11:00:11AM -0700, Nick Desaulniers wrote: > > > On Tue, Oct 1, 2019 at 10:55 AM Russell King - ARM Linux admin

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-01 Thread Nick Desaulniers
On Tue, Oct 1, 2019 at 11:14 AM Russell King - ARM Linux admin wrote: > > On Tue, Oct 01, 2019 at 11:00:11AM -0700, Nick Desaulniers wrote: > > On Tue, Oct 1, 2019 at 10:55 AM Russell King - ARM Linux admin > > wrote: > > > > > > On Tue, Oct 01, 2019 at 10:44:43AM -0700, Nick Desaulniers wrote: >

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-01 Thread Russell King - ARM Linux admin
On Tue, Oct 01, 2019 at 11:00:11AM -0700, Nick Desaulniers wrote: > On Tue, Oct 1, 2019 at 10:55 AM Russell King - ARM Linux admin > wrote: > > > > On Tue, Oct 01, 2019 at 10:44:43AM -0700, Nick Desaulniers wrote: > > > I apologize; I don't mean to be difficult. I would just like to avoid > > > s

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-01 Thread Nick Desaulniers
On Tue, Oct 1, 2019 at 10:55 AM Russell King - ARM Linux admin wrote: > > On Tue, Oct 01, 2019 at 10:44:43AM -0700, Nick Desaulniers wrote: > > I apologize; I don't mean to be difficult. I would just like to avoid > > surprises when code written with the assumption that it will be > > inlined is

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-01 Thread Russell King - ARM Linux admin
On Tue, Oct 01, 2019 at 10:44:43AM -0700, Nick Desaulniers wrote: > I apologize; I don't mean to be difficult. I would just like to avoid > surprises when code written with the assumption that it will be > inlined is not. It sounds like we found one issue in arm32 and one in > arm64 related to ou

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-01 Thread Nick Desaulniers
On Tue, Oct 1, 2019 at 10:01 AM Will Deacon wrote: > > On Tue, Oct 01, 2019 at 09:32:25AM -0700, Nick Desaulniers wrote: > > On Tue, Oct 1, 2019 at 2:28 AM Will Deacon wrote: > > > On Mon, Sep 30, 2019 at 02:50:10PM -0700, Nick Desaulniers wrote: > > > > In this case, if there's a known codegen b

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-01 Thread Will Deacon
On Tue, Oct 01, 2019 at 09:32:25AM -0700, Nick Desaulniers wrote: > On Tue, Oct 1, 2019 at 2:28 AM Will Deacon wrote: > > On Mon, Sep 30, 2019 at 02:50:10PM -0700, Nick Desaulniers wrote: > > > In this case, if there's a known codegen bug in a particular compiler > > > or certain versions of it, I

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-01 Thread Nick Desaulniers
On Tue, Oct 1, 2019 at 2:28 AM Will Deacon wrote: > > Hi Nick, > > On Mon, Sep 30, 2019 at 02:50:10PM -0700, Nick Desaulniers wrote: > > So __attribute__((always_inline)) doesn't guarantee that code will be > > inlined. For instance in LLVM's inliner, it asks/answers "should I > > inline" and "ca

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-01 Thread Will Deacon
On Tue, Oct 01, 2019 at 06:39:34PM +0900, Masahiro Yamada wrote: > On Mon, Sep 30, 2019 at 9:18 PM Will Deacon wrote: > > I agree that the ARM code looks dodgy with > > that call to uaccess_save_and_enable(), but there are __asmeq macros > > in there to try to catch that, so it's still very fishy.

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-01 Thread Masahiro Yamada
Hi Will, On Mon, Sep 30, 2019 at 9:18 PM Will Deacon wrote: > > On Mon, Sep 30, 2019 at 09:05:11PM +0900, Masahiro Yamada wrote: > > On Mon, Sep 30, 2019 at 8:26 PM Will Deacon wrote: > > > On Fri, Sep 27, 2019 at 03:38:44PM -0700, Linus Torvalds wrote: > > > > Soem of that code is pretty subtle

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-10-01 Thread Will Deacon
Hi Nick, On Mon, Sep 30, 2019 at 02:50:10PM -0700, Nick Desaulniers wrote: > On Mon, Sep 30, 2019 at 5:18 AM Will Deacon wrote: > > On Mon, Sep 30, 2019 at 09:05:11PM +0900, Masahiro Yamada wrote: > > > On Mon, Sep 30, 2019 at 8:26 PM Will Deacon wrote: > > > > FWIW, we've run into issues with C

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-09-30 Thread Nick Desaulniers
On Mon, Sep 30, 2019 at 3:08 PM Miguel Ojeda wrote: > > On Mon, Sep 30, 2019 at 11:50 PM Nick Desaulniers > wrote: > > > > So __attribute__((always_inline)) doesn't guarantee that code will be > > inlined. [...] inline and __attribute__((always_inline)) > > are a heuristic laden mess and should

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-09-30 Thread Miguel Ojeda
On Mon, Sep 30, 2019 at 11:50 PM Nick Desaulniers wrote: > > So __attribute__((always_inline)) doesn't guarantee that code will be > inlined. [...] inline and __attribute__((always_inline)) > are a heuristic laden mess and should not be relied upon. Small note: in GCC, __attribute__((always_inli

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-09-30 Thread Nick Desaulniers
On Mon, Sep 30, 2019 at 5:18 AM Will Deacon wrote: > > On Mon, Sep 30, 2019 at 09:05:11PM +0900, Masahiro Yamada wrote: > > On Mon, Sep 30, 2019 at 8:26 PM Will Deacon wrote: > > > On Fri, Sep 27, 2019 at 03:38:44PM -0700, Linus Torvalds wrote: > > > > Soem of that code is pretty subtle. They hav

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-09-30 Thread Will Deacon
On Mon, Sep 30, 2019 at 09:05:11PM +0900, Masahiro Yamada wrote: > On Mon, Sep 30, 2019 at 8:26 PM Will Deacon wrote: > > On Fri, Sep 27, 2019 at 03:38:44PM -0700, Linus Torvalds wrote: > > > Soem of that code is pretty subtle. They have fixed register usage > > > (but the asm macros actually chec

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-09-30 Thread Masahiro Yamada
On Mon, Sep 30, 2019 at 8:26 PM Will Deacon wrote: > > On Fri, Sep 27, 2019 at 03:38:44PM -0700, Linus Torvalds wrote: > > On Fri, Sep 27, 2019 at 3:08 PM Nick Desaulniers > > wrote: > > > > > > So get_user() was passed a bad value/pointer from userspace? Do you > > > know which of the tree calls

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-09-30 Thread Will Deacon
On Fri, Sep 27, 2019 at 03:38:44PM -0700, Linus Torvalds wrote: > On Fri, Sep 27, 2019 at 3:08 PM Nick Desaulniers > wrote: > > > > So get_user() was passed a bad value/pointer from userspace? Do you > > know which of the tree calls to get_user() from sock_setsockopt() is > > failing? (It's not i

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-09-29 Thread Masahiro Yamada
Hi. On Fri, Sep 27, 2019 at 7:58 PM Nicolas Saenz Julienne wrote: > > On Fri, 2019-08-30 at 12:43 +0900, Masahiro Yamada wrote: > > Commit 9012d011660e ("compiler: allow all arches to enable > > CONFIG_OPTIMIZE_INLINING") allowed all architectures to enable > > this option. A couple of build erro

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-09-27 Thread Linus Torvalds
On Fri, Sep 27, 2019 at 3:08 PM Nick Desaulniers wrote: > > So get_user() was passed a bad value/pointer from userspace? Do you > know which of the tree calls to get_user() from sock_setsockopt() is > failing? (It's not immediately clear to me how this patch is at > fault, vs there just being a b

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-09-27 Thread Nick Desaulniers
On Fri, Sep 27, 2019 at 3:43 AM Nicolas Saenz Julienne wrote: > > On Fri, 2019-08-30 at 12:43 +0900, Masahiro Yamada wrote: > > Commit 9012d011660e ("compiler: allow all arches to enable > > CONFIG_OPTIMIZE_INLINING") allowed all architectures to enable > > this option. A couple of build errors we

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-09-27 Thread Charles Keepax
On Fri, Sep 27, 2019 at 12:43:33PM +0200, Nicolas Saenz Julienne wrote: > On Fri, 2019-08-30 at 12:43 +0900, Masahiro Yamada wrote: > > Commit 9012d011660e ("compiler: allow all arches to enable > > CONFIG_OPTIMIZE_INLINING") allowed all architectures to enable > > this option. A couple of build er

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-09-27 Thread Nicolas Saenz Julienne
On Fri, 2019-08-30 at 12:43 +0900, Masahiro Yamada wrote: > Commit 9012d011660e ("compiler: allow all arches to enable > CONFIG_OPTIMIZE_INLINING") allowed all architectures to enable > this option. A couple of build errors were reported by randconfig, > but all of them have been ironed out. > > T

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-09-27 Thread Nicolas Saenz Julienne
On Fri, 2019-08-30 at 12:43 +0900, Masahiro Yamada wrote: > Commit 9012d011660e ("compiler: allow all arches to enable > CONFIG_OPTIMIZE_INLINING") allowed all architectures to enable > this option. A couple of build errors were reported by randconfig, > but all of them have been ironed out. > > T

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-09-26 Thread Masahiro Yamada
Hi Geert, On Thu, Sep 26, 2019 at 6:26 PM Geert Uytterhoeven wrote: > > Hi Yamada-san, > > On Thu, Sep 26, 2019 at 11:03 AM Masahiro Yamada > wrote: > > On Thu, Sep 26, 2019 at 5:54 PM Geert Uytterhoeven > > wrote: > > > On Fri, Aug 30, 2019 at 5:44 AM Masahiro Yamada > > > wrote: > > > > Com

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-09-26 Thread Geert Uytterhoeven
Hi Yamada-san, On Thu, Sep 26, 2019 at 11:03 AM Masahiro Yamada wrote: > On Thu, Sep 26, 2019 at 5:54 PM Geert Uytterhoeven > wrote: > > On Fri, Aug 30, 2019 at 5:44 AM Masahiro Yamada > > wrote: > > > Commit 9012d011660e ("compiler: allow all arches to enable > > > CONFIG_OPTIMIZE_INLINING")

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-09-26 Thread Masahiro Yamada
Hi Geert, On Thu, Sep 26, 2019 at 5:54 PM Geert Uytterhoeven wrote: > > Hi Yamada-san, > > On Fri, Aug 30, 2019 at 5:44 AM Masahiro Yamada > wrote: > > Commit 9012d011660e ("compiler: allow all arches to enable > > CONFIG_OPTIMIZE_INLINING") allowed all architectures to enable > > this option. A

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-09-26 Thread Geert Uytterhoeven
Hi Yamada-san, On Fri, Aug 30, 2019 at 5:44 AM Masahiro Yamada wrote: > Commit 9012d011660e ("compiler: allow all arches to enable > CONFIG_OPTIMIZE_INLINING") allowed all architectures to enable > this option. A couple of build errors were reported by randconfig, > but all of them have been iron

Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly

2019-08-30 Thread Nick Desaulniers
On Thu, Aug 29, 2019 at 8:43 PM Masahiro Yamada wrote: > > Commit 9012d011660e ("compiler: allow all arches to enable > CONFIG_OPTIMIZE_INLINING") allowed all architectures to enable > this option. A couple of build errors were reported by randconfig, > but all of them have been ironed out. > > To