]> xenbits.xensource.com Git - people/aperard/xen-unstable.git/commit
x86/altcall: Switch to simpler scheme
authorAndrew Cooper <andrew.cooper3@citrix.com>
Sat, 19 Apr 2025 19:44:31 +0000 (20:44 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 23 Apr 2025 18:37:57 +0000 (19:37 +0100)
commitca29b7a70d1b0426295c62e93effdd96f10cbde7
tree85c2de85558142dad14c9ac9893a775b05aab121
parentd2fd5f0fcd5d65f357f40672a9db213076ba09a0
x86/altcall: Switch to simpler scheme

With all the infrastructure in place, switch from using ALTERNATIVE() to
simply populating .alt_call_sites.

Before, _apply_alternatives() would devirtualise in two passes; the first
being opportunistic, and the second (signified by the force parameter) sealing
any call with a still-NULL function pointer.

Now, all devirtualising is performed together, at the point in time of the
second pass previously.  The call to seal_endbr64() needs delaying until after
apply_alt_calls() is complete, or we have a narrow window with real indirect
branches and no ENDBR64 instructions.

Under the hood, the following changes are happening:

  Section                Old size   New size   Change (%)
  .alt_call_sites               0    0x00730   +0x0730
  .altinstructions        0x1350a    0x11fe0   -0x152a (-7%)
  .altinstr_replacement   0x015f2    0x00e35   -0x07bd (-23%)

The changes aren't quite equal because inlining is affected by the smaller
asm() block.  Nevertheless, the metadata is held in 1/3 of the space, and
there are no CALL instructions held in the replacement section any more.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/alternative.c
xen/arch/x86/include/asm/alternative-call.h