Thanks a lot Nadav.This was really helpful. Siddhesh On Thu, Sep 13, 2012 at 3:49 AM, Nadav Har'El <nyh@xxxxxxxxxxxxxxxxxxx> wrote: > On Tue, Sep 11, 2012, siddhesh phadke wrote about "Multi-dimensional Paging in Nested virtualization": >> I read turtles project paper where they have explained how >> multi-dimensional page tables are built on L0. L2 is launched with >> empty EPT 0->2 and EPT 0->2 is built on-the-fly. >> I tried to find out how this is done in kvm code but i could not find >> where EPT 0->2 is built. > > Nested EPT is not yet included in the mainline KVM. The original nested EPT > code that we had written as part of the Turtles paper became obsolete when > much of KVM's MMU code has been rewritten. > > I have since rewritten the nested EPT code for the modern KVM. I sent > the second (latest) version of these patches to the KVM mailing list in > August, and you can find them in, for example, > http://comments.gmane.org/gmane.comp.emulators.kvm.devel/95395 > > These patches were not yet accepted into KVM. They have bugs in various > setups (which I have not yet found the time to fix, unfortunately), > and some known issues found by Avi Kivity on this mailing lest. > >> Does L1 handle ept violation first and then L0 updates its EPT0->2? >> How this is done? > > This is explained in the turtles paper, but here's the short story: > > L1 defines an EPT table for L2 which we call EPT12. L0 builds from this > an EPT02, with L1 addresses changed to L0. Now, when L2 runs and we get > an EPT violation, we exit to L0 (in nested vmx, any exit first gets to > L0). L0 checks if the translation is missing already in EPT12, and if it > isn't it emulates an exit into L1 - and inject the EPT violation into > L1. But if the translation wasn't missing in EPT12, then it's L0's > problem, and we just need to update EPT02. > >> Can anybody give me some pointers about where to look into the code? > > Please look at the patches above. Each patch is also documented. > > Nadav. > > -- > Nadav Har'El | Thursday, Sep 13 2012, 26 Elul 5772 > nyh@xxxxxxxxxxxxxxxxxxx |----------------------------------------- > Phone +972-523-790466, ICQ 13349191 |error compiling committee.c: too many > http://nadav.harel.org.il |arguments to function -- 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