[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 05/19] xen/x86: Move freeze/thaw_domains into common files


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>
  • Date: Fri, 7 Oct 2022 10:32:46 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6h6SHmTRfcgXQ7Yu2AK+J4nbsyl3YwHrisUBV1UF7MI=; b=EJ6Au0w0nhzf/SCyDC305K6Nr4eopsch3XkTN/d6Ol5l9f39LnvkWy7JGH4c7eQd2mEtAXs54nOXdOXyVC0YvdSGvgeRgsA2uSbsr41o4pCBLCWoxLJQmf68ltCLR50/1Z15k6fYHoExqT8zUYT5lNamfDC3IAbmJTwShjqCJqnLUEsE57qM4qTXca+rLu2CAXWBDpJ+dW6JSGLdhbvwfj8ultdaPv3MSyXk0u6FAQ/6GXMPO8WQz9oEAtHXgwPB9iJ9x77qoQjQ6/I2Ig1zFgiH8Q1FIQ5BpPQKQrIfhK5bnU5l36XRsLlCl7ce9E9rWlMOIiC4AQD2r7kfDLf9zA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SsOAfmerj3Y9pJgGOdn59yTsXDQowD0l0B1Ita4V5ZEH05KODP4jIiJFMStDcUgWpNvRwCbCTEjNcR1t1rb2U3eMwQPnwM80G2TBfQEAK858dgidRPBW0S9+J3XouDAbSB3ZscJm5gBdQ8b+VvYLcRAaGXdVL3lwauqgYEKeF1qkl68/LEolLOLA1eeL+s3Xa8hGgQCiZy03k2jnuvFTFYEYThWNBWMw0vjMDQ32zPD9A7sxkLKJ3KIhJfnC9uw4Sd6d2mACKbpBvj3Ztbq1EC1ox1Zr2KgPdTXssP9+bgsSCLMPIfg+2/9DXuKWn8sMC/p7M3bDbs3ikhG/lchjZw==
  • Cc: Mirela Simonovic <mirela.simonovic@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Saeed Nowshadi <saeed.nowshadi@xxxxxxxxxx>
  • Delivery-date: Fri, 07 Oct 2022 10:33:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHY2jgjZkKcYQ550kmOPqD7DDutRA==
  • Thread-topic: [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



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.