|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] [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);
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 <=
|
|
|
|
|