[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 05/19] xen/x86: Move freeze/thaw_domains into common files
- To: Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Julien Grall <julien@xxxxxxx>
- Date: Tue, 6 Dec 2022 20:36:50 +0000
- Cc: Mirela Simonovic <mirela.simonovic@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Saeed Nowshadi <saeed.nowshadi@xxxxxxxxxx>
- Delivery-date: Tue, 06 Dec 2022 20:36:58 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Hi,
On 07/10/2022 11:32, Mykyta Poturai wrote:
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>
Your Signed-off-by is missing.
---
xen/common/domain.c | 29 +++++++++++++++++++++++++++++
The title suggests that there will be code movement. However... I only
see addition here. Did you intend to remove the functions from
arch/x86/acpi/power.c?
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);
/*
Cheers,
--
Julien Grall
|