[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 3/5] xen/domain: Audit config->max_vcpus during {, arch_}check_domain_config()



>>> On 05.10.18 at 16:54, <andrew.cooper3@xxxxxxxxxx> wrote:
> --- a/xen/arch/arm/domain.c
> +++ b/xen/arch/arm/domain.c
> @@ -601,6 +601,8 @@ void vcpu_switch_to_aarch64_mode(struct vcpu *v)
>  
>  int arch_check_domain_config(struct xen_domctl_createdomain *config)
>  {
> +    unsigned int max_vcpus = 0;

Is the initializer really needed here considering ...

> @@ -619,6 +621,22 @@ int arch_check_domain_config(struct 
> xen_domctl_createdomain *config)
>          }
>      }
>  
> +    /* Calculate the maximum number of vcpus from the selected GIC 
> version... */
> +    switch ( config->arch.gic_version )
> +    {
> +    case GIC_V2: max_vcpus = 8;   break;
> +    case GIC_V3: max_vcpus = 255; break;
> +
> +    default:
> +        return -EOPNOTSUPP;

... this?

> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -297,6 +297,9 @@ static int check_domain_config(struct 
> xen_domctl_createdomain *config)
>                             XEN_DOMCTL_CDF_xs_domain) )
>          return -EINVAL;
>  
> +    if ( config->max_vcpus < 1 )
> +        return -EINVAL;
> +
>      return arch_check_domain_config(config);
>  }

Any reason you don't remove the now redundant check from
domain_create(), which would allow ditching altogether x86's
domain_max_vcpus()?

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.