Subject: Re: linux-next: Tree for May 29 (kernel/locking/rtmutex_api.c)

From: Paolo Bonzini <[email-masked]>
Date: Fri, 30 May 2025 09:52:34 +0200

On 5/29/25 19:12, Randy Dunlap wrote:
> 
> 
> On 5/28/25 11:58 PM, Stephen Rothwell wrote:
>> Hi all,
>>
>> Changes since 20250528:
>>
> 
> on x86_64 or i386:
> 
> 
> In file included from ../include/uapi/linux/posix_types.h:5,
>                   from ../include/uapi/linux/types.h:14,
>                   from ../include/linux/types.h:6,
>                   from ../include/linux/kasan-checks.h:5,
>                   from ../include/asm-generic/rwonce.h:26,
>                   from ./arch/x86/include/generated/asm/rwonce.h:1,
>                   from ../include/linux/compiler.h:390,
>                   from ../include/linux/export.h:5,
>                   from ../include/linux/linkage.h:7,
>                   from ../include/linux/preempt.h:10,
>                   from ../include/linux/spinlock.h:56,
>                   from ../kernel/locking/rtmutex_api.c:5:
> ../include/linux/stddef.h:8:14: error: expected declaration specifiers or ‘...’ before ‘(’ token
>      8 | #define NULL ((void *)0)
>        |              ^
> ../include/linux/mutex.h:183:46: note: in expansion of macro ‘NULL’
>    183 |         _mutex_lock_killable(lock, subclass, NULL)
>        |                                              ^~~~
> ../kernel/locking/rtmutex_api.c:547:13: note: in expansion of macro ‘mutex_lock_killable_nested’
>    547 | int __sched mutex_lock_killable_nested(struct mutex *lock,
>        |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
> ../kernel/locking/rtmutex_api.c:552:19: error: ‘mutex_lock_killable_nested’ undeclared here (not in a function); did you mean ‘mutex_lock_io_nested’?
>    552 | EXPORT_SYMBOL_GPL(mutex_lock_killable_nested);
>        |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
> ../include/linux/export.h:76:23: note: in definition of macro ‘__EXPORT_SYMBOL’
>     76 |         extern typeof(sym) sym;                                 \
>        |                       ^~~
> ../include/linux/export.h:90:41: note: in expansion of macro ‘_EXPORT_SYMBOL’
>     90 | #define EXPORT_SYMBOL_GPL(sym)          _EXPORT_SYMBOL(sym, "GPL")
>        |                                         ^~~~~~~~~~~~~~
> ../kernel/locking/rtmutex_api.c:552:1: note: in expansion of macro ‘EXPORT_SYMBOL_GPL’
>    552 | EXPORT_SYMBOL_GPL(mutex_lock_killable_nested);
>        | ^~~~~~~~~~~~~~~~~
> ../include/linux/stddef.h:8:14: error: expected declaration specifiers or ‘...’ before ‘(’ token
>      8 | #define NULL ((void *)0)
>        |              ^
> ../include/linux/mutex.h:215:60: note: in expansion of macro ‘NULL’
>    215 | #define mutex_trylock(lock) _mutex_trylock_nest_lock(lock, NULL)
>        |                                                            ^~~~
> ../kernel/locking/rtmutex_api.c:596:13: note: in expansion of macro ‘mutex_trylock’
>    596 | int __sched mutex_trylock(struct mutex *lock)
>        |             ^~~~~~~~~~~~~
> ../kernel/locking/rtmutex_api.c:609:15: error: ‘mutex_trylock’ undeclared here (not in a function); did you mean ‘ww_mutex_trylock’?
>    609 | EXPORT_SYMBOL(mutex_trylock);
>        |               ^~~~~~~~~~~~~
> ../include/linux/export.h:76:23: note: in definition of macro ‘__EXPORT_SYMBOL’
>     76 |         extern typeof(sym) sym;                                 \
>        |                       ^~~
> ../include/linux/export.h:89:41: note: in expansion of macro ‘_EXPORT_SYMBOL’
>     89 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
>        |                                         ^~~~~~~~~~~~~~
> ../kernel/locking/rtmutex_api.c:609:1: note: in expansion of macro ‘EXPORT_SYMBOL’
>    609 | EXPORT_SYMBOL(mutex_trylock);
>        | ^~~~~~~~~~~~~
> 
> 
> This seems to be due to <linux/mutex.h> containing a #define for mutex_lock_killable_nested()
> when DEBUG_PAGE_ALLOC is set and another for when DEBUG_PAGE_ALLOC is not set.
> But then rtmutex_api.c has a function by that name also... (for the DEBUG_PAGE_ALLOC=y case,
> which is set in my failing randconfig file, which is attached).

Yep, the bad condition is CONFIG_DEBUG_PAGE_ALLOC=y + CONFIG_RT_MUTEXES=y.
Patch at https://lore.kernel.org/r/[email-masked].

Thanks for the report!

Paolo