x86/paravirt: Use %rip-relative addressing in hook calls
authorJan Beulich <jbeulich@suse.com>
Thu, 30 Sep 2021 12:40:38 +0000 (14:40 +0200)
committerBorislav Petkov <bp@suse.de>
Mon, 24 Jan 2022 19:21:19 +0000 (20:21 +0100)
commit2e1f8e55f9e054b4a49ffc06c7e33b5d4725f05e
tree68a4eb3778d6b1a4ae74b300c419ece6effe3018
parente783362eb54cd99b2cac8b3a9aeac942e6f6ac07
x86/paravirt: Use %rip-relative addressing in hook calls

While using a plain (constant) address works, its use needlessly invokes
a SIB addressing mode, making every call site one byte larger than
necessary:

  ff 14 25 98 89 42 82    call   *0xffffffff82428998

Instead of using an "i" constraint with address-of operator and a 'c'
operand modifier, simply use an ordinary "m" constraint, which the
64-bit compiler will translate to %rip-relative addressing:

  ff 15 62 fb d2 00       call   *0xd2fb62(%rip) # ffffffff82428998 <pv_ops+0x18>

This way the compiler is also told the truth about operand usage - the
memory location gets actually read, after all.

32-bit code generation is unaffected by the change.

  [ bp: Remove "we", add examples. ]

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/b8192e8a-13ef-6ac6-6364-8ba58992cd1d@suse.com
arch/x86/include/asm/paravirt_types.h