Skip to content

Commit 611d4c7

Browse files
guilhermepiccoliPeter Zijlstra
authored andcommitted
x86/hyperv: Mark hv_ghcb_terminate() as noreturn
Annotate the function prototype and definition as noreturn to prevent objtool warnings like: vmlinux.o: warning: objtool: hyperv_init+0x55c: unreachable instruction Also, as per Josh's suggestion, add it to the global_noreturns list. As a comparison, an objdump output without the annotation: [...] 1b63: mov $0x1,%esi 1b68: xor %edi,%edi 1b6a: callq ffffffff8102f680 <hv_ghcb_terminate> 1b6f: jmpq ffffffff82f217ec <hyperv_init+0x9c> # unreachable 1b74: cmpq $0xffffffffffffffff,-0x702a24(%rip) [...] Now, after adding the __noreturn to the function prototype: [...] 17df: callq ffffffff8102f6d0 <hv_ghcb_negotiate_protocol> 17e4: test %al,%al 17e6: je ffffffff82f21bb9 <hyperv_init+0x469> [...] <many insns> 1bb9: mov $0x1,%esi 1bbe: xor %edi,%edi 1bc0: callq ffffffff8102f680 <hv_ghcb_terminate> 1bc5: nopw %cs:0x0(%rax,%rax,1) # end of function Reported-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/32453a703dfcf0d007b473c9acbf70718222b74b.1681342859.git.jpoimboe@kernel.org
1 parent 6e36a56 commit 611d4c7

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

arch/x86/hyperv/ivm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ static enum es_result hv_ghcb_hv_call(struct ghcb *ghcb, u64 exit_code,
127127
return ES_OK;
128128
}
129129

130-
void hv_ghcb_terminate(unsigned int set, unsigned int reason)
130+
void __noreturn hv_ghcb_terminate(unsigned int set, unsigned int reason)
131131
{
132132
u64 val = GHCB_MSR_TERM_REQ;
133133

arch/x86/include/asm/mshyperv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ int hv_set_mem_host_visibility(unsigned long addr, int numpages, bool visible);
212212
void hv_ghcb_msr_write(u64 msr, u64 value);
213213
void hv_ghcb_msr_read(u64 msr, u64 *value);
214214
bool hv_ghcb_negotiate_protocol(void);
215-
void hv_ghcb_terminate(unsigned int set, unsigned int reason);
215+
void __noreturn hv_ghcb_terminate(unsigned int set, unsigned int reason);
216216
#else
217217
static inline void hv_ghcb_msr_write(u64 msr, u64 value) {}
218218
static inline void hv_ghcb_msr_read(u64 msr, u64 *value) {}

tools/objtool/check.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
213213
"ex_handler_msr_mce",
214214
"fortify_panic",
215215
"hlt_play_dead",
216+
"hv_ghcb_terminate",
216217
"kthread_complete_and_exit",
217218
"kthread_exit",
218219
"kunit_try_catch_throw",

0 commit comments

Comments
 (0)