• Marc Zyngier's avatar
    KVM: arm64: Drop trapping of PAuth instructions/keys · 814ad8f9
    Marc Zyngier authored
    We currently insist on disabling PAuth on vcpu_load(), and get to
    enable it on first guest use of an instruction or a key (ignoring
    the NV case for now).
    
    It isn't clear at all what this is trying to achieve: guests tend
    to use PAuth when available, and nothing forces you to expose it
    to the guest if you don't want to. This also isn't totally free:
    we take a full GPR save/restore between host and guest, only to
    write ten 64bit registers. The "value proposition" escapes me.
    
    So let's forget this stuff and enable PAuth eagerly if exposed to
    the guest. This results in much simpler code. Performance wise,
    that's not bad either (tested on M2 Pro running a fully automated
    Debian installer as the workload):
    
    - On a non-NV guest, I can see reduction of 0.24% in the number
      of cycles (measured with perf over 10 consecutive runs)
    
    - On a NV guest (L2), I see a 2% reduction in wall-clock time
      (measured with 'time', as M2 doesn't have a PMUv3 and NV
      doesn't support it either)
    
    So overall, a much reduced complexity and a (small) performance
    improvement.
    Reviewed-by: default avatarOliver Upton <oliver.upton@linux.dev>
    Link: https://lore.kernel.org/r/20240419102935.1935571-16-maz@kernel.orgSigned-off-by: default avatarMarc Zyngier <maz@kernel.org>
    814ad8f9
switch.c 10.6 KB