Rust for Linux List
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Mukesh Kumar Chaurasiya <mkchauras@gmail.com>
Cc: FUJITA Tomonori <tomo@flapping.org>,
	linkmauve@linkmauve.fr, maddy@linux.ibm.com, mpe@ellerman.id.au,
	npiggin@gmail.com, chleroy@kernel.org, peterz@infradead.org,
	jpoimboe@kernel.org, jbaron@akamai.com, aliceryhl@google.com,
	rostedt@goodmis.org, ardb@kernel.org, ojeda@kernel.org,
	boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com,
	lossin@kernel.org, a.hindborg@kernel.org, tmgross@umich.edu,
	dakr@kernel.org, daniel.almeida@collabora.com, tamird@kernel.org,
	acourbot@nvidia.com, work@onurozkan.dev, ndesaulniers@google.com,
	morbo@google.com, justinstitt@google.com,
	fujita.tomonori@gmail.com, joelagnelf@nvidia.com,
	gregkh@linuxfoundation.org, prafulrai522@gmail.com,
	nsc@kernel.org, japo@linux.ibm.com, lina+kernel@asahilina.net,
	j@jannau.net, airlied@gmail.com, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	llvm@lists.linux.dev
Subject: Re: [PATCH V17 0/7] Rust Support for powerpc
Date: Mon, 17 Aug 2026 12:38:10 -0700	[thread overview]
Message-ID: <20260817193810.GA4060679@ax162> (raw)
In-Reply-To: <anMsbbRNiihKB-z7@li-1a3e774c-28e4-11b2-a85c-acc9f2883e29.ibm.com>

Hi Mukesh,

On Wed, Aug 05, 2026 at 05:59:14PM +0530, Mukesh Kumar Chaurasiya wrote:
> On Tue, Aug 04, 2026 at 10:40:35PM +0900, FUJITA Tomonori wrote:
> > On Tue, 4 Aug 2026 12:11:57 +0200
> > Link Mauve <linkmauve@linkmauve.fr> wrote:
> > > I just tested those again in linux-next, with the Wii support series on
> > > top, but now the kernel fails to build due to ARCH_WARN_ASM and
> > > ARCH_WARN_REACHABLE not being defined on PowerPC:
> > > ```
> > > error: no rules expected `ARCH_WARN_ASM`
> > >    --> /home/linkmauve/dev/linux/wii/rust/kernel/generated_arch_warn_asm.rs:1:28
> > >     |
> > >   1 | ::kernel::concat_literals!(ARCH_WARN_ASM("{file}", "{line}", "{flags}", "{size}"))
> > >     |                            ^^^^^^^^^^^^^ no rules expected this token in macro call
> > >     |
> > >    ::: ../rust/kernel/lib.rs:279:1
> > >     |
> > > 279 | macro_rules! concat_literals {
> > >     | ---------------------------- when calling this macro
> > >     |
> > >     = note: while trying to match sequence start
> > > 
> > > error: no rules expected `ARCH_WARN_REACHABLE`
> > >    --> /home/linkmauve/dev/linux/wii/rust/kernel/generated_arch_reachable_asm.rs:1:28
> > >     |
> > >   1 | ::kernel::concat_literals!(ARCH_WARN_REACHABLE)
> > >     |                            ^^^^^^^^^^^^^^^^^^^ no rules expected this token in macro call
> > >     |
> > >    ::: ../rust/kernel/lib.rs:279:1
> > >     |
> > > 279 | macro_rules! concat_literals {
> > >     | ---------------------------- when calling this macro
> > >     |
> > >     = note: while trying to match sequence start
> > > 
> > > error: aborting due to 2 previous errors
> > > ```
> > 
> > Looks like powerpc needs something like the followings:
> > 
> > diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h
> > index 0db48977c70c..8aba39e0cf26 100644
> > --- a/arch/powerpc/include/asm/bug.h
> > +++ b/arch/powerpc/include/asm/bug.h
> > @@ -32,34 +32,38 @@
> >  #endif /* verbose */
> >  
> >  #else /* !__ASSEMBLER__ */
> > -/* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and
> > -   sizeof(struct bug_entry), respectively */
> >  #ifdef CONFIG_DEBUG_BUGVERBOSE
> > -#define _EMIT_BUG_ENTRY				\
> > +#define _EMIT_BUG_ENTRY(file, line, flags)	\
> >  	".section __bug_table,\"aw\"\n"		\
> >  	"2:	.4byte 1b - .\n"		\
> > -	"	.4byte %0 - .\n"		\
> > -	"	.short %1, %2\n"		\
> > -	".org 2b+%3\n"				\
> > -	".previous\n"
> > +	"	.4byte " file " - .\n"		\
> > +	"	.short " line ", " flags "\n"
> >  #else
> > -#define _EMIT_BUG_ENTRY				\
> > +#define _EMIT_BUG_ENTRY(file, line, flags)	\
> >  	".section __bug_table,\"aw\"\n"		\
> >  	"2:	.4byte 1b - .\n"		\
> > -	"	.short %2\n"			\
> > -	".org 2b+%3\n"				\
> > -	".previous\n"
> > +	"	.short " flags "\n"
> >  #endif
> >  
> >  #define BUG_ENTRY(cond_str, insn, flags, ...)		\
> >  	__asm__ __volatile__(				\
> >  		"1:	" insn "\n"			\
> > -		_EMIT_BUG_ENTRY				\
> > +		_EMIT_BUG_ENTRY("%0", "%1", "%2")	\
> > +		".org 2b+%3\n"				\
> > +		".previous\n"				\
> >  		: : "i" (WARN_CONDITION_STR(cond_str) __FILE__), "i" (__LINE__),	\
> >  		  "i" (flags),				\
> >  		  "i" (sizeof(struct bug_entry)),	\
> >  		  ##__VA_ARGS__)
> >  
> > +#define ARCH_WARN_ASM(file, line, flags, size)		\
> > +		"1:	twi 31, 0, 0\n"			\
> > +		_EMIT_BUG_ENTRY(file, line, flags)	\
> > +		".org 2b+" size "\n"			\
> > +		".previous\n"
> > +
> > +#define ARCH_WARN_REACHABLE
> > +
> >  /*
> >   * BUG_ON() and WARN_ON() do their best to cooperate with compile-time
> >   * optimisations. However depending on the complexity of the condition
> 
> Yeah, This makes sense.
> 
> I'll work on this and send out a fix soon.

Did a fix for this ever materialize? I am still seeing the errors that
Link posted above in next-20260817.

-- 
Cheers,
Nathan

  reply	other threads:[~2026-08-17 19:38 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08  8:24 [PATCH V17 0/7] Rust Support for powerpc Mukesh Kumar Chaurasiya (IBM)
2026-07-08  8:24 ` [PATCH V17 1/7] rust: Fix "multiple candidates for rmeta dependency core" error Mukesh Kumar Chaurasiya (IBM)
2026-07-08  8:24 ` [PATCH V17 2/7] dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is disabled Mukesh Kumar Chaurasiya (IBM)
2026-07-11 12:56   ` Miguel Ojeda
2026-07-08  8:24 ` [PATCH V17 3/7] powerpc/jump_label: adjust inline asm to be consistent Mukesh Kumar Chaurasiya (IBM)
2026-07-08  8:24 ` [PATCH V17 4/7] rust/powerpc: Set min rustc version for powerpc Mukesh Kumar Chaurasiya (IBM)
2026-07-08  8:39   ` Link Mauve
2026-07-08 15:09     ` Mukesh Kumar Chaurasiya
2026-07-08  8:24 ` [PATCH V17 5/7] rust: Make __udivdi3() and __umoddi3() panic Mukesh Kumar Chaurasiya (IBM)
2026-07-08  8:24 ` [PATCH V17 6/7] rust: Add PowerPC support Mukesh Kumar Chaurasiya (IBM)
2026-07-08  8:24 ` [PATCH V17 7/7] powerpc: Enable Rust for ppc64le Mukesh Kumar Chaurasiya (IBM)
2026-08-03  6:57 ` [PATCH V17 0/7] Rust Support for powerpc Madhavan Srinivasan
2026-08-04 10:11   ` Link Mauve
2026-08-04 13:40     ` FUJITA Tomonori
2026-08-05 12:29       ` Mukesh Kumar Chaurasiya
2026-08-17 19:38         ` Nathan Chancellor [this message]
2026-08-05 12:56       ` Christophe Leroy (CS GROUP)
2026-08-06  7:53         ` FUJITA Tomonori
2026-08-04 20:22     ` Nathan Chancellor
2026-08-04 20:39       ` Link Mauve
2026-08-05 12:10       ` Mukesh Kumar Chaurasiya
2026-08-05 12:20         ` Mukesh Kumar Chaurasiya
2026-08-05 12:21         ` Link Mauve
2026-08-05 12:26           ` Mukesh Kumar Chaurasiya

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=20260817193810.GA4060679@ax162 \
    --to=nathan@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=ardb@kernel.org \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=chleroy@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=fujita.tomonori@gmail.com \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=j@jannau.net \
    --cc=japo@linux.ibm.com \
    --cc=jbaron@akamai.com \
    --cc=joelagnelf@nvidia.com \
    --cc=jpoimboe@kernel.org \
    --cc=justinstitt@google.com \
    --cc=lina+kernel@asahilina.net \
    --cc=linkmauve@linkmauve.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=llvm@lists.linux.dev \
    --cc=lossin@kernel.org \
    --cc=maddy@linux.ibm.com \
    --cc=mkchauras@gmail.com \
    --cc=morbo@google.com \
    --cc=mpe@ellerman.id.au \
    --cc=ndesaulniers@google.com \
    --cc=npiggin@gmail.com \
    --cc=nsc@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.org \
    --cc=prafulrai522@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=tomo@flapping.org \
    --cc=work@onurozkan.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox