On 13.10.25 12:15, Penny Zheng wrote:
Function vcpu_affinity_domctl() is responsible for
XEN_DOMCTL_{getvcpuaffinity,setvcpuaffinity} domctl-op, and shall be
wrapped with CONFIG_MGMT_HYPERCALLS. Otherwise it will become unreachable
codes when MGMT_HYPERCALLS=n, and hence violating Misra rule 2.1.

Signed-off-by: Penny Zheng <[email protected]>
---
v1 -> v2:
- adapt to changes of "unify DOMCTL to MGMT_HYPERCALLS"
- wrap XEN_DOMCTL_{getvcpuaffinity,setvcpuaffinity}-case transiently
---
v2 -> v3:
- adapt to changes of "remove vcpu_set_soft_affinity()"
- address "violating Misra rule 2.1" in commit message
- remove transient wrapping around 
XEN_DOMCTL_{getvcpuaffinity,setvcpuaffinity}-case
---
  xen/common/sched/core.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index 88150432c3..180de784fa 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -1688,6 +1688,7 @@ int vcpuaffinity_params_invalid(const struct 
xen_domctl_vcpuaffinity *vcpuaff)
              guest_handle_is_null(vcpuaff->cpumap_soft.bitmap));
  }
+#ifdef CONFIG_MGMT_HYPERCALLS

I suggest to move this #ifdef above vcpuaffinity_params_invalid(), which is
used by vcpu_affinity_domctl() only.

  int vcpu_affinity_domctl(struct domain *d, uint32_t cmd,
                           struct xen_domctl_vcpuaffinity *vcpuaff)
  {
@@ -1798,6 +1799,7 @@ int vcpu_affinity_domctl(struct domain *d, uint32_t cmd,
return ret;
  }
+#endif /* CONFIG_MGMT_HYPERCALLS */
bool alloc_affinity_masks(struct affinity_masks *affinity)
  {


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to