On 21.11.2025 11:57, Penny Zheng wrote:
> 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 <[email protected]>

One further small request here:

> --- 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:

I realize you only move this, but ...

> @@ -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:

... can you please add a leading blank here, to conform to ./CODING_STYLE?

Jan

Reply via email to