Re: [PATCH v3] x86/hyperv: Mark hv_ghcb_terminate() as noreturn

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 17, 2023 at 01:05:46PM -0300, Guilherme G. Piccoli wrote:
> 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@xxxxxxxx>
> Link: https://lore.kernel.org/r/9698eff1-9680-4f0a-94de-590eaa923e94@xxxxxxxxxxxxxxxx/
> Cc: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> Cc: Michael Kelley <mikelley@xxxxxxxxxxxxx>
> Signed-off-by: Guilherme G. Piccoli <gpiccoli@xxxxxxxxxx>

Looks good to me.  I've got some other noreturn fixes pending, so I can
add this patch to the pile unless somebody else wants to take it.

-- 
Josh



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux