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

[Xen-devel] [Patch 1 of 2]: PV-domain SMP performance XEN-part


  • To: "xen-d >> \"xen-devel@xxxxxxxxxxxxxxxxxxx\"" <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: Juergen Gross <juergen.gross@xxxxxxxxxxxxxxxxxxx>
  • Date: Wed, 17 Dec 2008 13:25:41 +0100
  • Delivery-date: Wed, 17 Dec 2008 04:26:08 -0800
  • Domainkey-signature: s=s768; d=fujitsu-siemens.com; c=nofws; q=dns; h=X-SBRSScore:X-IronPort-AV:Received:X-IronPort-AV: Received:Received:Message-ID:Date:From:Organization: User-Agent:MIME-Version:To:Subject:X-Enigmail-Version: Content-Type; b=nyf//HqO1ytTdnGydary3GE/NGJPD8htd1IwQ47HhEfgsLuk677gbOtW vl2CFUlFuM9iYDQTb2yj2U411T+FB/fAzBLwAiryXsyRdCTSsIXqSJ7EL Eov+d3ezzdh6pZH;
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

-- 
Juergen Gross                             Principal Developer
IP SW OS6                      Telephone: +49 (0) 89 636 47950
Fujitsu Siemens Computers         e-mail: juergen.gross@xxxxxxxxxxxxxxxxxxx
Otto-Hahn-Ring 6                Internet: www.fujitsu-siemens.com
D-81739 Muenchen         Company details: www.fujitsu-siemens.com/imprint.html

Add possibility for guest to mark a vcpu not to be descheduled.

Signed-off-by: juergen.gross@xxxxxxxxxxxxxxxxxxx

# HG changeset patch
# User juergen.gross@xxxxxxxxxxxxxxxxxxx
# Date 1229510869 -3600
# Node ID a854d67dd0f0aa11986d0ed741681cf671ceb7ac
# Parent  a76b4e00e1862035240ec6403a8f081be61b1e2b
added support of vcpu preempt disable

diff -r a76b4e00e186 -r a854d67dd0f0 xen/common/schedule.c
--- a/xen/common/schedule.c     Tue Dec 16 13:14:25 2008 +0000
+++ b/xen/common/schedule.c     Wed Dec 17 11:47:49 2008 +0100
@@ -778,6 +778,7 @@ static void schedule(void)
     struct schedule_data *sd;
     struct task_slice     next_slice;
     s32                   r_time;     /* time for new dom to run */
+    int                   is_idle = is_idle_domain(prev->domain);
 
     ASSERT(!in_irq());
     ASSERT(this_cpu(mc_state).flags == 0);
@@ -787,6 +788,22 @@ static void schedule(void)
     sd = &this_cpu(schedule_data);
 
     spin_lock_irq(&sd->schedule_lock);
+
+    if ( !is_idle && unlikely(vcpu_info(prev, no_desched)) )
+    {
+        if ( !vcpu_info(prev, desched_delay) )
+        {
+            vcpu_info(prev, desched_delay) = 1;
+            sd->delay_desched = now + MILLISECS(1);
+            stop_timer(&sd->s_timer);
+            set_timer(&sd->s_timer, sd->delay_desched);
+        }
+        if ( now < sd->delay_desched )
+        {
+            spin_unlock_irq(&sd->schedule_lock);
+            return continue_running(prev);
+        }
+    }
 
     stop_timer(&sd->s_timer);
     
@@ -797,6 +814,11 @@ static void schedule(void)
     next = next_slice.task;
 
     sd->curr = next;
+    sd->delay_desched = 0;
+    if ( !is_idle )
+    {
+        vcpu_info(prev, desched_delay) = 0;
+    }
     
     set_timer(&sd->s_timer, now + r_time);
 
diff -r a76b4e00e186 -r a854d67dd0f0 xen/include/public/xen.h
--- a/xen/include/public/xen.h  Tue Dec 16 13:14:25 2008 +0000
+++ b/xen/include/public/xen.h  Wed Dec 17 11:47:49 2008 +0100
@@ -434,9 +434,18 @@ struct vcpu_info {
      * non-zero mask therefore guarantees that the VCPU will not receive
      * an upcall activation. The mask is cleared when the VCPU requests
      * to block: this avoids wakeup-waiting races.
+     *
+     * The guest can set 'no_desched' to a non-zero value to avoid being
+     * descheduled. If the hypervisor didn't deschedule the VCPU due to
+     * 'no_desched' being set, it will itself set 'desched_delay' to inform
+     * the guest to give up control voluntaryly later. This is just a wish
+     * of the guest which the hypervisor may not obey (and it will deschedule
+     * the guest after a reasonable time anyway).
      */
     uint8_t evtchn_upcall_pending;
     uint8_t evtchn_upcall_mask;
+    uint8_t no_desched;
+    uint8_t desched_delay;
     unsigned long evtchn_pending_sel;
     struct arch_vcpu_info arch;
     struct vcpu_time_info time;
diff -r a76b4e00e186 -r a854d67dd0f0 xen/include/xen/sched-if.h
--- a/xen/include/xen/sched-if.h        Tue Dec 16 13:14:25 2008 +0000
+++ b/xen/include/xen/sched-if.h        Wed Dec 17 11:47:49 2008 +0100
@@ -16,6 +16,7 @@ struct schedule_data {
     struct vcpu        *idle;           /* idle task for this cpu          */
     void               *sched_priv;
     struct timer        s_timer;        /* scheduling timer                */
+    s_time_t            delay_desched;  /* time of delayed deschedule      */
 } __cacheline_aligned;
 
 DECLARE_PER_CPU(struct schedule_data, schedule_data);

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

 


Rackspace

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