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?
EFER is handled differently, but I see there is a separate
conversation on that.
EFER is a really special beast in VT.
This effort does seem worthwhile as it ensures userspace is able to
manage the MSRs it is requesting, and will remain that way in the
future.
I couldn't see why any of the passthrough MSRs are relevant to user
space, but I tend to agree that it makes everything more consistent.
Alex
Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879