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

Re: [PATCH v6 10/12] xen/tools: add sve parameter in XL configuration


  • To: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Fri, 5 May 2023 16:36:32 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EBuac5j1CkQDJPxMr1oMigHqHJsCRs+q87fc4/OYyE0=; b=FWFMTdF0GzUdHY80NDNwAQ4rlzwzoNkDJcWheWe8MSeuv4Ubz6mJuiu1pdiGW+MBS1ueXLlazjsk0dKQw0cUtZSVbou/jbAzYwZ926eDWCvU+1br+x2UCfFUc68m/Uq6DxdZs7KCmvrqvaacQ1Fugwhzxy3qX7q+n/c79+vBJSaLJtM+AuHsYuDFEx8hIe3Nlu5Hwi2FQaNn9sKSbnP1poKrhQbWLhA5QoYK2g+8ddcJ+d025IdY31bqKroEJ72d9ce/b2LPTyW2YN3BR2e7FUf14rca6ooYGFUt5IVpsoocU8H9OFPbpZMH3z2R2p/aH4K4kMrnS/yayeW4yoNaAg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=niJXtgMVCJghSiylNfNhRlICut4mMpVOe4Qn8Mj8G3wbdWIAZuRw8eDyvN95nplB86Rgov93bHKJ6ySlDa7dR0HvMOX9qYjJ3cePe5AnZhiwbgIXM4KbeuR22RpPvydEopaRYJiYv4wj2ggMtcUoVWEMbs315T4qyW9y9BFxd1ZlgaKI5UM8uYp2v/G5zGeAMJBbAy57gsroxudGiMI6IRPn0qyEoAns1M0wPh0YjPBKK8wzRLuh0Nx7gchfBXraAYnj4ouAYbQoK4z+hFJyfc56VjT9BLyoF+jzKoEGeSVdLCamzrS7cvzFtWrsT/Xg6IeXyyx3IEIZkKH4RNdEEg==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Nick Rosbrook <rosbrookn@xxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Fri, 05 May 2023 16:37:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZdnKI1/ryq6h2kEuVT2yTgC4YMq9HQ+EAgAAu74CABHwZgIAAA6SA
  • Thread-topic: [PATCH v6 10/12] xen/tools: add sve parameter in XL configuration


> On 5 May 2023, at 17:23, Anthony PERARD <anthony.perard@xxxxxxxxxx> wrote:
> 
> On Tue, May 02, 2023 at 07:54:19PM +0000, Luca Fancellu wrote:
>>> On 2 May 2023, at 18:06, Anthony PERARD <anthony.perard@xxxxxxxxxx> wrote:
>>> On Mon, Apr 24, 2023 at 07:02:46AM +0100, Luca Fancellu wrote:
>>>> diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
>>>> index ddc7b2a15975..1e69dac2c4fa 100644
>>>> --- a/tools/libs/light/libxl_arm.c
>>>> +++ b/tools/libs/light/libxl_arm.c
>>>> @@ -211,6 +213,12 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
>>>>        return ERROR_FAIL;
>>>>    }
>>>> 
>>>> +    /* Parameter is sanitised in libxl__arch_domain_build_info_setdefault 
>>>> */
>>>> +    if (d_config->b_info.arch_arm.sve_vl) {
>>>> +        /* Vector length is divided by 128 in struct 
>>>> xen_domctl_createdomain */
>>>> +        config->arch.sve_vl = d_config->b_info.arch_arm.sve_vl / 128U;
>>>> +    }
>>>> +
>>>>    return 0;
>>>> }
>>>> 
>>>> @@ -1681,6 +1689,26 @@ int 
>>>> libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
>>>>    /* ACPI is disabled by default */
>>>>    libxl_defbool_setdefault(&b_info->acpi, false);
>>>> 
>>>> +    /* Sanitise SVE parameter */
>>>> +    if (b_info->arch_arm.sve_vl) {
>>>> +        unsigned int max_sve_vl =
>>>> +            arch_capabilities_arm_sve(physinfo->arch_capabilities);
>>>> +
>>>> +        if (!max_sve_vl) {
>>>> +            LOG(ERROR, "SVE is unsupported on this machine.");
>>>> +            return ERROR_FAIL;
>>>> +        }
>>>> +
>>>> +        if (LIBXL_SVE_TYPE_HW == b_info->arch_arm.sve_vl) {
>>>> +            b_info->arch_arm.sve_vl = max_sve_vl;
>>>> +        } else if (b_info->arch_arm.sve_vl > max_sve_vl) {
>>>> +            LOG(ERROR,
>>>> +                "Invalid sve value: %d. Platform supports up to %u bits",
>>>> +                b_info->arch_arm.sve_vl, max_sve_vl);
>>>> +            return ERROR_FAIL;
>>>> +        }
>>> 
>>> You still need to check that sve_vl is one of the value from the enum,
>>> or that the value is divisible by 128.
>> 
>> I have probably missed something, I thought that using the way below to
>> specify the input I had for free that the value is 0 or divisible by 128, is 
>> it
>> not the case? Who can write to b_info->arch_arm.sve_vl different value
>> from the enum we specified in the .idl?
> 
> `xl` isn't the only user of `libxl`. There's `libvirt` as well. We also
> have libxl bindings for several languages.

Right, this point wasn’t clear to me, I will add the check there, thank you
for the explanation.

> There's nothing stopping a
> developer to write a number into `sve_vl` instead of choosing one of the
> value from the enum. I think we should probably sanitize any input that
> comes from outside of libxl, that's probably the case, I'm not sure.
> 
> So if valid values for `sve_vl` are only numbers divisible by 128, and
> some other discrete numbers, then we should check that they are, or
> check that the value is one defined by the enum.
> 
> Cheers,
> 
> -- 
> Anthony PERARD


 


Rackspace

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