WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86 hvm: Simplify and consolidate logic f

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86 hvm: Simplify and consolidate logic for HLT emulation.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 06 May 2008 06:00:10 -0700
Delivery-date: Tue, 06 May 2008 06:00:13 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1210068300 -3600
# Node ID e6f20d5ed5fe7e24eab12977d812bd499794ba30
# Parent  777f294e3be81a4d0825e3a9b633a8d81c37f613
x86 hvm: Simplify and consolidate logic for HLT emulation.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c     |   10 +++++++++-
 xen/arch/x86/hvm/svm/svm.c |   14 +-------------
 xen/arch/x86/hvm/vmx/vmx.c |   18 +-----------------
 3 files changed, 11 insertions(+), 31 deletions(-)

diff -r 777f294e3be8 -r e6f20d5ed5fe xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Tue May 06 10:25:34 2008 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Tue May 06 11:05:00 2008 +0100
@@ -46,6 +46,7 @@
 #include <asm/hvm/vpt.h>
 #include <asm/hvm/support.h>
 #include <asm/hvm/cacheattr.h>
+#include <asm/hvm/trace.h>
 #include <public/sched.h>
 #include <public/hvm/ioreq.h>
 #include <public/version.h>
@@ -739,15 +740,22 @@ void hvm_send_assist_req(struct vcpu *v)
 
 void hvm_hlt(unsigned long rflags)
 {
+    struct vcpu *curr = current;
+
+    if ( hvm_event_pending(curr) )
+        return;
+
     /*
      * If we halt with interrupts disabled, that's a pretty sure sign that we
      * want to shut down. In a real processor, NMIs are the only way to break
      * out of this.
      */
     if ( unlikely(!(rflags & X86_EFLAGS_IF)) )
-        return hvm_vcpu_down(current);
+        return hvm_vcpu_down(curr);
 
     do_sched_op_compat(SCHEDOP_block, 0);
+
+    HVMTRACE_1D(HLT, curr, /* pending = */ vcpu_runnable(curr));
 }
 
 void hvm_triple_fault(void)
diff -r 777f294e3be8 -r e6f20d5ed5fe xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Tue May 06 10:25:34 2008 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Tue May 06 11:05:00 2008 +0100
@@ -1099,25 +1099,13 @@ static void svm_vmexit_do_hlt(struct vmc
 static void svm_vmexit_do_hlt(struct vmcb_struct *vmcb,
                               struct cpu_user_regs *regs)
 {
-    struct vcpu *curr = current;
-    struct hvm_intack intack = hvm_vcpu_has_pending_irq(curr);
     unsigned int inst_len;
 
-    inst_len = __get_instruction_length(curr, INSTR_HLT, NULL);
+    inst_len = __get_instruction_length(current, INSTR_HLT, NULL);
     if ( inst_len == 0 )
         return;
     __update_guest_eip(regs, inst_len);
 
-    /* Check for pending exception or new interrupt. */
-    if ( vmcb->eventinj.fields.v ||
-         ((intack.source != hvm_intsrc_none) &&
-          !hvm_interrupt_blocked(current, intack)) )
-    {
-        HVMTRACE_1D(HLT, curr, /*int pending=*/ 1);
-        return;
-    }
-
-    HVMTRACE_1D(HLT, curr, /*int pending=*/ 0);
     hvm_hlt(regs->eflags);
 }
 
diff -r 777f294e3be8 -r e6f20d5ed5fe xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Tue May 06 10:25:34 2008 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Tue May 06 11:05:00 2008 +0100
@@ -1857,22 +1857,6 @@ gp_fault:
     return X86EMUL_EXCEPTION;
 }
 
-static void vmx_do_hlt(struct cpu_user_regs *regs)
-{
-    unsigned long intr_info = __vmread(VM_ENTRY_INTR_INFO);
-    struct vcpu *curr = current;
-
-    /* Check for pending exception. */
-    if ( intr_info & INTR_INFO_VALID_MASK )
-    {
-        HVMTRACE_1D(HLT, curr, /*int pending=*/ 1);
-        return;
-    }
-
-    HVMTRACE_1D(HLT, curr, /*int pending=*/ 0);
-    hvm_hlt(regs->eflags);
-}
-
 static void vmx_do_extint(struct cpu_user_regs *regs)
 {
     unsigned int vector;
@@ -2187,7 +2171,7 @@ asmlinkage void vmx_vmexit_handler(struc
     case EXIT_REASON_HLT:
         inst_len = __get_instruction_length(); /* Safe: HLT */
         __update_guest_eip(inst_len);
-        vmx_do_hlt(regs);
+        hvm_hlt(regs->eflags);
         break;
     case EXIT_REASON_INVLPG:
     {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86 hvm: Simplify and consolidate logic for HLT emulation., Xen patchbot-unstable <=