Re: [Xen-devel] [PATCH 06/18] xen/x86: Move freeze/thaw_domains into common files

2018-11-13 Thread Stefano Stabellini
On Mon, 12 Nov 2018, Mirela Simonovic wrote:
> These functions will be reused by suspend/resume support for ARM.
> 
> Signed-off-by: Mirela Simonovic 
> Signed-off-by: Saeed Nowshadi 
> ---
>  xen/arch/x86/acpi/power.c | 28 
>  xen/common/domain.c   | 29 +
>  xen/include/xen/sched.h   |  3 +++
>  3 files changed, 32 insertions(+), 28 deletions(-)
> 
> diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
> index 93e967fe8f..794750e45b 100644
> --- a/xen/arch/x86/acpi/power.c
> +++ b/xen/arch/x86/acpi/power.c
> @@ -109,34 +109,6 @@ static void device_power_up(enum dev_power_saved saved)
>  }
>  }
>  
> -static void freeze_domains(void)
> -{
> -struct domain *d;
> -
> -rcu_read_lock(_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(_read_lock);
> -}
> -
> -static void thaw_domains(void)
> -{
> -struct domain *d;
> -
> -rcu_read_lock(_read_lock);
> -for_each_domain ( d )
> -{
> -restore_vcpu_affinity(d);
> -domain_unpause(d);
> -}
> -rcu_read_unlock(_read_lock);
> -}
> -
>  static void acpi_sleep_prepare(u32 state)
>  {
>  void *wakeup_vector_va;
> diff --git a/xen/common/domain.c b/xen/common/domain.c
> index d6650f0656..fdd00dc661 100644
> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -1666,6 +1666,35 @@ int continue_hypercall_on_cpu(
>  return 0;
>  }
>  
> +

NIT: spurious newline

Aside from that:

Acked-by: Stefano Stabellini 


> +void freeze_domains(void)
> +{
> +struct domain *d;
> +
> +rcu_read_lock(_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(_read_lock);
> +}
> +
> +void thaw_domains(void)
> +{
> +struct domain *d;
> +
> +rcu_read_lock(_read_lock);
> +for_each_domain ( d )
> +{
> +restore_vcpu_affinity(d);
> +domain_unpause(d);
> +}
> +rcu_read_unlock(_read_lock);
> +}
> +
>  /*
>   * Local variables:
>   * mode: C
> diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
> index 366acaf69a..c7a6d9504a 100644
> --- a/xen/include/xen/sched.h
> +++ b/xen/include/xen/sched.h
> @@ -821,6 +821,9 @@ static inline int 
> domain_pause_by_systemcontroller_nosync(struct domain *d)
>  void domain_pause_except_self(struct domain *d);
>  void domain_unpause_except_self(struct domain *d);
>  
> +void freeze_domains(void);
> +void thaw_domains(void);
> +
>  void cpu_init(void);
>  
>  struct scheduler;
> -- 
> 2.13.0
> 

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

[Xen-devel] [PATCH 06/18] xen/x86: Move freeze/thaw_domains into common files

2018-11-12 Thread Mirela Simonovic
These functions will be reused by suspend/resume support for ARM.

Signed-off-by: Mirela Simonovic 
Signed-off-by: Saeed Nowshadi 
---
 xen/arch/x86/acpi/power.c | 28 
 xen/common/domain.c   | 29 +
 xen/include/xen/sched.h   |  3 +++
 3 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 93e967fe8f..794750e45b 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -109,34 +109,6 @@ static void device_power_up(enum dev_power_saved saved)
 }
 }
 
-static void freeze_domains(void)
-{
-struct domain *d;
-
-rcu_read_lock(_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(_read_lock);
-}
-
-static void thaw_domains(void)
-{
-struct domain *d;
-
-rcu_read_lock(_read_lock);
-for_each_domain ( d )
-{
-restore_vcpu_affinity(d);
-domain_unpause(d);
-}
-rcu_read_unlock(_read_lock);
-}
-
 static void acpi_sleep_prepare(u32 state)
 {
 void *wakeup_vector_va;
diff --git a/xen/common/domain.c b/xen/common/domain.c
index d6650f0656..fdd00dc661 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1666,6 +1666,35 @@ int continue_hypercall_on_cpu(
 return 0;
 }
 
+
+void freeze_domains(void)
+{
+struct domain *d;
+
+rcu_read_lock(_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(_read_lock);
+}
+
+void thaw_domains(void)
+{
+struct domain *d;
+
+rcu_read_lock(_read_lock);
+for_each_domain ( d )
+{
+restore_vcpu_affinity(d);
+domain_unpause(d);
+}
+rcu_read_unlock(_read_lock);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 366acaf69a..c7a6d9504a 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -821,6 +821,9 @@ static inline int 
domain_pause_by_systemcontroller_nosync(struct domain *d)
 void domain_pause_except_self(struct domain *d);
 void domain_unpause_except_self(struct domain *d);
 
+void freeze_domains(void);
+void thaw_domains(void);
+
 void cpu_init(void);
 
 struct scheduler;
-- 
2.13.0


___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel