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-devel

[Xen-devel] [PATCH 11/12] Allow vcpu to pause self

To: "Keir Fraser" <Keir.Fraser@xxxxxxxxxxxx>, "Ian Pratt" <m+Ian.Pratt@xxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 11/12] Allow vcpu to pause self
From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
Date: Wed, 14 Feb 2007 17:19:29 +0800
Cc: "Yu, Ke" <ke.yu@xxxxxxxxx>
Delivery-date: Wed, 14 Feb 2007 01:20:05 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcdQGTptz4pJz5OfS/CN1+qId+jE1A==
Thread-topic: [PATCH 11/12] Allow vcpu to pause self
Allow one vcpu to pause self, with full context sync-ed.

Signed-off-by Kevin Tian <kevin.tian@xxxxxxxxx>

diff -r f6443af464be xen/common/domain.c
--- a/xen/common/domain.c       Tue Feb 13 13:37:12 2007 +0800
+++ b/xen/common/domain.c       Tue Feb 13 13:41:44 2007 +0800
@@ -375,6 +375,18 @@ void vcpu_pause_nosync(struct vcpu *v)
     vcpu_sleep_nosync(v);
 }
 
+/* This is not a code path called from guest, since execution is paused
+ * after next context switch. ACPI PM requires this to pause vcpu0 of
+ * dom0 itself, in case that vcpu not running on cpu 0.
+ */
+void vcpu_pause_self(void)
+{
+    struct vcpu *v = current;
+
+    set_bit(_VCPUF_need_sync, &v->vcpu_flags);
+    vcpu_pause_nosync(v);
+}
+
 void vcpu_unpause(struct vcpu *v)
 {
     int wake;
diff -r f6443af464be xen/common/schedule.c
--- a/xen/common/schedule.c     Tue Feb 13 13:37:12 2007 +0800
+++ b/xen/common/schedule.c     Tue Feb 13 13:41:44 2007 +0800
@@ -629,6 +629,13 @@ void context_saved(struct vcpu *prev)
 
     if ( unlikely(test_bit(_VCPUF_migrating, &prev->vcpu_flags)) )
         vcpu_migrate(prev);
+
+    if ( unlikely(test_bit(_VCPUF_need_sync, &prev->vcpu_flags)) )
+    {
+        sync_vcpu_execstate(prev);
+        /* test and clear can be split, since here is the only clear
point */
+        clear_bit(_VCPUF_need_sync, &prev->vcpu_flags);
+    }
 }
 
 
/***********************************************************************
*****
diff -r f6443af464be xen/include/xen/sched.h
--- a/xen/include/xen/sched.h   Tue Feb 13 13:37:12 2007 +0800
+++ b/xen/include/xen/sched.h   Tue Feb 13 13:41:44 2007 +0800
@@ -423,6 +423,9 @@ extern struct domain *domain_list;
  /* VCPU affinity has changed: migrating to a new CPU. */
 #define _VCPUF_migrating       13
 #define VCPUF_migrating        (1UL<<_VCPUF_migrating)
+ /* VCPU needs full context sync once switched out */
+#define _VCPUF_need_sync       14
+#define VCPUF_need_sync        (1UL<<_VCPUF_need_sync)
 
 /*
  * Per-domain flags (domain_flags).
@@ -465,6 +468,7 @@ static inline int vcpu_runnable(struct v
 
 void vcpu_pause(struct vcpu *v);
 void vcpu_pause_nosync(struct vcpu *v);
+void vcpu_pause_self(void);
 void domain_pause(struct domain *d);
 void vcpu_unpause(struct vcpu *v);
 void domain_unpause(struct domain *d);

Attachment: vcpu_pause_self.patch
Description: vcpu_pause_self.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 11/12] Allow vcpu to pause self, Tian, Kevin <=