Re: [PATCH] KVM: x86: Avoid double RDPKRU when loading host/guest PKRU

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

 



On Fri, 20 Dec 2024 17:16:47 -0800, Sean Christopherson wrote:
> Use the raw wrpkru() helper when loading the guest/host's PKRU on switch
> to/from guest context, as the write_pkru() wrapper incurs an unnecessary
> rdpkru().  In both paths, KVM is guaranteed to have performed RDPKRU since
> the last possible write, i.e. KVM has a fresh cache of the current value
> in hardware.
> 
> This effectively restores KVM's behavior to that of KVM prior to commit
> c806e88734b9 ("x86/pkeys: Provide *pkru() helpers"), which renamed the raw
> helper from __write_pkru() => wrpkru(), and turned __write_pkru() into a
> wrapper.  Commit 577ff465f5a6 ("x86/fpu: Only write PKRU if it is different
> from current") then added the extra RDPKRU to avoid an unnecessary WRPKRU,
> but completely missed that KVM already optimized away pointless writes.
> 
> [...]

Applied to kvm-x86 misc, thanks!

[1/1] KVM: x86: Avoid double RDPKRU when loading host/guest PKRU
      https://github.com/kvm-x86/linux/commit/4c20cd4cee92

--
https://github.com/kvm-x86/linux/tree/next




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux