Skip to contentSkip to conversation

rust/helpers/interrupt.c:17:9: warning: static function 'arch_local_save_flags' is used in an inline function with external linkage

PATCH kernel test robot 4 participants 5 messages Jul 13 – Jul 16 s390

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux.git rust-rcu
head:   dcecd5f6e71e2437c8abe333ee2426fbe63e6398
commit: 27e30521043c39ca18ea3e28f825f9c7bd30b580 [14/27] rust: Introduce interrupt module
config: s390-randconfig-002-20260713 (https://download.01.org/0day-ci/archive/20260713/[email protected]/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
rustc: rustc 1.96.0 (ac68faa20 2026-05-25)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260713/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from rust/helpers/helpers.c:68:

>> rust/helpers/interrupt.c:17:9: warning: static function 'arch_local_save_flags' is used in an inline function with external linkage [-Wstatic-in-inline]
      17 |         return irqs_disabled();
         |                ^
   include/linux/irqflags.h:256:3: note: expanded from macro 'irqs_disabled'
     256 |                 raw_local_save_flags(_flags);           \
         |                 ^
   include/linux/irqflags.h:184:11: note: expanded from macro 'raw_local_save_flags'
     184 |                 flags = arch_local_save_flags();        \
         |                         ^
   rust/helpers/interrupt.c:15:1: note: use 'static' to give inline function 'rust_helper_irqs_disabled' internal linkage
      15 | __rust_helper bool rust_helper_irqs_disabled(void)
         | ^
         | static 
   rust/helpers/helpers.c:38:23: note: expanded from macro '__rust_helper'
      38 | #define __rust_helper __always_inline
         |                       ^
   include/linux/compiler_attributes.h:55:41: note: expanded from macro '__always_inline'
      55 | #define __always_inline                 inline __attribute__((__always_inline__))
         |                                         ^

include/linux/compiler_types.h:235:16: note: expanded from macro 'inline'
235 | #define inline inline __gnu_inline __inline_maybe_unused notrace
| ^
arch/s390/include/asm/irqflags.h:46:48: note: 'arch_local_save_flags' declared here
46 | static arch_local_irq_attributes unsigned long arch_local_save_flags(void)
| ^
1 warning generated.
--
In file included from rust/helpers/helpers.c:68:

>> rust/helpers/interrupt.c:17:9: warning: static function 'arch_local_save_flags' is used in an inline function with external linkage [-Wstatic-in-inline]

17 | return irqs_disabled();
| ^
include/linux/irqflags.h:256:3: note: expanded from macro 'irqs_disabled'
256 | raw_local_save_flags(_flags); \
| ^
include/linux/irqflags.h:184:11: note: expanded from macro 'raw_local_save_flags'
184 | flags = arch_local_save_flags(); \
| ^
rust/helpers/interrupt.c:15:1: note: use 'static' to give inline function 'rust_helper_irqs_disabled' internal linkage 15 | __rust_helper bool rust_helper_irqs_disabled(void)
| ^
| static
rust/helpers/helpers.c:38:23: note: expanded from macro '__rust_helper'
38 | #define __rust_helper __always_inline
| ^
include/linux/compiler_attributes.h:55:41: note: expanded from macro '__always_inline'
55 | #define __always_inline inline __attribute__((__always_inline__))
| ^
include/linux/compiler_types.h:235:16: note: expanded from macro 'inline'
235 | #define inline inline __gnu_inline __inline_maybe_unused notrace
| ^
arch/s390/include/asm/irqflags.h:46:48: note: 'arch_local_save_flags' declared here
46 | static arch_local_irq_attributes unsigned long arch_local_save_flags(void)
| ^
1 warning generated.
warning: 1 warning emitted

vim +/arch_local_save_flags +17 rust/helpers/interrupt.c

    14	
    15	__rust_helper bool rust_helper_irqs_disabled(void)
    16	{
  > 17		return irqs_disabled();

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

#1 lore raw

[Cc s390]

Quoted 63 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux.git rust-rcu
head:   dcecd5f6e71e2437c8abe333ee2426fbe63e6398
commit: 27e30521043c39ca18ea3e28f825f9c7bd30b580 [14/27] rust: Introduce interrupt module
config: s390-randconfig-002-20260713 (https://download.01.org/0day-ci/archive/20260713/[email protected]/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
rustc: rustc 1.96.0 (ac68faa20 2026-05-25)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260713/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from rust/helpers/helpers.c:68:

Quoted 1 line
Quoted 1 line

rust/helpers/interrupt.c:17:9: warning: static function 'arch_local_save_flags' is used in an inline function with external linkage [-Wstatic-in-inline]

      17 |         return irqs_disabled();
         |                ^
   include/linux/irqflags.h:256:3: note: expanded from macro 'irqs_disabled'
     256 |                 raw_local_save_flags(_flags);           \
         |                 ^
   include/linux/irqflags.h:184:11: note: expanded from macro 'raw_local_save_flags'
     184 |                 flags = arch_local_save_flags();        \
         |                         ^
   rust/helpers/interrupt.c:15:1: note: use 'static' to give inline function 'rust_helper_irqs_disabled' internal linkage
      15 | __rust_helper bool rust_helper_irqs_disabled(void)
         | ^
         | static 
   rust/helpers/helpers.c:38:23: note: expanded from macro '__rust_helper'
      38 | #define __rust_helper __always_inline
         |                       ^
   include/linux/compiler_attributes.h:55:41: note: expanded from macro '__always_inline'
      55 | #define __always_inline                 inline __attribute__((__always_inline__))
         |                                         ^

include/linux/compiler_types.h:235:16: note: expanded from macro 'inline'
235 | #define inline inline __gnu_inline __inline_maybe_unused notrace
| ^
arch/s390/include/asm/irqflags.h:46:48: note: 'arch_local_save_flags' declared here
46 | static arch_local_irq_attributes unsigned long arch_local_save_flags(void)
| ^
1 warning generated.
--
In file included from rust/helpers/helpers.c:68:

Quoted 1 line
Quoted 1 line

rust/helpers/interrupt.c:17:9: warning: static function 'arch_local_save_flags' is used in an inline function with external linkage [-Wstatic-in-inline]

17 | return irqs_disabled();
| ^
include/linux/irqflags.h:256:3: note: expanded from macro 'irqs_disabled'
256 | raw_local_save_flags(_flags); \
| ^
include/linux/irqflags.h:184:11: note: expanded from macro 'raw_local_save_flags'
184 | flags = arch_local_save_flags(); \
| ^
rust/helpers/interrupt.c:15:1: note: use 'static' to give inline function 'rust_helper_irqs_disabled' internal linkage 15 | __rust_helper bool rust_helper_irqs_disabled(void)
| ^
| static
rust/helpers/helpers.c:38:23: note: expanded from macro '__rust_helper'
38 | #define __rust_helper __always_inline
| ^
include/linux/compiler_attributes.h:55:41: note: expanded from macro '__always_inline'
55 | #define __always_inline inline __attribute__((__always_inline__))
| ^

Quoted 9 lines

include/linux/compiler_types.h:235:16: note: expanded from macro 'inline' 235 | #define inline inline __gnu_inline __inline_maybe_unused notrace
| ^
arch/s390/include/asm/irqflags.h:46:48: note: 'arch_local_save_flags' declared here 46 | static arch_local_irq_attributes unsigned long arch_local_save_flags(void)
| ^
1 warning generated.
warning: 1 warning emitted

This seems not a Rust-only issue to me, basically you got the warning whenever you have an inline function calling irqs_disabled(). I'm a bit curious why 1b301f5f28ba ("s390/irqflags: do not instrument arch_local_irq_*() with KMSAN") wanted to add noinline when KMSAN=y, all you need is noinstr, no?

Regards,
Boqun

Quoted 11 lines

vim +/arch_local_save_flags +17 rust/helpers/interrupt.c

    14	
    15	__rust_helper bool rust_helper_irqs_disabled(void)
    16	{
Quoted 1 line

17 return irqs_disabled();

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

#2 lore raw
Quoted 76 lines · Boqun Feng

[Cc s390]

Quoted 63 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux.git rust-rcu
head:   dcecd5f6e71e2437c8abe333ee2426fbe63e6398
commit: 27e30521043c39ca18ea3e28f825f9c7bd30b580 [14/27] rust: Introduce interrupt module
config: s390-randconfig-002-20260713 (https://download.01.org/0day-ci/archive/20260713/[email protected]/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
rustc: rustc 1.96.0 (ac68faa20 2026-05-25)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260713/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from rust/helpers/helpers.c:68:

Quoted 1 line
Quoted 1 line

rust/helpers/interrupt.c:17:9: warning: static function 'arch_local_save_flags' is used in an inline function with external linkage [-Wstatic-in-inline]

17 | return irqs_disabled();
| ^
include/linux/irqflags.h:256:3: note: expanded from macro 'irqs_disabled'
256 | raw_local_save_flags(_flags); \
| ^
include/linux/irqflags.h:184:11: note: expanded from macro 'raw_local_save_flags'
184 | flags = arch_local_save_flags(); \
| ^
rust/helpers/interrupt.c:15:1: note: use 'static' to give inline function 'rust_helper_irqs_disabled' internal linkage
15 | __rust_helper bool rust_helper_irqs_disabled(void)
| ^
| static
rust/helpers/helpers.c:38:23: note: expanded from macro '__rust_helper'
38 | #define __rust_helper __always_inline
| ^
include/linux/compiler_attributes.h:55:41: note: expanded from macro '__always_inline'
55 | #define __always_inline inline __attribute__((__always_inline__))
| ^
include/linux/compiler_types.h:235:16: note: expanded from macro 'inline'
235 | #define inline inline __gnu_inline __inline_maybe_unused notrace
| ^
arch/s390/include/asm/irqflags.h:46:48: note: 'arch_local_save_flags' declared here
46 | static arch_local_irq_attributes unsigned long arch_local_save_flags(void)
| ^
1 warning generated.
--
In file included from rust/helpers/helpers.c:68:

Quoted 1 line
Quoted 1 line

rust/helpers/interrupt.c:17:9: warning: static function 'arch_local_save_flags' is used in an inline function with external linkage [-Wstatic-in-inline]

17 | return irqs_disabled();
| ^
include/linux/irqflags.h:256:3: note: expanded from macro 'irqs_disabled'
256 | raw_local_save_flags(_flags); \
| ^
include/linux/irqflags.h:184:11: note: expanded from macro 'raw_local_save_flags'
184 | flags = arch_local_save_flags(); \
| ^
rust/helpers/interrupt.c:15:1: note: use 'static' to give inline function 'rust_helper_irqs_disabled' internal linkage 15 | __rust_helper bool rust_helper_irqs_disabled(void)
| ^
| static
rust/helpers/helpers.c:38:23: note: expanded from macro '__rust_helper'
38 | #define __rust_helper __always_inline
| ^
include/linux/compiler_attributes.h:55:41: note: expanded from macro '__always_inline'
55 | #define __always_inline inline __attribute__((__always_inline__))
| ^

Quoted 9 lines

include/linux/compiler_types.h:235:16: note: expanded from macro 'inline' 235 | #define inline inline __gnu_inline __inline_maybe_unused notrace
| ^
arch/s390/include/asm/irqflags.h:46:48: note: 'arch_local_save_flags' declared here 46 | static arch_local_irq_attributes unsigned long arch_local_save_flags(void)
| ^
1 warning generated.
warning: 1 warning emitted

Quoted 5 lines

This seems not a Rust-only issue to me, basically you got the warning whenever you have an inline function calling irqs_disabled(). I'm a bit curious why 1b301f5f28ba ("s390/irqflags: do not instrument arch_local_irq_*() with KMSAN") wanted to add noinline when KMSAN=y, all you need is noinstr, no?

Hi,

Unfortunately if a function is inlined, then noinstr is not honored. The reason for using noinstr for these functions is interaction of instrumentation with lockdep, so inlining them into non-noinstr callers breaks KMSAN in a way that is described in the commit message.

Best regards,
Ilya

Quoted 15 lines

Regards,
Boqun

Quoted 11 lines

vim +/arch_local_save_flags +17 rust/helpers/interrupt.c

     14	
     15	__rust_helper bool rust_helper_irqs_disabled(void)
     16	{
Quoted 1 line

17 return irqs_disabled();

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

maintainer
#3 lore raw
In reply to Boqun Feng
Quoted 31 lines · Boqun Feng

[Cc s390]

Quoted 20 lines

In file included from rust/helpers/helpers.c:68:

Quoted 1 line
Quoted 1 line

rust/helpers/interrupt.c:17:9: warning: static function 'arch_local_save_flags' is used in an inline function with external linkage [-Wstatic-in-inline]

17 | return irqs_disabled();
| ^
include/linux/irqflags.h:256:3: note: expanded from macro 'irqs_disabled'
256 | raw_local_save_flags(_flags); \
| ^
include/linux/irqflags.h:184:11: note: expanded from macro 'raw_local_save_flags'
184 | flags = arch_local_save_flags(); \
| ^
rust/helpers/interrupt.c:15:1: note: use 'static' to give inline function 'rust_helper_irqs_disabled' internal linkage 15 | __rust_helper bool rust_helper_irqs_disabled(void)
| ^
| static
rust/helpers/helpers.c:38:23: note: expanded from macro '__rust_helper'
38 | #define __rust_helper __always_inline
| ^
include/linux/compiler_attributes.h:55:41: note: expanded from macro '__always_inline'
55 | #define __always_inline inline __attribute__((__always_inline__))
| ^

Quoted 9 lines

include/linux/compiler_types.h:235:16: note: expanded from macro 'inline' 235 | #define inline inline __gnu_inline __inline_maybe_unused notrace
| ^
arch/s390/include/asm/irqflags.h:46:48: note: 'arch_local_save_flags' declared here 46 | static arch_local_irq_attributes unsigned long arch_local_save_flags(void)
| ^
1 warning generated.
warning: 1 warning emitted

Quoted 5 lines

This seems not a Rust-only issue to me, basically you got the warning whenever you have an inline function calling irqs_disabled(). I'm a bit curious why 1b301f5f28ba ("s390/irqflags: do not instrument arch_local_irq_*() with KMSAN") wanted to add noinline when KMSAN=y, all you need is noinstr, no?

While the combination of __always_inline and noinstr _seems_ to work with clang, this looks just wrong to me. I guess we really would need a (single) out-of-line variant of the affected functions in question for KMSAN.

Ilya, since that was your commit, does that sound sane?

#4 lore raw
Quoted 38 lines · Heiko Carstens
Quoted 31 lines · Boqun Feng

[Cc s390]

Quoted 20 lines

In file included from rust/helpers/helpers.c:68:

Quoted 1 line
Quoted 1 line

rust/helpers/interrupt.c:17:9: warning: static function 'arch_local_save_flags' is used in an inline function with external linkage [-Wstatic-in-inline]

17 | return irqs_disabled();
| ^
include/linux/irqflags.h:256:3: note: expanded from macro 'irqs_disabled'
256 | raw_local_save_flags(_flags); \
| ^
include/linux/irqflags.h:184:11: note: expanded from macro 'raw_local_save_flags'
184 | flags = arch_local_save_flags(); \
| ^
rust/helpers/interrupt.c:15:1: note: use 'static' to give inline function 'rust_helper_irqs_disabled' internal linkage 15 | __rust_helper bool rust_helper_irqs_disabled(void)
| ^
| static
rust/helpers/helpers.c:38:23: note: expanded from macro '__rust_helper'
38 | #define __rust_helper __always_inline
| ^
include/linux/compiler_attributes.h:55:41: note: expanded from macro '__always_inline'
55 | #define __always_inline inline __attribute__((__always_inline__))
| ^

Quoted 9 lines

include/linux/compiler_types.h:235:16: note: expanded from macro 'inline' 235 | #define inline inline __gnu_inline __inline_maybe_unused notrace
| ^
arch/s390/include/asm/irqflags.h:46:48: note: 'arch_local_save_flags' declared here 46 | static arch_local_irq_attributes unsigned long arch_local_save_flags(void)
| ^
1 warning generated.
warning: 1 warning emitted

Quoted 5 lines

This seems not a Rust-only issue to me, basically you got the warning whenever you have an inline function calling irqs_disabled(). I'm a bit curious why 1b301f5f28ba ("s390/irqflags: do not instrument arch_local_irq_*() with KMSAN") wanted to add noinline when KMSAN=y, all you need is noinstr, no?

Quoted 6 lines

While the combination of __always_inline and noinstr _seems_ to work with clang, this looks just wrong to me. I guess we really would need a (single) out-of-line variant of the affected functions in question for KMSAN.

Ilya, since that was your commit, does that sound sane?

Hi, sure, making them out-of-line would make life easier. I will look into it.