|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 05/19] xen/x86: Move freeze/thaw_domains into common files
From: Mirela Simonovic <mirela.simonovic@xxxxxxxxxx>
These functions will be reused by suspend/resume support for ARM.
Signed-off-by: Mirela Simonovic <mirela.simonovic@xxxxxxxxxx>
Signed-off-by: Saeed Nowshadi <saeed.nowshadi@xxxxxxxxxx>
---
xen/common/domain.c | 29 +++++++++++++++++++++++++++++
xen/include/xen/sched.h | 3 +++
2 files changed, 32 insertions(+)
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 56d47dd664..5e5894c468 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1884,6 +1884,35 @@ int continue_hypercall_on_cpu(
return 0;
}
+
+void freeze_domains(void)
+{
+ struct domain *d;
+
+ rcu_read_lock(&domlist_read_lock);
+ /*
+ * Note that we iterate in order of domain-id. Hence we will pause dom0
+ * first which is required for correctness (as only dom0 can add domains to
+ * the domain list). Otherwise we could miss concurrently-created domains.
+ */
+ for_each_domain ( d )
+ domain_pause(d);
+ rcu_read_unlock(&domlist_read_lock);
+}
+
+void thaw_domains(void)
+{
+ struct domain *d;
+
+ rcu_read_lock(&domlist_read_lock);
+ for_each_domain ( d )
+ {
+ restore_vcpu_affinity(d);
+ domain_unpause(d);
+ }
+ rcu_read_unlock(&domlist_read_lock);
+}
+
/*
* Local variables:
* mode: C
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 00a939aa01..c8ddfdd51c 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -978,6 +978,9 @@ static inline struct vcpu *domain_vcpu(const struct domain
*d,
return vcpu_id >= d->max_vcpus ? NULL : d->vcpu[idx];
}
+void freeze_domains(void);
+void thaw_domains(void);
+
void cpu_init(void);
/*
--
2.37.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |