Message ID | 82d394363821b74fb1617e81e6e726a7a25b4028.1741164138.git.xakep.amatop@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Suspend to RAM support for Xen on arm64 | expand |
On 05.03.2025 10:11, Mykola Kvach wrote: > From: Mirela Simonovic <mirela.simonovic@aggios.com> > > These functions will be reused by suspend/resume support for ARM. And until then they are going to violate the Misra rule requiring there to not be unreachable code. > --- a/xen/common/domain.c > +++ b/xen/common/domain.c > @@ -2259,6 +2259,36 @@ int continue_hypercall_on_cpu( > return 0; > } > > + > +void freeze_domains(void) Nit: No double blank lines please. > +{ > + 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); > + > + scheduler_disable(); When made generally available I'm unsure having this and ... > +} > + > +void thaw_domains(void) > +{ > + struct domain *d; > + > + scheduler_enable(); ... this here is a good idea. Both scheduler operations aren't related to what the function names say is being done here. Jan
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c index d0b67614d5..f38398827e 100644 --- a/xen/arch/x86/acpi/power.c +++ b/xen/arch/x86/acpi/power.c @@ -137,35 +137,6 @@ static void device_power_up(enum dev_power_saved saved) } } -static 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); - - scheduler_disable(); -} - -static void thaw_domains(void) -{ - struct domain *d; - - scheduler_enable(); - - rcu_read_lock(&domlist_read_lock); - for_each_domain ( d ) - domain_unpause(d); - rcu_read_unlock(&domlist_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 0c4cc77111..49ff84d2f5 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -2259,6 +2259,36 @@ 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); + + scheduler_disable(); +} + +void thaw_domains(void) +{ + struct domain *d; + + scheduler_enable(); + + rcu_read_lock(&domlist_read_lock); + for_each_domain ( 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 037c83fda2..177784e6da 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -1059,6 +1059,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); /*