mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bert Karwatzki <spasswolf@web.de>
To: vbabka@suse.cz
Cc: Bert Karwatzki <spasswolf@web.de>,
	Liam.Howlett@oracle.com, cl@gentwo.org, harry.yoo@oracle.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-rt-devel@lists.linux.dev, maple-tree@lists.infradead.org,
	rcu@vger.kernel.org, rientjes@google.com,
	roman.gushchin@linux.dev, surenb@google.com, urezki@gmail.com
Subject: commit 4ca04daa23305 fails to compile with PREEMPT_RT=y
Date: Thu, 28 Aug 2025 12:46:57 +0200	[thread overview]
Message-ID: <20250828104658.172649-1-spasswolf@web.de> (raw)
In-Reply-To: 20250827-slub-percpu-caches-v6-2-f0f775a3f73f@suse.cz

In noticed that linux next-20250828 fails to compile with the following error:

In file included from ./include/linux/spinlock.h:63,
                 from ./include/linux/mmzone.h:8,
                 from ./include/linux/gfp.h:7,
                 from ./include/linux/mm.h:7,
                 from mm/slub.c:13:
mm/slub.c: In function ‘__pcs_replace_empty_main’:
mm/slub.c:4727:64: error: ‘local_trylock_t’ {aka ‘__seg_gs struct spinlock’} has no member named ‘llock’; did you mean ‘lock’?
 4727 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                                                                ^~~~~
./include/linux/lockdep.h:392:61: note: in definition of macro ‘lockdep_assert_held’
  392 | #define lockdep_assert_held(l)                  do { (void)(l); } while (0)
      |                                                             ^
./include/linux/percpu-defs.h:245:9: note: in expansion of macro ‘__verify_pcpu_ptr’
  245 |         __verify_pcpu_ptr(ptr);                                         \
      |         ^~~~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:256:27: note: in expansion of macro ‘raw_cpu_ptr’
  256 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
      |                           ^~~~~~~~~~~
mm/slub.c:4727:29: note: in expansion of macro ‘this_cpu_ptr’
 4727 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                             ^~~~~~~~~~~~
mm/slub.c:4727:64: error: ‘local_trylock_t’ {aka ‘__seg_gs struct spinlock’} has no member named ‘llock’; did you mean ‘lock’?
 4727 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                                                                ^~~~~
./include/linux/lockdep.h:392:61: note: in definition of macro ‘lockdep_assert_held’
  392 | #define lockdep_assert_held(l)                  do { (void)(l); } while (0)
      |                                                             ^
./include/linux/percpu-defs.h:246:9: note: in expansion of macro ‘arch_raw_cpu_ptr’
  246 |         arch_raw_cpu_ptr(ptr);                                          \
      |         ^~~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:256:27: note: in expansion of macro ‘raw_cpu_ptr’
  256 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
      |                           ^~~~~~~~~~~
mm/slub.c:4727:29: note: in expansion of macro ‘this_cpu_ptr’
 4727 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                             ^~~~~~~~~~~~
mm/slub.c:4727:64: error: ‘local_trylock_t’ {aka ‘__seg_gs struct spinlock’} has no member named ‘llock’; did you mean ‘lock’?
 4727 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                                                                ^~~~~
./include/linux/lockdep.h:392:61: note: in definition of macro ‘lockdep_assert_held’
  392 | #define lockdep_assert_held(l)                  do { (void)(l); } while (0)
      |                                                             ^
./arch/x86/include/asm/percpu.h:68:10: note: in expansion of macro ‘TYPEOF_UNQUAL’
   68 |         (TYPEOF_UNQUAL(*(_ptr)) __force __kernel *)tcp_ptr__;           \
      |          ^~~~~~~~~~~~~
./include/linux/percpu-defs.h:246:9: note: in expansion of macro ‘arch_raw_cpu_ptr’
  246 |         arch_raw_cpu_ptr(ptr);                                          \
      |         ^~~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:256:27: note: in expansion of macro ‘raw_cpu_ptr’
  256 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
      |                           ^~~~~~~~~~~
mm/slub.c:4727:29: note: in expansion of macro ‘this_cpu_ptr’
 4727 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                             ^~~~~~~~~~~~
  CC      net/ipv4/route.o
mm/slub.c: In function ‘__pcs_install_empty_sheaf’:
  AS      lib/crypto/x86/sha1-ni-asm.o
  CC      drivers/acpi/ec.o
mm/slub.c:5604:64: error: ‘local_trylock_t’ {aka ‘__seg_gs struct spinlock’} has no member named ‘llock’; did you mean ‘lock’?
 5604 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                                                                ^~~~~
./include/linux/lockdep.h:392:61: note: in definition of macro ‘lockdep_assert_held’
  392 | #define lockdep_assert_held(l)                  do { (void)(l); } while (0)
      |                                                             ^
./include/linux/percpu-defs.h:245:9: note: in expansion of macro ‘__verify_pcpu_ptr’
  245 |         __verify_pcpu_ptr(ptr);                                         \
      |         ^~~~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:256:27: note: in expansion of macro ‘raw_cpu_ptr’
  256 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
      |                           ^~~~~~~~~~~
mm/slub.c:5604:29: note: in expansion of macro ‘this_cpu_ptr’
 5604 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                             ^~~~~~~~~~~~
mm/slub.c:5604:64: error: ‘local_trylock_t’ {aka ‘__seg_gs struct spinlock’} has no member named ‘llock’; did you mean ‘lock’?
 5604 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                                                                ^~~~~
./include/linux/lockdep.h:392:61: note: in definition of macro ‘lockdep_assert_held’
  392 | #define lockdep_assert_held(l)                  do { (void)(l); } while (0)
      |                                                             ^
./include/linux/percpu-defs.h:246:9: note: in expansion of macro ‘arch_raw_cpu_ptr’
  246 |         arch_raw_cpu_ptr(ptr);                                          \
      |         ^~~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:256:27: note: in expansion of macro ‘raw_cpu_ptr’
  256 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
      |                           ^~~~~~~~~~~
mm/slub.c:5604:29: note: in expansion of macro ‘this_cpu_ptr’
 5604 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                             ^~~~~~~~~~~~
mm/slub.c:5604:64: error: ‘local_trylock_t’ {aka ‘__seg_gs struct spinlock’} has no member named ‘llock’; did you mean ‘lock’?
 5604 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                                                                ^~~~~
./include/linux/lockdep.h:392:61: note: in definition of macro ‘lockdep_assert_held’
  392 | #define lockdep_assert_held(l)                  do { (void)(l); } while (0)
      |                                                             ^
./arch/x86/include/asm/percpu.h:68:10: note: in expansion of macro ‘TYPEOF_UNQUAL’
   68 |         (TYPEOF_UNQUAL(*(_ptr)) __force __kernel *)tcp_ptr__;           \
      |          ^~~~~~~~~~~~~
./include/linux/percpu-defs.h:246:9: note: in expansion of macro ‘arch_raw_cpu_ptr’
  246 |         arch_raw_cpu_ptr(ptr);                                          \
      |         ^~~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:256:27: note: in expansion of macro ‘raw_cpu_ptr’
  256 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
      |                           ^~~~~~~~~~~
mm/slub.c:5604:29: note: in expansion of macro ‘this_cpu_ptr’
 5604 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                             ^~~~~~~~~~~~
mm/slub.c: In function ‘__pcs_replace_full_main’:
mm/slub.c:5653:64: error: ‘local_trylock_t’ {aka ‘__seg_gs struct spinlock’} has no member named ‘llock’; did you mean ‘lock’?
 5653 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                                                                ^~~~~
./include/linux/lockdep.h:392:61: note: in definition of macro ‘lockdep_assert_held’
  392 | #define lockdep_assert_held(l)                  do { (void)(l); } while (0)
      |                                                             ^
./include/linux/percpu-defs.h:245:9: note: in expansion of macro ‘__verify_pcpu_ptr’
  245 |         __verify_pcpu_ptr(ptr);                                         \
      |         ^~~~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:256:27: note: in expansion of macro ‘raw_cpu_ptr’
  256 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
      |                           ^~~~~~~~~~~
mm/slub.c:5653:29: note: in expansion of macro ‘this_cpu_ptr’
 5653 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                             ^~~~~~~~~~~~
mm/slub.c:5653:64: error: ‘local_trylock_t’ {aka ‘__seg_gs struct spinlock’} has no member named ‘llock’; did you mean ‘lock’?
 5653 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                                                                ^~~~~
./include/linux/lockdep.h:392:61: note: in definition of macro ‘lockdep_assert_held’
  392 | #define lockdep_assert_held(l)                  do { (void)(l); } while (0)
      |                                                             ^
./include/linux/percpu-defs.h:246:9: note: in expansion of macro ‘arch_raw_cpu_ptr’
  246 |         arch_raw_cpu_ptr(ptr);                                          \
      |         ^~~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:256:27: note: in expansion of macro ‘raw_cpu_ptr’
  256 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
      |                           ^~~~~~~~~~~
mm/slub.c:5653:29: note: in expansion of macro ‘this_cpu_ptr’
 5653 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                             ^~~~~~~~~~~~
mm/slub.c:5653:64: error: ‘local_trylock_t’ {aka ‘__seg_gs struct spinlock’} has no member named ‘llock’; did you mean ‘lock’?
 5653 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                                                                ^~~~~
./include/linux/lockdep.h:392:61: note: in definition of macro ‘lockdep_assert_held’
  392 | #define lockdep_assert_held(l)                  do { (void)(l); } while (0)
      |                                                             ^
./arch/x86/include/asm/percpu.h:68:10: note: in expansion of macro ‘TYPEOF_UNQUAL’
   68 |         (TYPEOF_UNQUAL(*(_ptr)) __force __kernel *)tcp_ptr__;           \
      |          ^~~~~~~~~~~~~
./include/linux/percpu-defs.h:246:9: note: in expansion of macro ‘arch_raw_cpu_ptr’
  246 |         arch_raw_cpu_ptr(ptr);                                          \
      |         ^~~~~~~~~~~~~~~~
./include/linux/percpu-defs.h:256:27: note: in expansion of macro ‘raw_cpu_ptr’
  256 | #define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
      |                           ^~~~~~~~~~~
mm/slub.c:5653:29: note: in expansion of macro ‘this_cpu_ptr’
 5653 |         lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
      |                             ^~~~~~~~~~~~


The reason for this is that local_trylock_t is mapped to spinlock_t on 
PREEMPT_RT=y and spinlock_t has no member named llock.
If one changes the assertion like this the kernel compiles with PREEMPT_RT=y, too,
but I'm not sure if the assertion is correctly used here. If not one has to use
#ifdef PREEMPT_RT here I think:

diff --git a/mm/slub.c b/mm/slub.c
index 3ab91a1409f5..2138fecc8d37 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4724,7 +4724,7 @@ __pcs_replace_empty_main(struct kmem_cache *s, struct slub_percpu_sheaves *pcs,
 	struct slab_sheaf *full;
 	bool can_alloc;
 
-	lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
+	lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock));
 
 	if (pcs->spare && pcs->spare->size > 0) {
 		swap(pcs->main, pcs->spare);
@@ -5601,7 +5601,7 @@ static void __slab_free(struct kmem_cache *s, struct slab *slab,
 static void __pcs_install_empty_sheaf(struct kmem_cache *s,
 		struct slub_percpu_sheaves *pcs, struct slab_sheaf *empty)
 {
-	lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
+	lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock));
 
 	/* This is what we expect to find if nobody interrupted us. */
 	if (likely(!pcs->spare)) {
@@ -5650,7 +5650,7 @@ __pcs_replace_full_main(struct kmem_cache *s, struct slub_percpu_sheaves *pcs)
 	bool put_fail;
 
 restart:
-	lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock.llock));
+	lockdep_assert_held(this_cpu_ptr(&s->cpu_sheaves->lock));
 
 	put_fail = false;
 

Bert Karwatzki

                 reply	other threads:[~2025-08-28 10:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20250828104658.172649-1-spasswolf@web.de \
    --to=spasswolf@web.de \
    --cc=Liam.Howlett@oracle.com \
    --cc=cl@gentwo.org \
    --cc=harry.yoo@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=maple-tree@lists.infradead.org \
    --cc=rcu@vger.kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=surenb@google.com \
    --cc=urezki@gmail.com \
    --cc=vbabka@suse.cz \
    /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

all inboxes | Powered by JetHome®