x86: add noreturn in a few more places
PATCH v2 1/1 x86: add noreturn in a few more places
start_secondary(), do_double_fault(), play_dead(), and tboot_s3_error() never return, so would better be annotated anyway.
context_switch() and continue_running() are odd: We can't (unconditionally) add noreturn to their declarations, as Arm's variants do return. Put the attribute on x86'es definitions instead (the use of unreachable() in reset_stack_and_call_ind() allows the compiler to figure that out itself, but Eclair wants the annotation in addition).
Note that adding "noreturn" to do_double_fault() causes new violations of the same rule (2.1) at the two call sites in entry_from_{pv,xen}().
---
https://gitlab.com/xen-project/hardware/xen-staging/-/pipelines/2916849077
entry_from_pv() wants the annotation only when PV=n, yet once added gcc then warns about "return" being used in a "noreturn" function. Is there any other approach to address this besides adding #ifdef inside the function (i.e. replacing the !IS_ENABLED(CONFIG_PV) check that's there)? Perhaps need to deviate it?
---
v2: Drop entry_from_{pv,xen}() changes, for being controversial.
xen/arch/x86/domain.c +2 -2
@@ -2163,7 +2163,7 @@ static void __context_switch(void)per_cpu (curr_vcpu, cpu) = n; } -void context_switch (struct vcpu *prev,struct vcpu *next) +void noreturncontext_switch (struct vcpu *prev,struct vcpu *next) {unsigned int cpu =smp_processor_id ();struct cpu_info *info =get_cpu_info ();
@@ -2240,7 +2240,7 @@ void context_switch(struct vcpu *prev, sreset_stack_and_call_ind (nextd->arch.ctxt_switch->tail); } -void continue_running (struct vcpu *same) +void noreturncontinue_running (struct vcpu *same) {reset_stack_and_call_ind (same->domain->arch.ctxt_switch->tail); }
xen/arch/x86/include/asm/cpuidle.h +1 -1
@@ -26,7 +26,7 @@ static inline int mwait_idle_init(structint cpuidle_init_cpu (unsigned int cpu); void cf_check default_dead_idle(void); void cf_check acpi_dead_idle(void); -void play_dead (void ); +void noreturnplay_dead (void );void trace_exit_reason (u32 *irq_traced); void update_idle_stats(struct acpi_processor_power *power, struct acpi_processor_cx *cx,
xen/arch/x86/include/asm/tboot.h +1 -1
@@ -126,7 +126,7 @@ int tboot_in_measured_env(void);int tboot_protect_mem_regions (void ); int cf_check tboot_parse_dmar_table(acpi_table_handler dmar_handler);int tboot_s3_resume (void ); -void tboot_s3_error (int error); +void noreturntboot_s3_error (int error);int tboot_wake_ap (int apicid,unsigned long sipi_vec);#else static inline void tboot_probe (void ) {}
xen/arch/x86/smpboot.c +1 -1
@@ -326,7 +326,7 @@ static void set_cpu_sibling_map(unsigned } } -void asmlinkage start_secondary(void) +void asmlinkage noreturn start_secondary(void) {struct cpu_info *info =get_cpu_info ();unsigned int cpu =smp_processor_id ();
xen/arch/x86/traps.c +1 -1
@@ -1080,7 +1080,7 @@ const char *vector_name(unsigned int vecreturn (vec <ARRAY_SIZE (names) && names[vec][0 ]) ? names[vec] :"???" ; } -void asmlinkage do_double_fault(struct cpu_user_regs *regs) +void asmlinkage noreturn do_double_fault(struct cpu_user_regs *regs) {unsigned int cpu;struct extra_state state;