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] svm: increment RIP over PAUSE instruction

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] svm: increment RIP over PAUSE instruction when emulating it
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Aug 2010 07:00:27 -0700
Delivery-date: Wed, 18 Aug 2010 07:00:56 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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 1281684709 -3600
# Node ID 31d200e5b922f342bd6649ecbbab4ccbc190bf4b
# Parent  786b163da49bbf18857b5484cce5e5aed33528b3
svm: increment RIP over PAUSE instruction when emulating it

Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>
---
 xen/arch/x86/hvm/svm/emulate.c        |    4 +++-
 xen/arch/x86/hvm/svm/svm.c            |   23 +++++++++++++++++------
 xen/include/asm-x86/hvm/svm/emulate.h |    1 +
 3 files changed, 21 insertions(+), 7 deletions(-)

diff -r 786b163da49b -r 31d200e5b922 xen/arch/x86/hvm/svm/emulate.c
--- a/xen/arch/x86/hvm/svm/emulate.c    Wed Aug 11 17:01:02 2010 +0100
+++ b/xen/arch/x86/hvm/svm/emulate.c    Fri Aug 13 08:31:49 2010 +0100
@@ -100,6 +100,7 @@ MAKE_INSTR(HLT,    1, 0xf4);
 MAKE_INSTR(HLT,    1, 0xf4);
 MAKE_INSTR(INT3,   1, 0xcc);
 MAKE_INSTR(RDTSC,  2, 0x0f, 0x31);
+MAKE_INSTR(PAUSE,  1, 0x90);
 
 static const u8 *opc_bytes[INSTR_MAX_COUNT] = 
 {
@@ -111,7 +112,8 @@ static const u8 *opc_bytes[INSTR_MAX_COU
     [INSTR_VMCALL] = OPCODE_VMCALL,
     [INSTR_HLT]    = OPCODE_HLT,
     [INSTR_INT3]   = OPCODE_INT3,
-    [INSTR_RDTSC]  = OPCODE_RDTSC
+    [INSTR_RDTSC]  = OPCODE_RDTSC,
+    [INSTR_PAUSE]  = OPCODE_PAUSE,
 };
 
 static int fetch(struct vcpu *v, u8 *buf, unsigned long addr, int len)
diff -r 786b163da49b -r 31d200e5b922 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Wed Aug 11 17:01:02 2010 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Fri Aug 13 08:31:49 2010 +0100
@@ -1261,6 +1261,22 @@ static void svm_vmexit_do_rdtsc(struct c
     hvm_rdtsc_intercept(regs);
 }
 
+static void svm_vmexit_do_pause(struct cpu_user_regs *regs)
+{
+    unsigned int inst_len;
+
+    if ( (inst_len = __get_instruction_length(current, INSTR_PAUSE)) == 0 )
+        return;
+    __update_guest_eip(regs, inst_len);
+
+    /*
+     * The guest is running a contended spinlock and we've detected it.
+     * Do something useful, like reschedule the guest
+     */
+    perfc_incr(pauseloop_exits);
+    do_sched_op_compat(SCHEDOP_yield, 0);
+}
+
 static void svm_vmexit_ud_intercept(struct cpu_user_regs *regs)
 {
     struct hvm_emulate_ctxt ctxt;
@@ -1655,12 +1671,7 @@ asmlinkage void svm_vmexit_handler(struc
         break;
 
     case VMEXIT_PAUSE:
-        /*
-         * The guest is running a contended spinlock and we've detected it.
-         * Do something useful, like reschedule the guest
-         */
-        perfc_incr(pauseloop_exits);
-        do_sched_op_compat(SCHEDOP_yield, 0);
+        svm_vmexit_do_pause(regs);
         break;
 
     default:
diff -r 786b163da49b -r 31d200e5b922 xen/include/asm-x86/hvm/svm/emulate.h
--- a/xen/include/asm-x86/hvm/svm/emulate.h     Wed Aug 11 17:01:02 2010 +0100
+++ b/xen/include/asm-x86/hvm/svm/emulate.h     Fri Aug 13 08:31:49 2010 +0100
@@ -31,6 +31,7 @@ enum instruction_index {
     INSTR_HLT,
     INSTR_INT3,
     INSTR_RDTSC,
+    INSTR_PAUSE,
     INSTR_MAX_COUNT /* Must be last - Number of instructions supported */
 };
 

_______________________________________________
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] svm: increment RIP over PAUSE instruction when emulating it, Xen patchbot-unstable <=