[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Merge



# HG changeset patch
# User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
# Date 1281704151 -3600
# Node ID 85bd0f6e8fedf7816883e3b568dbe26c164d63c3
# Parent  ddb9f47ef2e2848e795a56496ff09a0ff06935f0
# Parent  1f8a2d0243798c3683d5786078fd62190bd497c0
Merge
---
 buildconfigs/mk.linux-2.6-common      |    2 +-
 xen/arch/x86/hvm/svm/emulate.c        |    4 +++-
 xen/arch/x86/hvm/svm/svm.c            |   23 +++++++++++++++++------
 xen/arch/x86/traps.c                  |    9 +++++++++
 xen/common/event_channel.c            |   11 ++++-------
 xen/common/sched_credit.c             |   27 +++++++++++++++++----------
 xen/include/asm-x86/hvm/svm/emulate.h |    1 +
 7 files changed, 52 insertions(+), 25 deletions(-)

diff -r ddb9f47ef2e2 -r 85bd0f6e8fed buildconfigs/mk.linux-2.6-common
--- a/buildconfigs/mk.linux-2.6-common  Thu Aug 12 18:56:20 2010 +0100
+++ b/buildconfigs/mk.linux-2.6-common  Fri Aug 13 13:55:51 2010 +0100
@@ -75,7 +75,7 @@ endif
        # tree. Finally attempt to use make defconfig.
        set -e ; \
        CONFIG_VERSION=$$(sed -ne 's/$$(XENGUEST)//; s/^EXTRAVERSION = //p' 
$(LINUX_SRCDIR)/Makefile); \
-       if [ ! -z "$(XEN_LINUX_CONFIG)" -a -r $(XEN_LINUX_CONFIG) ]; then \
+       if [ ! -z "$(XEN_LINUX_CONFIG)" -a -r "$(XEN_LINUX_CONFIG)" ]; then \
          cp $(XEN_LINUX_CONFIG) $(CONFIG_FILE); \
        elif [ -r 
$(DESTDIR)/boot/config-$(LINUX_VER3)$$CONFIG_VERSION$(EXTRAVERSION) ] ; then \
          cp 
$(DESTDIR)/boot/config-$(LINUX_VER3)$$CONFIG_VERSION$(EXTRAVERSION) 
$(CONFIG_FILE) ; \
diff -r ddb9f47ef2e2 -r 85bd0f6e8fed xen/arch/x86/hvm/svm/emulate.c
--- a/xen/arch/x86/hvm/svm/emulate.c    Thu Aug 12 18:56:20 2010 +0100
+++ b/xen/arch/x86/hvm/svm/emulate.c    Fri Aug 13 13:55:51 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 ddb9f47ef2e2 -r 85bd0f6e8fed xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Thu Aug 12 18:56:20 2010 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Fri Aug 13 13:55:51 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 ddb9f47ef2e2 -r 85bd0f6e8fed xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Thu Aug 12 18:56:20 2010 +0100
+++ b/xen/arch/x86/traps.c      Fri Aug 13 13:55:51 2010 +0100
@@ -2228,6 +2228,7 @@ static int emulate_privileged_op(struct 
         case MSR_K8_PSTATE5:
         case MSR_K8_PSTATE6:
         case MSR_K8_PSTATE7:
+        case MSR_K8_HWCR:
             if ( boot_cpu_data.x86_vendor != X86_VENDOR_AMD )
                 goto fail;
             if ( !is_cpufreq_controller(v->domain) )
@@ -2267,6 +2268,14 @@ static int emulate_privileged_op(struct 
             break;
         case MSR_IA32_MPERF:
         case MSR_IA32_APERF:
+            if (( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) &&
+                ( boot_cpu_data.x86_vendor != X86_VENDOR_AMD ) )
+                goto fail;
+            if ( !is_cpufreq_controller(v->domain) )
+                break;
+            if ( wrmsr_safe(regs->ecx, msr_content ) != 0 )
+                goto fail;
+            break;
         case MSR_IA32_PERF_CTL:
             if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
                 goto fail;
diff -r ddb9f47ef2e2 -r 85bd0f6e8fed xen/common/event_channel.c
--- a/xen/common/event_channel.c        Thu Aug 12 18:56:20 2010 +0100
+++ b/xen/common/event_channel.c        Fri Aug 13 13:55:51 2010 +0100
@@ -1123,14 +1123,11 @@ static void domain_dump_evtchn_info(stru
 
     bitmap_scnlistprintf(keyhandler_scratch, sizeof(keyhandler_scratch),
                          d->poll_mask, d->max_vcpus);
-    printk("Domain %d polling vCPUs: {%s}\n",
-           d->domain_id, keyhandler_scratch);
-
-    if ( !spin_trylock(&d->event_lock) )
-        return;
-
     printk("Event channel information for domain %d:\n"
-           "    port [p/m]\n", d->domain_id);
+           "Polling vCPUs: {%s}\n"
+           "    port [p/m]\n", d->domain_id, keyhandler_scratch);
+
+    spin_lock(&d->event_lock);
 
     for ( port = 1; port < MAX_EVTCHNS(d); ++port )
     {
diff -r ddb9f47ef2e2 -r 85bd0f6e8fed xen/common/sched_credit.c
--- a/xen/common/sched_credit.c Thu Aug 12 18:56:20 2010 +0100
+++ b/xen/common/sched_credit.c Fri Aug 13 13:55:51 2010 +0100
@@ -555,10 +555,11 @@ __csched_vcpu_acct_start(struct csched_p
 
         sdom->active_vcpu_count++;
         list_add(&svc->active_vcpu_elem, &sdom->active_vcpu);
+        /* Make weight per-vcpu */
+        prv->weight += sdom->weight;
         if ( list_empty(&sdom->active_sdom_elem) )
         {
             list_add(&sdom->active_sdom_elem, &prv->active_sdom);
-            prv->weight += sdom->weight;
         }
     }
 
@@ -576,13 +577,13 @@ __csched_vcpu_acct_stop_locked(struct cs
     CSCHED_VCPU_STAT_CRANK(svc, state_idle);
     CSCHED_STAT_CRANK(acct_vcpu_idle);
 
+    BUG_ON( prv->weight < sdom->weight );
     sdom->active_vcpu_count--;
     list_del_init(&svc->active_vcpu_elem);
+    prv->weight -= sdom->weight;
     if ( list_empty(&sdom->active_vcpu) )
     {
-        BUG_ON( prv->weight < sdom->weight );
         list_del_init(&sdom->active_sdom_elem);
-        prv->weight -= sdom->weight;
     }
 }
 
@@ -804,8 +805,8 @@ csched_dom_cntl(
         {
             if ( !list_empty(&sdom->active_sdom_elem) )
             {
-                prv->weight -= sdom->weight;
-                prv->weight += op->u.credit.weight;
+                prv->weight -= sdom->weight * sdom->active_vcpu_count;
+                prv->weight += op->u.credit.weight * sdom->active_vcpu_count;
             }
             sdom->weight = op->u.credit.weight;
         }
@@ -976,9 +977,9 @@ csched_acct(void* dummy)
         BUG_ON( is_idle_domain(sdom->dom) );
         BUG_ON( sdom->active_vcpu_count == 0 );
         BUG_ON( sdom->weight == 0 );
-        BUG_ON( sdom->weight > weight_left );
-
-        weight_left -= sdom->weight;
+        BUG_ON( (sdom->weight * sdom->active_vcpu_count) > weight_left );
+
+        weight_left -= ( sdom->weight * sdom->active_vcpu_count );
 
         /*
          * A domain's fair share is computed using its weight in competition
@@ -991,7 +992,9 @@ csched_acct(void* dummy)
         credit_peak = sdom->active_vcpu_count * CSCHED_CREDITS_PER_ACCT;
         if ( prv->credit_balance < 0 )
         {
-            credit_peak += ( ( -prv->credit_balance * sdom->weight) +
+            credit_peak += ( ( -prv->credit_balance
+                               * sdom->weight
+                               * sdom->active_vcpu_count) +
                              (weight_total - 1)
                            ) / weight_total;
         }
@@ -1002,11 +1005,15 @@ csched_acct(void* dummy)
             if ( credit_cap < credit_peak )
                 credit_peak = credit_cap;
 
+            /* FIXME -- set cap per-vcpu as well...? */
             credit_cap = ( credit_cap + ( sdom->active_vcpu_count - 1 )
                          ) / sdom->active_vcpu_count;
         }
 
-        credit_fair = ( ( credit_total * sdom->weight) + (weight_total - 1)
+        credit_fair = ( ( credit_total
+                          * sdom->weight
+                          * sdom->active_vcpu_count )
+                        + (weight_total - 1)
                       ) / weight_total;
 
         if ( credit_fair < credit_peak )
diff -r ddb9f47ef2e2 -r 85bd0f6e8fed xen/include/asm-x86/hvm/svm/emulate.h
--- a/xen/include/asm-x86/hvm/svm/emulate.h     Thu Aug 12 18:56:20 2010 +0100
+++ b/xen/include/asm-x86/hvm/svm/emulate.h     Fri Aug 13 13:55:51 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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.