Why exit on MSR_STAR and friends?

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

 



Hi, In the recent KVM forum, Marcelo Tosatti presented some KVM performance
improvements. One of them (page 17 of the presentation) was about the MSRs
used by SYSCALL: MSR_STAR, MSR_LSTAR, MSR_CSTAR (and also MSR_SYSCALL_MASK).

He said that "Guests have direct access to these MSRs", and this is why KVM
needs to restore their original host value when returning to user space
(they aren't used in the kernel, so there's no reason to restore them earlier).

I was suprised, then, to discover that KVM doesn't add these MSRs to the
MSR bitmap, so when the guest changes these MSR values, or even reads them,
we cause an exit - both on read and on write of these MSRs.

I was wondering why these exits are needed. 
I can maybe guess why an exit is needed on write - just to save the guest
value so we don't need to read it when going back to user space. Is this
a good optimization because we assume that the guest very rarely changes
these MSRs? Or is there another explanation as to why these exits are
needed?
But I can't even guess why an exit is needed on read...


If you're curious why I noticed these exits - I was running a nested KVM
(L0's guest L1 is KVM, that itself has a guest L2). Whenever L2 does something
that L1 needs to handle in user space (e.g., PIO), L1 does all these MSR
reads and writes, and we get exits for each of them - many of those exits
for each L2 PIO :(

Thanks,
Nadav Har'El.


-- 
Nadav Har'El                        |   Wednesday, Feb 16 2011, 12 Adar I 5771
nyh@xxxxxxxxxxxxxxxxxxx             |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |Support bacteria - they're the only
http://nadav.harel.org.il           |culture some people have!
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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