From: George Dunlap Subject: [PATCH] Update cr3 in PAE mode when guest walk succeed but shadow walk fails Date: Fri, 16 Oct 2009 14:09:20 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=00151747360aa334f104760d1ac2 Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --00151747360aa334f104760d1ac2 Content-Type: text/plain; charset=ISO-8859-1 When running in PAE mode, Windows 7 (apparently) will occasionally switch cr3 with one of the L3 entries invalid, make it valid, and then expect the hardware to load the new value. (This behavior is explicitly not promised in the hardware manuals.) This leads to a situation where on a shadow fault, the guest walk succeeds but the shadow walk fails. The code assumes this can only happen when the domain is dying, and makes an ASSERT() to that effect. So currently, in debug mode, this will cause the host to crash; in non-debug mode, this will cause a page-fault loop. The attached patch solves the problem by calling update_cr3() in that path when the guest is in PAE mode, and only ASSERT()ing when the guest is not in PAE mode. The guest will get one spurious page fault, but subsequent accesses will succeed. Signed-off-by: George Dunlap --00151747360aa334f104760d1ac2 Content-Type: text/x-diff; charset=US-ASCII; name="20091016-update-cr3-on-shadow-failure.diff" Content-Disposition: attachment; filename="20091016-update-cr3-on-shadow-failure.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_g0uye37u0 ZGlmZiAtciA0Yjc4ZDU2NWI1MzUgeGVuL2FyY2gveDg2L21tL3NoYWRvdy9tdWx0aS5jCi0tLSBh L3hlbi9hcmNoL3g4Ni9tbS9zaGFkb3cvbXVsdGkuYwlXZWQgT2N0IDA3IDE0OjEyOjA5IDIwMDkg KzAxMDAKKysrIGIveGVuL2FyY2gveDg2L21tL3NoYWRvdy9tdWx0aS5jCVRodSBPY3QgMTUgMTU6 NDg6NTIgMjAwOSArMDEwMApAQCAtMzE5NCw3ICszMTk0LDE2IEBACiAgICAgICAgICAqIGFyZSBP SywgdGhpcyBjYW4gb25seSBoYXZlIGJlZW4gY2F1c2VkIGJ5IGEgZmFpbGVkCiAgICAgICAgICAq IHNoYWRvd19zZXRfbCplKCksIHdoaWNoIHdpbGwgaGF2ZSBjcmFzaGVkIHRoZSBndWVzdC4KICAg ICAgICAgICogR2V0IG91dCBvZiB0aGUgZmF1bHQgaGFuZGxlciBpbW1lZGlhdGVseS4gKi8KKyAg ICAgICAgLyogV2luZG93cyA3IGFwcGFyZW50bHkgcmVsaWVzIG9uIHRoZSBoYXJkd2FyZSB0byBk byBzb21ldGhpbmcKKyAgICAgICAgICogaXQgZXhwbGljaXRseSBoYXNuJ3QgcHJvbWlzZWQgdG8g ZG86IGxvYWQgbDMgdmFsdWVzIGFmdGVyCisgICAgICAgICAqIHRoZSBjcjMgaXMgbG9hZGVkLgor ICAgICAgICAgKiBJbiBhbnkgY2FzZSwgaW4gdGhlIFBBRSBjYXNlLCB0aGUgQVNTRVJUIGlzIG5v dCB0cnVlOyBpdCBjYW4KKyAgICAgICAgICogaGFwcGVuIGJlY2F1c2Ugb2YgYWN0aW9ucyB0aGUg Z3Vlc3QgaXMgdGFraW5nLiAqLworI2lmIEdVRVNUX1BBR0lOR19MRVZFTFMgPT0gMworICAgICAg ICB2LT5hcmNoLnBhZ2luZy5tb2RlLT51cGRhdGVfY3IzKHYsIDApOworI2Vsc2UKICAgICAgICAg QVNTRVJUKGQtPmlzX3NodXR0aW5nX2Rvd24pOworI2VuZGlmCiAgICAgICAgIHNoYWRvd191bmxv Y2soZCk7CiAgICAgICAgIHRyYWNlX3NoYWRvd19nZW4oVFJDX1NIQURPV19ET01GX0RZSU5HLCB2 YSk7CiAgICAgICAgIHJldHVybiAwOwo= --00151747360aa334f104760d1ac2 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --00151747360aa334f104760d1ac2--