Re: linux-next: build failure after merge of the tip tree

Eder Zulian
2024-11-07T15:01:57Z

On Thu, Nov 07, 2024 at 06:22:31AM -0800, Boqun Feng wrote:
>
>
> On Thu, Nov 7, 2024, at 6:12 AM, Peter Zijlstra wrote:
> > On Fri, Nov 08, 2024 at 12:04:32AM +1100, Stephen Rothwell wrote:
> >> Hi Peter,
> >>
> >> On Thu, 7 Nov 2024 11:34:14 +0100 Peter Zijlstra <peterz@infradead.org> wrote:
> >> >
> >> > On Thu, Nov 07, 2024 at 06:24:11PM +1100, Stephen Rothwell wrote:
> >> > So I can't get RUST=y, even though make rustavailable is happy.
> >> >
> >> > make LLVM=-19 allmodconfig does not get me RUST=y
> >> >
> >> > I started out with tip/master, tried adding rust-next, then kbuild-next
> >> > gave up and tried next/master. Nada.
> >>
> >> Just on Linus' tree allmodconfig gives me:
> >>
> >> $ grep RUST .config
> >> CONFIG_RUSTC_VERSION=108100
> >> CONFIG_RUST_IS_AVAILABLE=y
> >> CONFIG_RUSTC_LLVM_VERSION=180108
> >> CONFIG_RUST=y
> >> CONFIG_RUSTC_VERSION_TEXT="rustc 1.81.0"
> >> CONFIG_HAVE_RUST=y
> >> CONFIG_RUST_FW_LOADER_ABSTRACTIONS=y
> >> CONFIG_BLK_DEV_RUST_NULL=m
> >> CONFIG_RADIO_TRUST=m
> >> CONFIG_HID_THRUSTMASTER=m
> >> CONFIG_THRUSTMASTER_FF=y
> >> CONFIG_TRUSTED_KEYS=m
> >> CONFIG_HAVE_TRUSTED_KEYS=y
> >> CONFIG_TRUSTED_KEYS_TPM=y
> >> CONFIG_TRUSTED_KEYS_TEE=y
> >> CONFIG_TRUSTED_KEYS_CAAM=y
> >> CONFIG_INTEGRITY_TRUSTED_KEYRING=y
> >> CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT=y
> >> CONFIG_SYSTEM_TRUSTED_KEYRING=y
> >> CONFIG_SYSTEM_TRUSTED_KEYS=""
> >> CONFIG_SECONDARY_TRUSTED_KEYRING=y
> >> CONFIG_SECONDARY_TRUSTED_KEYRING_SIGNED_BY_BUILTIN=y
> >> CONFIG_SAMPLES_RUST=y
> >> CONFIG_SAMPLE_RUST_MINIMAL=m
> >> CONFIG_SAMPLE_RUST_PRINT=m
> >> CONFIG_SAMPLE_RUST_HOSTPROGS=y
> >> CONFIG_RUST_DEBUG_ASSERTIONS=y
> >> CONFIG_RUST_OVERFLOW_CHECKS=y
> >> CONFIG_RUST_BUILD_ASSERT_ALLOW=y
> >>
> >> $ rustc --version
> >> rustc 1.81.0
> >
> > Yeah, I'm not sure what's going on. I occasionally get rust stuff, but
> > mostly when I try allyesconfig. Weirdness.
> >
> >> > Anyway, I think the above needs something like this:
> >> >
> >> > ---
> >> > diff --git a/rust/helpers/spinlock.c b/rust/helpers/spinlock.c
> >> > index b7b0945e8b3c..5804a6062eb1 100644
> >> > --- a/rust/helpers/spinlock.c
> >> > +++ b/rust/helpers/spinlock.c
> >> > @@ -5,11 +5,16 @@
> >> > void rust_helper___spin_lock_init(spinlock_t *lock, const char *name,
> >> > struct lock_class_key *key)
> >> > {
> >> > +#ifndef CONFIG_PREEMPT_RT
> >> > #ifdef CONFIG_DEBUG_SPINLOCK
> >> > __raw_spin_lock_init(spinlock_check(lock), name, key, LD_WAIT_CONFIG);
> >> > #else
> >> > spin_lock_init(lock);
> >> > #endif
> >> > +#else
> >> > + rt_mutex_base_init(&lock->lock);
> >> > + __rt_spin_lock_init(lock, name, key, false);
> >> > +#endif
> >> > }
> >> >
> >> > void rust_helper_spin_lock(spinlock_t *lock)
> >>
> >> I will try to remember to add that to the tip tree merge tomorrow.
> >
> > Boqun, could you test the above and make it happen?
> >
>
> FYI, Eder is already working on this:
>
> https://lore.kernel.org/rust-for-linux/20241106211215.2005909-1-ezulian@redhat.com/
>
> Eder, could you Cc locking for the next version?

Yes, sure.

By the way, I'm using linux-next/master here and I think I had to make
(MITIGATION_RETHUNK && KASAN) false at some point for x86_64 to get RUST=y.

$ grep -i '_rust\|preempt_rt\|debug_spin' .config | grep -v '#'
CONFIG_RUSTC_VERSION=108200
CONFIG_RUST_IS_AVAILABLE=y
CONFIG_RUSTC_LLVM_VERSION=170006
CONFIG_PREEMPT_RT=y
CONFIG_RUST=y
CONFIG_RUSTC_VERSION_TEXT="rustc 1.82.0 (f6e511eec 2024-10-15) (Fedora 1.82.0-1.fc39)"
CONFIG_HAVE_RUST=y
CONFIG_HAVE_CFI_ICALL_NORMALIZE_INTEGERS_RUSTC=y
CONFIG_DEBUG_SPINLOCK=y
CONFIG_RUST_OVERFLOW_CHECKS=y

>
> Regards,
> Boqun
>
> >> > > Without the revert CONFIG_PREEMPT_RT=y, after the revert it is not set
> >> > > and spinlock_check is only defined for !defined(CONFIG_PREEMPT_RT).
> >> >
> >> > Right, that moved PREEMPT_RT out of the preemption choice. Now I'm not
> >> > sure we want it =y for all{yes,mod}config. Is the below the right
> >> > incantation to avoid this?
> >> >
> >> > ---
> >> > diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt
> >> > index 7c1b29a3a491..54ea59ff8fbe 100644
> >> > --- a/kernel/Kconfig.preempt
> >> > +++ b/kernel/Kconfig.preempt
> >> > @@ -88,7 +88,7 @@ endchoice
> >> >
> >> > config PREEMPT_RT
> >> > bool "Fully Preemptible Kernel (Real-Time)"
> >> > - depends on EXPERT && ARCH_SUPPORTS_RT
> >> > + depends on EXPERT && ARCH_SUPPORTS_RT && !COMPILE_TEST
> >> > select PREEMPTION
> >> > help
> >> > This option turns the kernel into a real-time kernel by replacing
> >>
> >> Yeah, that will do it.
> >
> > OK, I'll write it up and stick that in tip/sched/core along with them
> > patches that's causing the grief :-)
> >
> > Attachments:
> > * signature.asc
>