From: "Christoph Egger" Subject: [PATCH][SVM] fix guest hang Date: Tue, 20 Nov 2007 13:56:04 +0100 Message-ID: <200711201356.04574.Christoph.Egger@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary-00=_kltQHs2Y+s1p+cu" 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 Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org --Boundary-00=_kltQHs2Y+s1p+cu Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Keir! Attached patch fixes a boot hang we have seen with SLES 9.3 and FreeBSD HVM= =20 guests. Both are 32bit guests and run with a 64bit hypervisor. The patch does the following: 1) Cache current vcpu in svm_vmexit_do_hlt 2) Check for interrupt shadow in svm_vmexit_do_hlt and handle it like a pending interrupt The boot hang happens when the hlt is intercepted and the interrupt shadow field in vmcb is set, then the guest waits forever for the next timer=20 interrupt. Change 1) is a cleanup, 2) is the fix Signed-off-by: Christoph Egger =2D-=20 AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Gesch=E4ftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplement=E4r: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Gesch=E4ftsf=FChrer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy --Boundary-00=_kltQHs2Y+s1p+cu Content-Type: text/plain; charset=us-ascii; name=xen_svm.diff Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=xen_svm.diff diff -r d2935f9c217f xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Sat Nov 17 13:11:25 2007 +0000 +++ b/xen/arch/x86/hvm/svm/svm.c Tue Nov 20 15:51:20 2007 +0100 @@ -1925,20 +1925,22 @@ static void svm_vmexit_do_hlt(struct vmc static void svm_vmexit_do_hlt(struct vmcb_struct *vmcb, struct cpu_user_regs *regs) { - struct hvm_intack intack = hvm_vcpu_has_pending_irq(current); + struct vcpu *v = current; + struct hvm_intack intack = hvm_vcpu_has_pending_irq(v); + enum hvm_intblk intblk = svm_interrupt_blocked(v, intack); __update_guest_eip(regs, 1); /* Check for interrupt not handled or new interrupt. */ if ( vmcb->eventinj.fields.v || - ((intack.source != hvm_intsrc_none) && - !svm_interrupt_blocked(current, intack)) ) - { - HVMTRACE_1D(HLT, current, /*int pending=*/ 1); + (intblk == hvm_intblk_shadow) || /* very likely a STI shadow */ + ((intack.source != hvm_intsrc_none) && (!intblk)) ) + { + HVMTRACE_1D(HLT, v, /*int pending=*/ 1); return; } - HVMTRACE_1D(HLT, current, /*int pending=*/ 0); + HVMTRACE_1D(HLT, v, /*int pending=*/ 0); hvm_hlt(regs->eflags); } --Boundary-00=_kltQHs2Y+s1p+cu 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 --Boundary-00=_kltQHs2Y+s1p+cu--