On Thu, Aug 20, 2020 at 3:04 PM Alexander Graf <graf@xxxxxxxxxx> wrote: > > > > On 20.08.20 02:18, Aaron Lewis wrote: > > > > On Wed, Aug 19, 2020 at 8:26 AM Alexander Graf <graf@xxxxxxxxxx> wrote: > >> > >> > >> > >> On 18.08.20 23:15, Aaron Lewis wrote: > >>> > >>> SDM volume 3: 24.6.9 "MSR-Bitmap Address" and APM volume 2: 15.11 "MS > >>> intercepts" describe MSR permission bitmaps. Permission bitmaps are > >>> used to control whether an execution of rdmsr or wrmsr will cause a > >>> vm exit. For userspace tracked MSRs it is required they cause a vm > >>> exit, so the host is able to forward the MSR to userspace. This change > >>> adds vmx/svm support to ensure the permission bitmap is properly set to > >>> cause a vm_exit to the host when rdmsr or wrmsr is used by one of the > >>> userspace tracked MSRs. Also, to avoid repeatedly setting them, > >>> kvm_make_request() is used to coalesce these into a single call. > >>> > >>> Signed-off-by: Aaron Lewis <aaronlewis@xxxxxxxxxx> > >>> Reviewed-by: Oliver Upton <oupton@xxxxxxxxxx> > >> > >> This is incomplete, as it doesn't cover all of the x2apic registers. > >> There are also a few MSRs that IIRC are handled differently from this > >> logic, such as EFER. > >> > >> I'm really curious if this is worth the effort? I would be inclined to > >> say that MSRs that KVM has direct access for need special handling one > >> way or another. > >> > > > > Can you please elaborate on this? It was my understanding that the > > permission bitmap covers the x2apic registers. Also, I’m not sure how > > So x2apic MSR passthrough is configured specially: > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/kvm/vmx/vmx.c#n3796 > > and I think not handled by this patch? By happenstance only, I think, since there is also a call there to vmx_disable_intercept_for_msr() for the TPR when x2APIC is enabled.