|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v4 06/24] xen/domctl: consolidate domain.c with MGMT_HYPERCALLS
The following functions, scattered in common/domain.c, and are only referenced
and responsible for domctl-op:
- domain_pause_by_systemcontroller
- domain_resume
- domain_set_node_affinity
So they shall be wrapped with CONFIG_MGMT_HYPERCALLS. Otherwise it will
become unreachable codes when MGMT_HYPERCALLS=n, and hence violating Misra
rule 2.1.
Move them together to avoid scattering #ifdef.
Signed-off-by: Penny Zheng <Penny.Zheng@xxxxxxx>
---
v3 - v4:
- combine commit "xen/domctl: wrap domain_pause_by_systemcontroller() with
MGMT_HYPERCALLS",
"xen/domctl: wrap domain_resume() with CONFIG_MGMT_HYPERCALLS", and
"xen/domctl: wrap domain_set_node_affinity() with CONFIG_MGMT_HYPERCALLS"
---
xen/common/domain.c | 114 ++++++++++++++++++++++----------------------
1 file changed, 58 insertions(+), 56 deletions(-)
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 6935b7d5e8..c6b0f931dc 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1115,35 +1115,6 @@ void __init setup_system_domains(void)
#endif
}
-int domain_set_node_affinity(struct domain *d, const nodemask_t *affinity)
-{
- /* Being disjoint with the system is just wrong. */
- if ( !nodes_intersects(*affinity, node_online_map) )
- return -EINVAL;
-
- spin_lock(&d->node_affinity_lock);
-
- /*
- * Being/becoming explicitly affine to all nodes is not particularly
- * useful. Let's take it as the `reset node affinity` command.
- */
- if ( nodes_full(*affinity) )
- {
- d->auto_node_affinity = 1;
- goto out;
- }
-
- d->auto_node_affinity = 0;
- d->node_affinity = *affinity;
-
-out:
- spin_unlock(&d->node_affinity_lock);
-
- domain_update_node_affinity(d);
-
- return 0;
-}
-
/* rcu_read_lock(&domlist_read_lock) must be held. */
static struct domain *domid_to_domain(domid_t dom)
{
@@ -1361,33 +1332,6 @@ int domain_shutdown(struct domain *d, u8 reason)
return 0;
}
-void domain_resume(struct domain *d)
-{
- struct vcpu *v;
-
- /*
- * Some code paths assume that shutdown status does not get reset under
- * their feet (e.g., some assertions make this assumption).
- */
- domain_pause(d);
-
- spin_lock(&d->shutdown_lock);
-
- d->is_shutting_down = d->is_shut_down = 0;
- d->shutdown_code = SHUTDOWN_CODE_INVALID;
-
- for_each_vcpu ( d, v )
- {
- if ( v->paused_for_shutdown )
- vcpu_unpause(v);
- v->paused_for_shutdown = 0;
- }
-
- spin_unlock(&d->shutdown_lock);
-
- domain_unpause(d);
-}
-
int vcpu_start_shutdown_deferral(struct vcpu *v)
{
if ( v->defer_shutdown )
@@ -1616,10 +1560,68 @@ static int _domain_pause_by_systemcontroller(struct
domain *d, bool sync)
return 0;
}
+#ifdef CONFIG_MGMT_HYPERCALLS
+int domain_set_node_affinity(struct domain *d, const nodemask_t *affinity)
+{
+ /* Being disjoint with the system is just wrong. */
+ if ( !nodes_intersects(*affinity, node_online_map) )
+ return -EINVAL;
+
+ spin_lock(&d->node_affinity_lock);
+
+ /*
+ * Being/becoming explicitly affine to all nodes is not particularly
+ * useful. Let's take it as the `reset node affinity` command.
+ */
+ if ( nodes_full(*affinity) )
+ {
+ d->auto_node_affinity = 1;
+ goto out;
+ }
+
+ d->auto_node_affinity = 0;
+ d->node_affinity = *affinity;
+
+out:
+ spin_unlock(&d->node_affinity_lock);
+
+ domain_update_node_affinity(d);
+
+ return 0;
+}
+
+void domain_resume(struct domain *d)
+{
+ struct vcpu *v;
+
+ /*
+ * Some code paths assume that shutdown status does not get reset under
+ * their feet (e.g., some assertions make this assumption).
+ */
+ domain_pause(d);
+
+ spin_lock(&d->shutdown_lock);
+
+ d->is_shutting_down = d->is_shut_down = 0;
+ d->shutdown_code = SHUTDOWN_CODE_INVALID;
+
+ for_each_vcpu ( d, v )
+ {
+ if ( v->paused_for_shutdown )
+ vcpu_unpause(v);
+ v->paused_for_shutdown = 0;
+ }
+
+ spin_unlock(&d->shutdown_lock);
+
+ domain_unpause(d);
+}
+
int domain_pause_by_systemcontroller(struct domain *d)
{
return _domain_pause_by_systemcontroller(d, true /* sync */);
}
+#endif /* CONFIG_MGMT_HYPERCALLS */
int domain_pause_by_systemcontroller_nosync(struct domain *d)
{
--
2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |