On Sun, Apr 24, 2022, Lei Wang wrote: > From: Chenyi Qiang <chenyi.qiang@xxxxxxxxx> > > Add PKRS caching into the standard register caching mechanism in order > to take advantage of the availability checks provided by regs_avail. > > This is because vcpu->arch.pkrs will be rarely acceesed by KVM, only in > the case of host userspace MSR reads and GVA->GPA translation in > following patches. It is unnecessary to keep it up-to-date at all times. > > It also should be noted that the potential benefits of this caching are > tenuous because the MSR read is not a hot path. it's nice-to-have so that > we don't hesitate to rip it out in the future if there's a strong reason > to drop the caching. The patch looks fine, but this needs to be moved to the end of the series. Definitely after "KVM: VMX: Expose PKS to guest", and maybe even after "KVM: VMX: Enable PKS for nested VM". If there's a bug with the caching logic, I want to be able to bisect to that. By implementing caching before any of the other PKS support, a bug in either the caching or the virtualization will bisect to the PKS virtualization