domain: adjust soft-reset arch dependency
PATCH 1/1 domain: adjust soft-reset arch dependency
Arm's arch_domain_soft_reset() returning -ENOSYS is quite unhelpful: This way a domain will be crashed if a tool stack mistakenly invokes XEN_DOMCTL_soft_reset on it. Instead the tool stack should be told of its mistake.
Introduce HAS_SOFT_RESET, implied only by x86. "imply" rather than "select" such that HAS_SOFT_RESET can later gain a dependency on MGMT_HYPERCALLS. That way HAS_SOFT_RESET will go off when MGMT_HYPERCALLS is off.
Check the new setting early in domctl handling, and compile out the thus dead (when HAS_SOFT_RESET=n) domain_soft_reset() as well as its dedicated helpers.
xen/arch/arm/domain.c +0 -5
@@ -875,11 +875,6 @@ void arch_domain_unpause(struct domain * { } -int arch_domain_soft_reset (struct domain *d) -{ -return -ENOSYS ; -} -void arch_domain_creation_finished (struct domain *d) {p2m_domain_creation_finished (d);
xen/arch/ppc/stubs.c +0 -5
@@ -214,11 +214,6 @@ void arch_domain_unpause(struct domain *BUG_ON ("unimplemented" ); } -int arch_domain_soft_reset (struct domain *d) -{ -BUG_ON ("unimplemented" ); -} -void arch_domain_creation_finished (struct domain *d) {BUG_ON ("unimplemented" );
xen/arch/riscv/stubs.c +0 -5
@@ -188,11 +188,6 @@ void arch_domain_unpause(struct domain *BUG_ON ("unimplemented" ); } -int arch_domain_soft_reset (struct domain *d) -{ -BUG_ON ("unimplemented" ); -} -void arch_domain_creation_finished (struct domain *d) {BUG_ON ("unimplemented" );
xen/arch/x86/Kconfig +1 -0
@@ -29,6 +29,7 @@ config X86 select HAS_PCI_MSI select HAS_PIRQ select HAS_SCHED_GRANULARITY + imply HAS_SOFT_RESET select HAS_UBSAN select HAS_VMAP select HAS_VPCI if HVM
xen/arch/x86/domain.c +2 -0
@@ -1030,6 +1030,7 @@ void arch_domain_unpause(struct domain *viridian_time_domain_thaw (d); } +#ifdef CONFIG_HAS_SOFT_RESET int arch_domain_soft_reset (struct domain *d) {struct page_info *page =virt_to_page (d->shared_info), *new_page;
@@ -1131,6 +1132,7 @@ int arch_domain_soft_reset(struct domain return ret; } +#endif /* CONFIG_HAS_SOFT_RESET */ void arch_domain_creation_finished (struct domain *d) {
xen/common/Kconfig +3 -0
@@ -155,6 +155,9 @@ config HAS_PMAP config HAS_SCHED_GRANULARITY bool +config HAS_SOFT_RESET + bool + config HAS_STACK_PROTECTOR bool
xen/common/argo.c +2 -0
@@ -2351,6 +2351,7 @@ argo_destroy(struct domain *d)write_unlock (&L1_global_argo_rwlock); } +#ifdef CONFIG_HAS_SOFT_RESET void argo_soft_reset (struct domain *d) {
@@ -2374,3 +2375,4 @@ argo_soft_reset(struct domain *d) write_unlock(&L1_global_argo_rwlock); } +#endif /* CONFIG_HAS_SOFT_RESET */
xen/common/domain.c +2 -0
@@ -1687,6 +1687,7 @@ void domain_unpause_except_self(struct ddomain_unpause (d); } +#ifdef CONFIG_HAS_SOFT_RESET int domain_soft_reset (struct domain *d,bool resuming) {struct vcpu *v;
@@ -1724,6 +1725,7 @@ int domain_soft_reset(struct domain *d, return rc; } +#endif /* CONFIG_HAS_SOFT_RESET */ int vcpu_reset (struct vcpu *v) {
xen/common/domctl.c +6 -0
@@ -466,6 +466,12 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xecase XEN_DOMCTL_soft_reset:case XEN_DOMCTL_soft_reset_cont: +if ( !IS_ENABLED (CONFIG_HAS_SOFT_RESET ) ) + { + ret = -EOPNOTSUPP ; +break ; + } +if ( d == current->domain )/* no domain_pause() */ { ret = -EINVAL ;
xen/common/grant_table.c +2 -0
@@ -3962,6 +3962,7 @@ int gnttab_release_mappings(struct domaireturn 0 ; } +#ifdef CONFIG_HAS_SOFT_RESET void grant_table_warn_active_grants (struct domain *d) {struct grant_table *gt = d->grant_table;
@@ -4006,6 +4007,7 @@ void grant_table_warn_active_grants(stru#undef WARN_GRANT_MAX } +#endif /* CONFIG_HAS_SOFT_RESET */ void grant_table_destroy(
Hi Jan,
Quoted 10 lines · Jan Beulich
Arm's
arch_domain_soft_reset()returning-ENOSYSis quite unhelpful: This way a domain will be crashed if a tool stack mistakenly invokesXEN_DOMCTL_soft_reseton it. Instead the tool stack should be told of its mistake.Introduce
HAS_SOFT_RESET, implied only by x86. "imply" rather than "select" such thatHAS_SOFT_RESETcan later gain a dependency onMGMT_HYPERCALLS. That wayHAS_SOFT_RESETwill go off whenMGMT_HYPERCALLSis off.
Quoted 6 lines
Check the new setting early in domctl handling, and compile out the thus dead (when HAS_SOFT_RESET=n)
domain_soft_reset()as well as its dedicated helpers.Signed-off-by Jan Beulich <[email protected]>
Thank you for your patch.
But one question - soft_reset is applicable for domain, so wouldn't it be better to note that in Kconfig option name:
HAS_DOMAIN_SOFT_RESET
Signature · 2 lines
Best regards, -grygorii
Quoted 17 lines · Grygorii Strashko
Hi Jan,
Quoted 14 lines · Jan Beulich
Arm's
arch_domain_soft_reset()returning-ENOSYSis quite unhelpful: This way a domain will be crashed if a tool stack mistakenly invokesXEN_DOMCTL_soft_reseton it. Instead the tool stack should be told of its mistake.Introduce
HAS_SOFT_RESET, implied only by x86. "imply" rather than "select" such thatHAS_SOFT_RESETcan later gain a dependency onMGMT_HYPERCALLS. That wayHAS_SOFT_RESETwill go off whenMGMT_HYPERCALLSis off.Check the new setting early in domctl handling, and compile out the thus dead (when HAS_SOFT_RESET=n)
domain_soft_reset()as well as its dedicated helpers.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Jan Beulich <[email protected]>Thank you for your patch.
Reviewed-by Grygorii Strashko <[email protected]>
Thanks.
Quoted 4 lines
But one question -
soft_resetis applicable for domain, so wouldn't it be better to note that inKconfigoption name:
HAS_DOMAIN_SOFT_RESET
I thought that "soft reset" is (going to remain) pretty unambiguous without the "domain". If (in particular) other REST maintainers think differently, I'm open to change the name. Generally my aim is to prefer reasonably short names for variables and alike, as long as no ambiguity arises.
Jan
Hi Jan,
Quoted 10 lines · Jan Beulich
Arm's
arch_domain_soft_reset()returning-ENOSYSis quite unhelpful: This way a domain will be crashed if a tool stack mistakenly invokesXEN_DOMCTL_soft_reseton it. Instead the tool stack should be told of its mistake.Introduce
HAS_SOFT_RESET, implied only by x86. "imply" rather than "select" such thatHAS_SOFT_RESETcan later gain a dependency onMGMT_HYPERCALLS. That wayHAS_SOFT_RESETwill go off whenMGMT_HYPERCALLSis off.
Quoted 5 lines
Check the new setting early in domctl handling, and compile out the thus dead (when HAS_SOFT_RESET=n)
domain_soft_reset()as well as its dedicated helpers.Signed-off-by Jan Beulich <[email protected]>
Cheers,
Signature · 1 line
Julien Grall
Quoted 10 lines · Jan Beulich
Arm's
arch_domain_soft_reset()returning-ENOSYSis quite unhelpful: This way a domain will be crashed if a tool stack mistakenly invokesXEN_DOMCTL_soft_reseton it. Instead the tool stack should be told of its mistake.Introduce
HAS_SOFT_RESET, implied only by x86. "imply" rather than "select" such thatHAS_SOFT_RESETcan later gain a dependency onMGMT_HYPERCALLS. That wayHAS_SOFT_RESETwill go off whenMGMT_HYPERCALLSis off.
Quoted 5 lines
Check the new setting early in domctl handling, and compile out the thus dead (when HAS_SOFT_RESET=n)
domain_soft_reset()as well as its dedicated helpers.Signed-off-by Jan Beulich<[email protected]>
LGTM:
Thanks.
~ Oleksii
Quoted 149 lines
xen/arch/arm/domain.c +0
-5@@ -875,11 +875,6 @@ void arch_domain_unpause(struct domain * { } -int arch_domain_soft_reset (struct domain *d) -{ -return -ENOSYS ; -} -void arch_domain_creation_finished (struct domain *d) {p2m_domain_creation_finished (d);xen/arch/ppc/stubs.c +0
-5@@ -214,11 +214,6 @@ void arch_domain_unpause(struct domain *BUG_ON ("unimplemented" ); } -int arch_domain_soft_reset (struct domain *d) -{ -BUG_ON ("unimplemented" ); -} -void arch_domain_creation_finished (struct domain *d) {BUG_ON ("unimplemented" );xen/arch/riscv/stubs.c +0
-5@@ -188,11 +188,6 @@ void arch_domain_unpause(struct domain *BUG_ON ("unimplemented" ); } -int arch_domain_soft_reset (struct domain *d) -{ -BUG_ON ("unimplemented" ); -} -void arch_domain_creation_finished (struct domain *d) {BUG_ON ("unimplemented" );xen/arch/x86/Kconfig +1
-0@@ -29,6 +29,7 @@ config X86 select HAS_PCI_MSI select HAS_PIRQ select HAS_SCHED_GRANULARITY + imply HAS_SOFT_RESET select HAS_UBSAN select HAS_VMAP select HAS_VPCI if HVMxen/arch/x86/domain.c +2
-0@@ -1030,6 +1030,7 @@ void arch_domain_unpause(struct domain *viridian_time_domain_thaw (d); } +#ifdef CONFIG_HAS_SOFT_RESET int arch_domain_soft_reset (struct domain *d) {struct page_info *page =virt_to_page (d->shared_info), *new_page;@@ -1131,6 +1132,7 @@ int arch_domain_soft_reset(struct domain return ret; } +#endif /* CONFIG_HAS_SOFT_RESET */ void arch_domain_creation_finished (struct domain *d) {xen/common/Kconfig +3
-0@@ -155,6 +155,9 @@ config HAS_PMAP config HAS_SCHED_GRANULARITY bool +config HAS_SOFT_RESET + bool + config HAS_STACK_PROTECTOR boolxen/common/argo.c +2
-0@@ -2351,6 +2351,7 @@ argo_destroy(struct domain *d)write_unlock (&L1_global_argo_rwlock); } +#ifdef CONFIG_HAS_SOFT_RESET void argo_soft_reset (struct domain *d) {@@ -2374,3 +2375,4 @@ argo_soft_reset(struct domain *d) write_unlock(&L1_global_argo_rwlock); } +#endif /* CONFIG_HAS_SOFT_RESET */ xen/common/domain.c +2
-0@@ -1687,6 +1687,7 @@ void domain_unpause_except_self(struct ddomain_unpause (d); } +#ifdef CONFIG_HAS_SOFT_RESET int domain_soft_reset (struct domain *d,bool resuming) {struct vcpu *v;@@ -1724,6 +1725,7 @@ int domain_soft_reset(struct domain *d, return rc; } +#endif /* CONFIG_HAS_SOFT_RESET */ int vcpu_reset (struct vcpu *v) {xen/common/domctl.c +6
-0@@ -466,6 +466,12 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xecase XEN_DOMCTL_soft_reset:case XEN_DOMCTL_soft_reset_cont: +if ( !IS_ENABLED (CONFIG_HAS_SOFT_RESET ) ) + { + ret = -EOPNOTSUPP ; +break ; + } +if ( d == current->domain )/* no domain_pause() */ { ret = -EINVAL ;xen/common/grant_table.c +2
-0@@ -3962,6 +3962,7 @@ int gnttab_release_mappings(struct domaireturn 0 ; } +#ifdef CONFIG_HAS_SOFT_RESET void grant_table_warn_active_grants (struct domain *d) {struct grant_table *gt = d->grant_table;@@ -4006,6 +4007,7 @@ void grant_table_warn_active_grants(stru#undef WARN_GRANT_MAX } +#endif /* CONFIG_HAS_SOFT_RESET */ void grant_table_destroy(
Quoted 16 lines · Oleksii Kurochko
Quoted 14 lines · Jan Beulich
Arm's
arch_domain_soft_reset()returning-ENOSYSis quite unhelpful: This way a domain will be crashed if a tool stack mistakenly invokesXEN_DOMCTL_soft_reseton it. Instead the tool stack should be told of its mistake.Introduce
HAS_SOFT_RESET, implied only by x86. "imply" rather than "select" such thatHAS_SOFT_RESETcan later gain a dependency onMGMT_HYPERCALLS. That wayHAS_SOFT_RESETwill go off whenMGMT_HYPERCALLSis off.Check the new setting early in domctl handling, and compile out the thus dead (when HAS_SOFT_RESET=n)
domain_soft_reset()as well as its dedicated helpers.
Quoted 5 lines
Quoted 1 line
Signed-off-by Jan Beulich<[email protected]>LGTM:
Reviewed-by Oleksii Kurochko<[email protected]>
Thanks, but one remark: Here as well as in your release-acks, can you please get used to inserting a blank ahead of the opening angle bracket? Roger had asked (me, not you) about its absence too, the other day.
Jan