Paolo Bonzini
2011-May-18 09:05 UTC
[Xen-devel] [PATCH] retry instruction on svm emulation failure
From: pbonzini@redhat.com # HG changeset patch # User Paolo Bonzini <pbonzini@redhat.com> # Date 1305708694 -7200 # Node ID 8605c877b972c82a385915e38c0171952621ac3c # Parent e1452f8088dc667ca57cc1c5a63983a5131d1314 retry instruction on svm emulation failure Upon emulation failure, Xen injects a #GP into the guest on AMD machines. However, this kind of #GP does not happen in hardware. It is possible (and was observed in practice) that the failure is transient. It will go away naturally if the instruction is retried, because the guest will be executing other code and will not exit. Of course, this bears the possibility that the failure was the result of a hypervisor bug, and that the guest will hang as a result. But even in this case the outcome is not worse than getting a general-protection fault (except for extra CPU consumption), and it will be much easier to inspect the guest to see what''s going on. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> diff --git a/xen/arch/x86/hvm/svm/emulate.c b/xen/arch/x86/hvm/svm/emulate.c --- a/xen/arch/x86/hvm/svm/emulate.c +++ b/xen/arch/x86/hvm/svm/emulate.c @@ -200,7 +200,6 @@ int __get_instruction_length_from_list(s gdprintk(XENLOG_WARNING, "%s: Mismatch between expected and actual instruction bytes: " "eip = %lx\n", __func__, (unsigned long)vmcb->rip); - hvm_inject_exception(TRAP_gp_fault, 0, 0); return 0; done: _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2011-May-18 10:08 UTC
Re: [Xen-devel] [PATCH] retry instruction on svm emulation failure
On 18/05/2011 10:05, "Paolo Bonzini" <pbonzini@redhat.com> wrote:> retry instruction on svm emulation failure > > Upon emulation failure, Xen injects a #GP into the guest on AMD machines. > However, this kind of #GP does not happen in hardware. It is possible > (and was observed in practice) that the failure is transient. It will > go away naturally if the instruction is retried, because the guest will > be executing other code and will not exit.It begs the question why we were emulating the instruction in the first place. I''d like to see further explanation, with a concrete example, before applying this patch. Or get an Ack from an AMD maintainer. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Wei Huang
2011-May-18 21:08 UTC
Re: [Xen-devel] [PATCH] retry instruction on svm emulation failure
I don''t think we can take this patch before understanding what is going on. As Keir said, could you share a sample code or failure case? so we can debug it. Thanks, -Wei On 05/18/2011 05:08 AM, Keir Fraser wrote:> On 18/05/2011 10:05, "Paolo Bonzini"<pbonzini@redhat.com> wrote: > >> retry instruction on svm emulation failure >> >> Upon emulation failure, Xen injects a #GP into the guest on AMD machines. >> However, this kind of #GP does not happen in hardware. It is possible >> (and was observed in practice) that the failure is transient. It will >> go away naturally if the instruction is retried, because the guest will >> be executing other code and will not exit. > It begs the question why we were emulating the instruction in the first > place. I''d like to see further explanation, with a concrete example, before > applying this patch. Or get an Ack from an AMD maintainer. > > -- Keir > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel