Skip to contentSkip to conversation

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

DISCUSSION Stephen Rothwell 5 participants 11 messages Nov 7, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the tip tree, today's linux-next build (x86_64 allmodconfig) failed like this:

In file included from rust/helpers/helpers.c:26:
rust/helpers/spinlock.c: In function 'rust_helper___spin_lock_init':
rust/helpers/spinlock.c:10:30: error: implicit declaration of function 'spinlock_check'; did you mean 'spin_lock_bh'? [-Wimplicit-function-declaration]

   10 |         __raw_spin_lock_init(spinlock_check(lock), name, key, LD_WAIT_CONFIG);
      |                              ^~~~~~~~~~~~~~
      |                              spin_lock_bh
rust/helpers/spinlock.c:10:30: error: passing argument 1 of '__raw_spin_lock_init' makes pointer from integer without a cast [-Wint-conversion]
   10 |         __raw_spin_lock_init(spinlock_check(lock), name, key, LD_WAIT_CONFIG);
      |                              ^~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              int

In file included from include/linux/wait.h:9,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/highmem.h:5,
from include/linux/bvec.h:10,
from include/linux/blk_types.h:10,
from include/linux/blkdev.h:9,
from include/linux/blk-mq.h:5,
from rust/helpers/blk.c:3,
from rust/helpers/helpers.c:10:
include/linux/spinlock.h:101:52: note: expected 'raw_spinlock_t *' {aka 'struct raw_spinlock *'} but argument is of type 'int'
101 | extern void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,

      |                                    ~~~~~~~~~~~~~~~~^~~~

Probably caused by commit

35772d627b55 ("sched: Enable PREEMPT_DYNAMIC for PREEMPT_RT")

at least reverting commit

dafc2d42c0a6 ("Merge branch into tip/master: 'sched/core'")

makes the build work again for me - so I have done that for today.

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).

Signature · 2 lines
Cheers,
Stephen Rothwell
maintainer
#1 lore raw
Quoted 28 lines · Stephen Rothwell

Hi all,

After merging the tip tree, today's linux-next build (x86_64 allmodconfig) failed like this:

In file included from rust/helpers/helpers.c:26:
rust/helpers/spinlock.c: In function 'rust_helper___spin_lock_init':
rust/helpers/spinlock.c:10:30: error: implicit declaration of function 'spinlock_check'; did you mean 'spin_lock_bh'? [-Wimplicit-function-declaration]

   10 |         __raw_spin_lock_init(spinlock_check(lock), name, key, LD_WAIT_CONFIG);
      |                              ^~~~~~~~~~~~~~
      |                              spin_lock_bh
rust/helpers/spinlock.c:10:30: error: passing argument 1 of '__raw_spin_lock_init' makes pointer from integer without a cast [-Wint-conversion]
   10 |         __raw_spin_lock_init(spinlock_check(lock), name, key, LD_WAIT_CONFIG);
      |                              ^~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              int

In file included from include/linux/wait.h:9,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/highmem.h:5,
from include/linux/bvec.h:10,
from include/linux/blk_types.h:10,
from include/linux/blkdev.h:9,
from include/linux/blk-mq.h:5,
from rust/helpers/blk.c:3,
from rust/helpers/helpers.c:10:
include/linux/spinlock.h:101:52: note: expected 'raw_spinlock_t *' {aka 'struct raw_spinlock *'} but argument is of type 'int'
101 | extern void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,

Quoted 2 lines
      |                                    ~~~~~~~~~~~~~~~~^~~~

Urgh, these commits have been exposed to the build robot for weeks :-(

Oh well, let met go figure out how to build this rust crap again and see what's what.

Thanks!

maintainer
#2 lore raw
In reply to Stephen Rothwell
Quoted 28 lines · Stephen Rothwell

Hi all,

After merging the tip tree, today's linux-next build (x86_64 allmodconfig) failed like this:

In file included from rust/helpers/helpers.c:26:
rust/helpers/spinlock.c: In function 'rust_helper___spin_lock_init':
rust/helpers/spinlock.c:10:30: error: implicit declaration of function 'spinlock_check'; did you mean 'spin_lock_bh'? [-Wimplicit-function-declaration]

   10 |         __raw_spin_lock_init(spinlock_check(lock), name, key, LD_WAIT_CONFIG);
      |                              ^~~~~~~~~~~~~~
      |                              spin_lock_bh
rust/helpers/spinlock.c:10:30: error: passing argument 1 of '__raw_spin_lock_init' makes pointer from integer without a cast [-Wint-conversion]
   10 |         __raw_spin_lock_init(spinlock_check(lock), name, key, LD_WAIT_CONFIG);
      |                              ^~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              int

In file included from include/linux/wait.h:9,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/highmem.h:5,
from include/linux/bvec.h:10,
from include/linux/blk_types.h:10,
from include/linux/blkdev.h:9,
from include/linux/blk-mq.h:5,
from rust/helpers/blk.c:3,
from rust/helpers/helpers.c:10:
include/linux/spinlock.h:101:52: note: expected 'raw_spinlock_t *' {aka 'struct raw_spinlock *'} but argument is of type 'int'
101 | extern void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,

Quoted 2 lines
      |                                    ~~~~~~~~~~~~~~~~^~~~

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.

Anyway, I think the above needs something like this:

---

rust/helpers/spinlock.c +5 -0
index b7b0945e8b3c..5804a6062eb1 100644
@@ -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)
Quoted 4 lines

Probably caused by commit

35772d627b55 ("sched: Enable PREEMPT_DYNAMIC for PREEMPT_RT")

Quoted 8 lines

at least reverting commit

dafc2d42c0a6 ("Merge branch into tip/master: 'sched/core'")

makes the build work again for me - so I have done that for today.

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?

---

kernel/Kconfig.preempt +1 -1
index 7c1b29a3a491..54ea59ff8fbe 100644
@@ -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
#3 lore raw

Hi Peter,

Quoted 8 lines · On Thu, 7 Nov 2024 11:34:14 +0100 Peter Zijlstra <[email protected]> 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
Quoted 14 lines

Anyway, I think the above needs something like this:

---

rust/helpers/spinlock.c +1 -0
index b7b0945e8b3c..5804a6062eb1 100644
@@ -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);

rust/helpers/spinlock.c line 20

Quoted 10 lines
rust/helpers/spinlock.c +4 -0
 #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.

Quoted 13 lines
Quoted 2 lines

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?

---

kernel/Kconfig.preempt +0 -0
index 7c1b29a3a491..54ea59ff8fbe 100644

kernel/Kconfig.preempt endchoice · line 94

Quoted 8 lines
kernel/Kconfig.preempt +1 -1
@@ -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.

Signature · 2 lines
Cheers,
Stephen Rothwell
maintainer
#4 lore raw
Quoted 45 lines · Stephen Rothwell

Hi Peter,

Quoted 8 lines · On Thu, 7 Nov 2024 11:34:14 +0100 Peter Zijlstra <[email protected]> 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
Quoted 2 lines
$ 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.

Quoted 23 lines
Quoted 23 lines

Anyway, I think the above needs something like this:

---

rust/helpers/spinlock.c +5 -0
index b7b0945e8b3c..5804a6062eb1 100644
@@ -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
 }
 
Quoted 3 lines

rust/helpers/spinlock.c line 20

Quoted 1 line
rust/helpers/spinlock.c +0 -0
 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?

Quoted 14 lines
Quoted 14 lines
Quoted 2 lines

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?

---

kernel/Kconfig.preempt +0 -0
index 7c1b29a3a491..54ea59ff8fbe 100644
@@ -88,7 +88,7 @@ endchoice
 
Quoted 9 lines

kernel/Kconfig.preempt endchoice · line 94

Quoted 7 lines
kernel/Kconfig.preempt +1 -1
 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 :-)

#5 lore raw
Quoted 75 lines · Peter Zijlstra
Quoted 45 lines · Stephen Rothwell

Hi Peter,

Quoted 8 lines · On Thu, 7 Nov 2024 11:34:14 +0100 Peter Zijlstra <[email protected]> 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
Quoted 2 lines
$ 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.

Quoted 23 lines
Quoted 23 lines

Anyway, I think the above needs something like this:

---

rust/helpers/spinlock.c +5 -0
index b7b0945e8b3c..5804a6062eb1 100644
@@ -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
 }
 
Quoted 6 lines
Quoted 3 lines

rust/helpers/spinlock.c line 20

Quoted 1 line
rust/helpers/spinlock.c +0 -0
 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/[email protected]/

Eder, could you Cc locking for the next version?

Regards,
Boqun

Quoted 29 lines
Quoted 14 lines
Quoted 14 lines
Quoted 2 lines

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?

---

kernel/Kconfig.preempt +0 -0
index 7c1b29a3a491..54ea59ff8fbe 100644
@@ -88,7 +88,7 @@ endchoice
 
Quoted 9 lines

kernel/Kconfig.preempt endchoice · line 94

Quoted 7 lines
kernel/Kconfig.preempt +1 -1
 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

#6 lore raw
Quoted 82 lines · Boqun Feng
Quoted 79 lines · Peter Zijlstra
Quoted 45 lines · Stephen Rothwell

Hi Peter,

Quoted 8 lines · On Thu, 7 Nov 2024 11:34:14 +0100 Peter Zijlstra <[email protected]> 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
Quoted 2 lines
$ 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.

Quoted 26 lines
Quoted 14 lines

Anyway, I think the above needs something like this:

---

rust/helpers/spinlock.c +1 -0
index b7b0945e8b3c..5804a6062eb1 100644
@@ -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);

rust/helpers/spinlock.c line 20

Quoted 10 lines
rust/helpers/spinlock.c +4 -0
 #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.

Quoted 8 lines
Quoted 2 lines

Boqun, could you test the above and make it happen?

FYI, Eder is already working on this:

https://lore.kernel.org/rust-for-linux/[email protected]/

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
Quoted 34 lines

Regards,
Boqun

Quoted 29 lines
Quoted 14 lines
Quoted 14 lines
Quoted 2 lines

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?

---

kernel/Kconfig.preempt +0 -0
index 7c1b29a3a491..54ea59ff8fbe 100644
@@ -88,7 +88,7 @@ endchoice
 
Quoted 9 lines

kernel/Kconfig.preempt endchoice · line 94

Quoted 7 lines
kernel/Kconfig.preempt +1 -1
 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

#7 lore raw
Quoted 3 lines · Eder Zulian

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.

Yeah, that would be this one:

    depends on !(MITIGATION_RETHUNK && KASAN) || RUSTC_VERSION >= 108300

i.e. it can be avoided with Rust 1.83, to be released in 3 weeks (2024-11-28).

Cheers,
Miguel

#8 lore raw
In reply to Peter Zijlstra
Quoted 2 lines · Peter Zijlstra

So I can't get RUST=y, even though make rustavailable is happy.

If you get the chance, please check in e.g. menuconfig the unmet depends on.

It could be e.g. the !CALL_PADDING one if you have an older rustc than Stephen.

Cheers,
Miguel

maintainer
#9 lore raw
Quoted 8 lines · Miguel Ojeda
Quoted 2 lines · Peter Zijlstra

So I can't get RUST=y, even though make rustavailable is happy.

If you get the chance, please check in e.g. menuconfig the unmet depends on.

It could be e.g. the !CALL_PADDING one if you have an older rustc than Stephen.

So menuconfig prints that as a giant line without wrapping, but instead forces me to press 'right-arrow' to scrol that.

So I can't readily read or even copy/paste it :-(

http://peterz.broke-it.net/sekrit/allmodconfig

Is what I get from: make LLVM=-19 allmodconfig

It has:

CONFIG_RUSTC_VERSION=108200

Which is what I installed today from debian/unstable, because the version from debian/testing was too old to satisfy make rustavailable.

#10 lore raw
Quoted 3 lines · Peter Zijlstra

So menuconfig prints that as a giant line without wrapping, but instead forces me to press 'right-arrow' to scrol that.

Yeah, it is bad, I also suffer from that :(

We should improve it.

Quoted 2 lines

Which is what I installed today from debian/unstable, because the version from debian/testing was too old to satisfy make rustavailable.

Something is amiss here -- Debian Testing should be fine (I test it regularly using the Docker image), since has 1.82 too:

https://packages.debian.org/trixie/rustc

I double-checked manually the debian:testing image:

    # apt show rustc
    Package: rustc
    Version: 1.82.0+dfsg1-2

Cheers,
Miguel