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 6/10] Allow vcpu to pause self

To: "Keir Fraser" <keir@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 6/10] Allow vcpu to pause self
From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
Date: Wed, 27 Jun 2007 21:37:36 +0800
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 27 Jun 2007 06:35:42 -0700
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: Ace4wFEyWBrDMwUBRbudwW+SC7WIGw==
Thread-topic: [PATCH 6/10] Allow vcpu to pause self
Add self pause ability, which is required by vcpu0/dom0 when
running on a AP. This can't be satisfied by existing interface,
since the new flag also serves as a sync point.

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

diff -r d5315422dbc8 xen/common/domain.c
--- a/xen/common/domain.c       Mon May 14 18:35:31 2007 -0400
+++ b/xen/common/domain.c       Mon May 14 20:21:04 2007 -0400
@@ -530,6 +530,17 @@ void vcpu_pause_nosync(struct vcpu *v)
     vcpu_sleep_nosync(v);
 }
 
+/* _VPF_need_sync serves not only as flag for sync pause, but also
+ * as hint for other cpu waiting for this pause.
+ */
+void vcpu_pause_self(void)
+{
+    struct vcpu *v = current;
+
+    set_bit(_VPF_need_sync, &v->pause_flags);
+    vcpu_pause_nosync(v);
+}
+
 void vcpu_unpause(struct vcpu *v)
 {
     if ( atomic_dec_and_test(&v->pause_count) )
diff -r d5315422dbc8 xen/common/schedule.c
--- a/xen/common/schedule.c     Mon May 14 18:35:31 2007 -0400
+++ b/xen/common/schedule.c     Mon May 14 18:54:28 2007 -0400
@@ -691,6 +691,13 @@ void context_saved(struct vcpu *prev)
 
     if ( unlikely(test_bit(_VPF_migrating, &prev->pause_flags)) )
         vcpu_migrate(prev);
+
+    if ( unlikely(test_bit(_VPF_need_sync, &prev->pause_flags)) )
+    {
+        sync_vcpu_execstate(prev);
+        /* test and clear can be split, since here is the only clear
point */
+        clear_bit(_VPF_need_sync, &prev->pause_flags);
+    }
 }
 
 /* The scheduler timer: force a run through the scheduler */
diff -r d5315422dbc8 xen/include/xen/sched.h
--- a/xen/include/xen/sched.h   Mon May 14 18:35:31 2007 -0400
+++ b/xen/include/xen/sched.h   Mon May 14 20:21:30 2007 -0400
@@ -457,6 +457,9 @@ extern struct domain *domain_list;
  /* VCPU affinity has changed: migrating to a new CPU. */
 #define _VPF_migrating       3
 #define VPF_migrating        (1UL<<_VPF_migrating)
+ /* VCPU needs full context sync once switched out */
+#define _VPF_need_sync       4
+#define VPF_need_sync        (1UL<<_VPF_need_sync)
 
 static inline int vcpu_runnable(struct vcpu *v)
 {
@@ -467,6 +470,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 6/10] Allow vcpu to pause self, Tian, Kevin <=