[PATCH v3 17/28] xen/domctl: wrap vcpu_affinity_domctl() with CONFIG_MGMT_HYPERCALLS

Penny Zheng posted 28 patches 2 weeks, 3 days ago
Only 27 patches received!
[PATCH v3 17/28] xen/domctl: wrap vcpu_affinity_domctl() with CONFIG_MGMT_HYPERCALLS
Posted by Penny Zheng 2 weeks, 3 days ago
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 <Penny.Zheng@amd.com>
---
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
 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)
 {
-- 
2.34.1
Re: [PATCH v3 17/28] xen/domctl: wrap vcpu_affinity_domctl() with CONFIG_MGMT_HYPERCALLS
Posted by Jürgen Groß 2 weeks, 3 days ago
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 <Penny.Zheng@amd.com>
> ---
> 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