Skip to contentSkip to conversation

dovetail: Build warning about missing __noreturn annotation

DISCUSSION Florian Bezdeka 2 participants 4 messages Mar 5, 2024 – Mar 12, 2024 x86

lore
Share & tools
lore
#0 lore raw

Hi Philippe,

any idea why I get the following build warning on recent dovetail branches? I haven't checked that yet, but I think all branches >= 6.0 might be "affected".

The warning:

vmlinux.o: warning: objtool: arch_do_IRQ_pipelined+0x53f: __sysvec_reboot() is missing a __noreturn annotation

__sysvec_reboot calls stop_this_cpu() which is annotated with __noreturn. It's unclear to me why arch_do_IRQ_pipelined() is in the game here.

Best regards,
Florian

#1 lore raw
Quoted 6 lines · Florian Bezdeka

Hi Philippe,

any idea why I get the following build warning on recent dovetail branches? I haven't checked that yet, but I think all branches >= 6.0 might be "affected".

Quoted 8 lines

The warning:

vmlinux.o: warning: objtool: arch_do_IRQ_pipelined+0x53f: __sysvec_reboot() is missing a __noreturn annotation

__sysvec_reboot calls stop_this_cpu() which is annotated with __noreturn. It's unclear to me why arch_do_IRQ_pipelined() is in the game here.

Because the call to __sysvec_reboot() is expanded inline in arch_do_IRQ_pipelined() via run_sysvec_on_irqstack_cond -> call_on_irqstack_cond. This inner call is missing the annotation.

The following patch would do the trick, although in a fairly ugly way:

arch/x86/include/asm/idtentry.h +8 -0
index e4f0cc565fc66..fbeff7f100be8 100644
@@ -209,6 +209,14 @@ __visible noinstr void func(struct pt_regs *regs)			\
 									\
 __visible void __##func(struct pt_regs *regs)
 
+#define DEFINE_IDTENTRY_SYSVEC_PIPELINED_NORETURN(vector, func)		\
+__visible noinstr void func(struct pt_regs *regs)			\
+{									\
+	arch_pipeline_entry(regs, vector);				\
+}									\
+									\
+__visible __noreturn void __##func(struct pt_regs *regs)
+
 #define DEFINE_IDTENTRY_SYSVEC_SIMPLE_PIPELINED(vector, func)		\
 	DEFINE_IDTENTRY_SYSVEC_PIPELINED(vector, func)
 
arch/x86/kernel/smp.c +1 -1
index 3566d471d094e..d8d7e37d03a88 100644
@@ -133,7 +133,7 @@ static int smp_stop_nmi_callback(unsigned int val, struct pt_regs *regs)
 /*
  * this function calls the 'stop' function on all other CPUs in the system.
  */
-DEFINE_IDTENTRY_SYSVEC_PIPELINED(REBOOT_VECTOR, sysvec_reboot)
+DEFINE_IDTENTRY_SYSVEC_PIPELINED_NORETURN(REBOOT_VECTOR, sysvec_reboot)
 {
 	ack_APIC_irq();
 	cpu_emergency_disable_virtualization();
Signature · 1 line
Philippe.
#2 lore raw
Quoted 17 lines · Philippe Gerum
Quoted 6 lines · Florian Bezdeka

Hi Philippe,

any idea why I get the following build warning on recent dovetail branches? I haven't checked that yet, but I think all branches >= 6.0 might be "affected".

Quoted 8 lines

The warning:

vmlinux.o: warning: objtool: arch_do_IRQ_pipelined+0x53f: __sysvec_reboot() is missing a __noreturn annotation

__sysvec_reboot calls stop_this_cpu() which is annotated with __noreturn. It's unclear to me why arch_do_IRQ_pipelined() is in the game here.

Quoted 5 lines

Because the call to __sysvec_reboot() is expanded inline in arch_do_IRQ_pipelined() via run_sysvec_on_irqstack_cond -> call_on_irqstack_cond. This inner call is missing the annotation.

The following patch would do the trick, although in a fairly ugly way:

No better idea here... As it is already part of all relevant 6.x branches no follow up necessary.

Thanks Philippe for taking care!

Quoted 1 line

[snip]

#3 lore raw
Quoted 22 lines · Florian Bezdeka
Quoted 21 lines · Philippe Gerum
Quoted 6 lines · Florian Bezdeka

Hi Philippe,

any idea why I get the following build warning on recent dovetail branches? I haven't checked that yet, but I think all branches >= 6.0 might be "affected".

Quoted 8 lines

The warning:

vmlinux.o: warning: objtool: arch_do_IRQ_pipelined+0x53f: __sysvec_reboot() is missing a __noreturn annotation

__sysvec_reboot calls stop_this_cpu() which is annotated with __noreturn. It's unclear to me why arch_do_IRQ_pipelined() is in the game here.

Because the call to __sysvec_reboot() is expanded inline in arch_do_IRQ_pipelined() via run_sysvec_on_irqstack_cond -> call_on_irqstack_cond. This inner call is missing the annotation.

Quoted 7 lines
Quoted 1 line

The following patch would do the trick, although in a fairly ugly way:

No better idea here... As it is already part of all relevant 6.x branches no follow up necessary.

Thanks Philippe for taking care!

Np. I don't think there is any better way, so let's go with this.

Signature · 1 line
Philippe.