public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2] hexagon: Disable constant extender optimization for LLVM prior to 19.1.0
       [not found] <20241121-hexagon-disable-constant-expander-pass-v2-1-1a92e9afb0f4@kernel.org>
@ 2024-12-17 17:44 ` Nathan Chancellor
  2024-12-18  2:11   ` Brian Cain
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2024-12-17 17:44 UTC (permalink / raw)
  To: Brian Cain, Andrew Morton, Linus Torvalds
  Cc: linux-hexagon, patches, llvm, stable, linux-kernel

Hi Linus,

Could you apply this change [1] directly? Brian has reviewed it and I have
sent this patch twice plus another ping for application [2]. I would
like to stop applying this in our CI and some other people have hit it
as well.

[1]: https://lore.kernel.org/all/20241121-hexagon-disable-constant-expander-pass-v2-1-1a92e9afb0f4@kernel.org/
[2]: https://lore.kernel.org/all/20241001185848.GA562711@thelio-3990X/

Cheers,
Nathan

On Thu, Nov 21, 2024 at 11:22:18AM -0700, Nathan Chancellor wrote:
> The Hexagon-specific constant extender optimization in LLVM may crash on
> Linux kernel code [1], such as fs/bcache/btree_io.c after
> commit 32ed4a620c54 ("bcachefs: Btree path tracepoints") in 6.12:
> 
>   clang: llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp:745: bool (anonymous namespace)::HexagonConstExtenders::ExtRoot::operator<(const HCE::ExtRoot &) const: Assertion `ThisB->getParent() == OtherB->getParent()' failed.
>   Stack dump:
>   0.      Program arguments: clang --target=hexagon-linux-musl ... fs/bcachefs/btree_io.c
>   1.      <eof> parser at end of file
>   2.      Code generation
>   3.      Running pass 'Function Pass Manager' on module 'fs/bcachefs/btree_io.c'.
>   4.      Running pass 'Hexagon constant-extender optimization' on function '@__btree_node_lock_nopath'
> 
> Without assertions enabled, there is just a hang during compilation.
> 
> This has been resolved in LLVM main (20.0.0) [2] and backported to LLVM
> 19.1.0 but the kernel supports LLVM 13.0.1 and newer, so disable the
> constant expander optimization using the '-mllvm' option when using a
> toolchain that is not fixed.
> 
> Cc: stable@vger.kernel.org
> Link: https://github.com/llvm/llvm-project/issues/99714 [1]
> Link: https://github.com/llvm/llvm-project/commit/68df06a0b2998765cb0a41353fcf0919bbf57ddb [2]
> Link: https://github.com/llvm/llvm-project/commit/2ab8d93061581edad3501561722ebd5632d73892 [3]
> Reviewed-by: Brian Cain <bcain@quicinc.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Andrew, can you please take this for 6.13? Our CI continues to hit this.
> 
> Changes in v2:
> - Rebase on 6.12 to make sure it is still applicable
> - Name exact bcachefs commit that introduces crash now that it is
>   merged
> - Add 'Cc: stable' as this is now visible in a stable release
> - Carry forward Brian's reviewed-by
> - Link to v1: https://lore.kernel.org/r/20240819-hexagon-disable-constant-expander-pass-v1-1-36a734e9527d@kernel.org
> ---
>  arch/hexagon/Makefile | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/hexagon/Makefile b/arch/hexagon/Makefile
> index 92d005958dfb232d48a4ca843b46262a84a08eb4..ff172cbe5881a074f9d9430c37071992a4c8beac 100644
> --- a/arch/hexagon/Makefile
> +++ b/arch/hexagon/Makefile
> @@ -32,3 +32,9 @@ KBUILD_LDFLAGS += $(ldflags-y)
>  TIR_NAME := r19
>  KBUILD_CFLAGS += -ffixed-$(TIR_NAME) -DTHREADINFO_REG=$(TIR_NAME) -D__linux__
>  KBUILD_AFLAGS += -DTHREADINFO_REG=$(TIR_NAME)
> +
> +# Disable HexagonConstExtenders pass for LLVM versions prior to 19.1.0
> +# https://github.com/llvm/llvm-project/issues/99714
> +ifneq ($(call clang-min-version, 190100),y)
> +KBUILD_CFLAGS += -mllvm -hexagon-cext=false
> +endif
> 
> ---
> base-commit: adc218676eef25575469234709c2d87185ca223a
> change-id: 20240802-hexagon-disable-constant-expander-pass-8b6b61db6afc
> 
> Best regards,
> -- 
> Nathan Chancellor <nathan@kernel.org>
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v2] hexagon: Disable constant extender optimization for LLVM prior to 19.1.0
  2024-12-17 17:44 ` [PATCH v2] hexagon: Disable constant extender optimization for LLVM prior to 19.1.0 Nathan Chancellor
@ 2024-12-18  2:11   ` Brian Cain
  2024-12-18  4:19     ` Brian Cain
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Cain @ 2024-12-18  2:11 UTC (permalink / raw)
  To: Nathan Chancellor, Andrew Morton, Linus Torvalds
  Cc: linux-hexagon@vger.kernel.org, patches@lists.linux.dev,
	llvm@lists.linux.dev, stable@vger.kernel.org,
	linux-kernel@vger.kernel.org

> -----Original Message-----
> From: Nathan Chancellor <nathan@kernel.org>
> Sent: Tuesday, December 17, 2024 11:44 AM
> To: Brian Cain <bcain@quicinc.com>; Andrew Morton <akpm@linux-
> foundation.org>; Linus Torvalds <torvalds@linux-foundation.org>
> Cc: linux-hexagon@vger.kernel.org; patches@lists.linux.dev;
> llvm@lists.linux.dev; stable@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v2] hexagon: Disable constant extender optimization for
> LLVM prior to 19.1.0
> 
> 
> Hi Linus,
> 
> Could you apply this change [1] directly? Brian has reviewed it and I have
> sent this patch twice plus another ping for application [2]. I would
> like to stop applying this in our CI and some other people have hit it
> as well.

Nathan,

I'm sorry.  You should not have to send these changes to Linus. I should have carried it in my tree and proposed it to Linus.

I'll do that, if you don't mind.

> [1]: https://lore.kernel.org/all/20241121-hexagon-disable-constant-
> expander-pass-v2-1-1a92e9afb0f4@kernel.org/
> [2]: https://lore.kernel.org/all/20241001185848.GA562711@thelio-3990X/
> 
> Cheers,
> Nathan
> 
> On Thu, Nov 21, 2024 at 11:22:18AM -0700, Nathan Chancellor wrote:
> > The Hexagon-specific constant extender optimization in LLVM may crash on
> > Linux kernel code [1], such as fs/bcache/btree_io.c after
> > commit 32ed4a620c54 ("bcachefs: Btree path tracepoints") in 6.12:
> >
> >   clang: llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp:745: bool
> (anonymous namespace)::HexagonConstExtenders::ExtRoot::operator<(const
> HCE::ExtRoot &) const: Assertion `ThisB->getParent() == OtherB->getParent()'
> failed.
> >   Stack dump:
> >   0.      Program arguments: clang --target=hexagon-linux-musl ...
> fs/bcachefs/btree_io.c
> >   1.      <eof> parser at end of file
> >   2.      Code generation
> >   3.      Running pass 'Function Pass Manager' on module
> 'fs/bcachefs/btree_io.c'.
> >   4.      Running pass 'Hexagon constant-extender optimization' on function
> '@__btree_node_lock_nopath'
> >
> > Without assertions enabled, there is just a hang during compilation.
> >
> > This has been resolved in LLVM main (20.0.0) [2] and backported to LLVM
> > 19.1.0 but the kernel supports LLVM 13.0.1 and newer, so disable the
> > constant expander optimization using the '-mllvm' option when using a
> > toolchain that is not fixed.
> >
> > Cc: stable@vger.kernel.org
> > Link: https://github.com/llvm/llvm-project/issues/99714 [1]
> > Link: https://github.com/llvm/llvm-
> project/commit/68df06a0b2998765cb0a41353fcf0919bbf57ddb [2]
> > Link: https://github.com/llvm/llvm-
> project/commit/2ab8d93061581edad3501561722ebd5632d73892 [3]
> > Reviewed-by: Brian Cain <bcain@quicinc.com>
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> > Andrew, can you please take this for 6.13? Our CI continues to hit this.
> >
> > Changes in v2:
> > - Rebase on 6.12 to make sure it is still applicable
> > - Name exact bcachefs commit that introduces crash now that it is
> >   merged
> > - Add 'Cc: stable' as this is now visible in a stable release
> > - Carry forward Brian's reviewed-by
> > - Link to v1: https://lore.kernel.org/r/20240819-hexagon-disable-constant-
> expander-pass-v1-1-36a734e9527d@kernel.org
> > ---
> >  arch/hexagon/Makefile | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/arch/hexagon/Makefile b/arch/hexagon/Makefile
> > index
> 92d005958dfb232d48a4ca843b46262a84a08eb4..ff172cbe5881a074f9d94
> 30c37071992a4c8beac 100644
> > --- a/arch/hexagon/Makefile
> > +++ b/arch/hexagon/Makefile
> > @@ -32,3 +32,9 @@ KBUILD_LDFLAGS += $(ldflags-y)
> >  TIR_NAME := r19
> >  KBUILD_CFLAGS += -ffixed-$(TIR_NAME) -
> DTHREADINFO_REG=$(TIR_NAME) -D__linux__
> >  KBUILD_AFLAGS += -DTHREADINFO_REG=$(TIR_NAME)
> > +
> > +# Disable HexagonConstExtenders pass for LLVM versions prior to 19.1.0
> > +# https://github.com/llvm/llvm-project/issues/99714
> > +ifneq ($(call clang-min-version, 190100),y)
> > +KBUILD_CFLAGS += -mllvm -hexagon-cext=false
> > +endif
> >
> > ---
> > base-commit: adc218676eef25575469234709c2d87185ca223a
> > change-id: 20240802-hexagon-disable-constant-expander-pass-
> 8b6b61db6afc
> >
> > Best regards,
> > --
> > Nathan Chancellor <nathan@kernel.org>
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v2] hexagon: Disable constant extender optimization for LLVM prior to 19.1.0
  2024-12-18  2:11   ` Brian Cain
@ 2024-12-18  4:19     ` Brian Cain
  2024-12-18 18:23       ` Nathan Chancellor
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Cain @ 2024-12-18  4:19 UTC (permalink / raw)
  To: Brian Cain, Nathan Chancellor, Andrew Morton, Linus Torvalds
  Cc: linux-hexagon@vger.kernel.org, patches@lists.linux.dev,
	llvm@lists.linux.dev, stable@vger.kernel.org,
	linux-kernel@vger.kernel.org



> -----Original Message-----
> From: Brian Cain <bcain@quicinc.com>
> Sent: Tuesday, December 17, 2024 8:11 PM
> To: Nathan Chancellor <nathan@kernel.org>; Andrew Morton <akpm@linux-
> foundation.org>; Linus Torvalds <torvalds@linux-foundation.org>
> Cc: linux-hexagon@vger.kernel.org; patches@lists.linux.dev;
> llvm@lists.linux.dev; stable@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: RE: [PATCH v2] hexagon: Disable constant extender optimization for
> LLVM prior to 19.1.0
> > 
> > -----Original Message-----
> > From: Nathan Chancellor <nathan@kernel.org>
> > Sent: Tuesday, December 17, 2024 11:44 AM
> > To: Brian Cain <bcain@quicinc.com>; Andrew Morton <akpm@linux-
> > foundation.org>; Linus Torvalds <torvalds@linux-foundation.org>
> > Cc: linux-hexagon@vger.kernel.org; patches@lists.linux.dev;
> > llvm@lists.linux.dev; stable@vger.kernel.org; linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH v2] hexagon: Disable constant extender optimization for
> > LLVM prior to 19.1.0
> >
> >
> > Hi Linus,
> >
> > Could you apply this change [1] directly? Brian has reviewed it and I have
> > sent this patch twice plus another ping for application [2]. I would
> > like to stop applying this in our CI and some other people have hit it
> > as well.
> 
> Nathan,
> 
> I'm sorry.  You should not have to send these changes to Linus. I should have
> carried it in my tree and proposed it to Linus.
> 
> I'll do that, if you don't mind.

I see it's landed.  Sorry, all.  I'll resolve to do a better job here.

> > [1]: https://lore.kernel.org/all/20241121-hexagon-disable-constant-
> > expander-pass-v2-1-1a92e9afb0f4@kernel.org/
> > [2]: https://lore.kernel.org/all/20241001185848.GA562711@thelio-
> 3990X/
> >
> > Cheers,
> > Nathan
> >
> > On Thu, Nov 21, 2024 at 11:22:18AM -0700, Nathan Chancellor wrote:
> > > The Hexagon-specific constant extender optimization in LLVM may crash
> on
> > > Linux kernel code [1], such as fs/bcache/btree_io.c after
> > > commit 32ed4a620c54 ("bcachefs: Btree path tracepoints") in 6.12:
> > >
> > >   clang: llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp:745: bool
> > (anonymous
> namespace)::HexagonConstExtenders::ExtRoot::operator<(const
> > HCE::ExtRoot &) const: Assertion `ThisB->getParent() == OtherB-
> >getParent()'
> > failed.
> > >   Stack dump:
> > >   0.      Program arguments: clang --target=hexagon-linux-musl ...
> > fs/bcachefs/btree_io.c
> > >   1.      <eof> parser at end of file
> > >   2.      Code generation
> > >   3.      Running pass 'Function Pass Manager' on module
> > 'fs/bcachefs/btree_io.c'.
> > >   4.      Running pass 'Hexagon constant-extender optimization' on function
> > '@__btree_node_lock_nopath'
> > >
> > > Without assertions enabled, there is just a hang during compilation.
> > >
> > > This has been resolved in LLVM main (20.0.0) [2] and backported to LLVM
> > > 19.1.0 but the kernel supports LLVM 13.0.1 and newer, so disable the
> > > constant expander optimization using the '-mllvm' option when using a
> > > toolchain that is not fixed.
> > >
> > > Cc: stable@vger.kernel.org
> > > Link: https://github.com/llvm/llvm-project/issues/99714 [1]
> > > Link: https://github.com/llvm/llvm-
> > project/commit/68df06a0b2998765cb0a41353fcf0919bbf57ddb [2]
> > > Link: https://github.com/llvm/llvm-
> > project/commit/2ab8d93061581edad3501561722ebd5632d73892 [3]
> > > Reviewed-by: Brian Cain <bcain@quicinc.com>
> > > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > > ---
> > > Andrew, can you please take this for 6.13? Our CI continues to hit this.
> > >
> > > Changes in v2:
> > > - Rebase on 6.12 to make sure it is still applicable
> > > - Name exact bcachefs commit that introduces crash now that it is
> > >   merged
> > > - Add 'Cc: stable' as this is now visible in a stable release
> > > - Carry forward Brian's reviewed-by
> > > - Link to v1: https://lore.kernel.org/r/20240819-hexagon-disable-
> constant-
> > expander-pass-v1-1-36a734e9527d@kernel.org
> > > ---
> > >  arch/hexagon/Makefile | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > >
> > > diff --git a/arch/hexagon/Makefile b/arch/hexagon/Makefile
> > > index
> >
> 92d005958dfb232d48a4ca843b46262a84a08eb4..ff172cbe5881a074f9d94
> > 30c37071992a4c8beac 100644
> > > --- a/arch/hexagon/Makefile
> > > +++ b/arch/hexagon/Makefile
> > > @@ -32,3 +32,9 @@ KBUILD_LDFLAGS += $(ldflags-y)
> > >  TIR_NAME := r19
> > >  KBUILD_CFLAGS += -ffixed-$(TIR_NAME) -
> > DTHREADINFO_REG=$(TIR_NAME) -D__linux__
> > >  KBUILD_AFLAGS += -DTHREADINFO_REG=$(TIR_NAME)
> > > +
> > > +# Disable HexagonConstExtenders pass for LLVM versions prior to 19.1.0
> > > +# https://github.com/llvm/llvm-project/issues/99714
> > > +ifneq ($(call clang-min-version, 190100),y)
> > > +KBUILD_CFLAGS += -mllvm -hexagon-cext=false
> > > +endif
> > >
> > > ---
> > > base-commit: adc218676eef25575469234709c2d87185ca223a
> > > change-id: 20240802-hexagon-disable-constant-expander-pass-
> > 8b6b61db6afc
> > >
> > > Best regards,
> > > --
> > > Nathan Chancellor <nathan@kernel.org>
> > >


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] hexagon: Disable constant extender optimization for LLVM prior to 19.1.0
  2024-12-18  4:19     ` Brian Cain
@ 2024-12-18 18:23       ` Nathan Chancellor
  0 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2024-12-18 18:23 UTC (permalink / raw)
  To: Brian Cain
  Cc: Andrew Morton, Linus Torvalds, linux-hexagon@vger.kernel.org,
	patches@lists.linux.dev, llvm@lists.linux.dev,
	stable@vger.kernel.org, linux-kernel@vger.kernel.org

Hi Brian,

On Wed, Dec 18, 2024 at 04:19:23AM +0000, Brian Cain wrote:
> > I'm sorry.  You should not have to send these changes to Linus. I should have
> > carried it in my tree and proposed it to Linus.
> > 
> > I'll do that, if you don't mind.
> 
> I see it's landed.  Sorry, all.  I'll resolve to do a better job here.

As Nick said, no worries, these things happen. If going straight to
Linus gave the impression that you did something wrong or inadequate, I
apologize, as that was not the intention. I seem to recall even recently
him saying that he does not mind applying patches directly from the
mailing list and bypassing the maintainer/subsystem when it fixes an
issue (cannot find the exact message I am thinking of but [1] is also
good). Since this patch is small and limited in scope, I figured it was
not worth any more pings.

That said, consistent ownership of arch/hexagon patches would not be a
bad thing going forward :)

[1]: https://lore.kernel.org/CAHk-=wgQhFPvneqAVXjUZDq=ahpATdgfg6LZ9n07MSSUGkQWuA@mail.gmail.com/

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-12-18 18:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20241121-hexagon-disable-constant-expander-pass-v2-1-1a92e9afb0f4@kernel.org>
2024-12-17 17:44 ` [PATCH v2] hexagon: Disable constant extender optimization for LLVM prior to 19.1.0 Nathan Chancellor
2024-12-18  2:11   ` Brian Cain
2024-12-18  4:19     ` Brian Cain
2024-12-18 18:23       ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox