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

Re: [PATCH v5 07/12] xen: enable Dom0 to use SVE feature


  • To: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 19 Apr 2023 08:34:08 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=iv6XBxAGE7g6mX4Zf7J1MBL4jIBjwrJDI5W2QHdeuz0=; b=nX4msxL/LPVy5+o7PXgBFTCOG7UqAFZzYG6wnCvtJ39ypGW9BcOonTjFHLpoXunLomTPjWec53JohnFbRdd9AT7N2TNY4tLdFNn586sGlIDRkFfWe3tBWm/dD8ZfcI00HOYt7To2UuClyX3QYF9WrZx0v46TDZ/O7z+BssBWxCD45pxdlK3p5SJG4g8bUxYMEHWHNPKZd7nqrq3Brap1dpO8GbFn1LKIsWGvb9y259zw3iMOe5NK5MACouWBsEJTTnQE0DP2kqUCd6VBoGxdgCbFw/Ixt+OqFDB1xX4YLHsrguVIqDeOKUOXy/SUEf36pxxqqDhnzIeW6BUX+ks5tQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EmATe0gAi7pdiWwHuTfksl4bDpXDVlIiOui+1eHA7HJe4r6P37Ue23arT5g04ZopCdz/70UqQCnDHgqUPuRdzOI9aUDXCGnSJah0WN/TqPGOHU3ApZYlM+GcvfliqYSB3kavEsp3bMr2lFaD2VD291TSB1va0nwHn2KhMXNEZuFcwOgpgDfZMlNPF7CgIXQyE+QcG2qFaLkwbYOf/myERU5WR8/kf8HiHvIz/d2nRGfT3qrQBQQT+zpH+95HqhdnUhi7IQL5OD0FY5eXByXQnlnuMzfumOfmfwpgKuKfTV6ktDJcIw4ZsXthD9vbvRP7BzEvqRxsMyfPqo8YQm5S8Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Delivery-date: Wed, 19 Apr 2023 06:34:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 18.04.2023 14:47, Bertrand Marquis wrote:
>> On 12 Apr 2023, at 11:49, Luca Fancellu <Luca.Fancellu@xxxxxxx> wrote:
>> @@ -118,3 +121,21 @@ void sve_restore_state(struct vcpu *v)
>>
>>     sve_load_ctx(sve_ctx_zreg_end, v->arch.vfp.fpregs, 1);
>> }
>> +
>> +int __init sve_sanitize_vl_param(int val, unsigned int *out)
>> +{
>> +    /*
>> +     * Negative SVE parameter value means to use the maximum supported
>> +     * vector length, otherwise if a positive value is provided, check if 
>> the
>> +     * vector length is a multiple of 128 and not bigger than the maximum 
>> value
>> +     * 2048
>> +     */
>> +    if ( val < 0 )
>> +        *out = get_sys_vl_len();
>> +    else if ( ((val % SVE_VL_MULTIPLE_VAL) == 0) && (val <= 
>> SVE_VL_MAX_BITS) )
>> +        *out = val;
> 
> Shouldn't you also check if it is not greater than the maximum vector length ?

Perhaps not "also" but "instead", because the supported length shouldn't be
larger than SVE_VL_MAX_BITS (or if there was a risk that it might be, that
should be taken care of elsewhere, e.g. in get_sys_vl_len(), not here).

>> @@ -61,6 +62,21 @@ custom_param("dom0_mem", parse_dom0_mem);
>>
>> int __init parse_arch_dom0_param(const char *s, const char *e)
>> {
>> +    long long val;
>> +
>> +    if ( !parse_signed_integer("sve", s, e, &val) )
>> +    {
>> +#ifdef CONFIG_ARM64_SVE
>> +        if ( (val >= INT_MIN) && (val <= INT_MAX) )
>> +            opt_dom0_sve = val;
>> +        else
>> +            printk(XENLOG_INFO "'sve=%lld' value out of range!\n", val);
>> +#else
>> +        no_config_param("ARM64_SVE", "sve", s, e);
>> +#endif
> 
> Correct me if my understanding is wrong but here you just ignore the sve
> parameter if SVE is not supported by Xen ?
> 
> I am a bit wondering if we should not just refuse it here as the user might
> wrongly think that his parameter had some effect.
> 
> Or is it a usual way to handle this case ?

It is, or else we'd need to alter what no_config_param() does. Plus ignoring
the argument when !ARM64_SVE is no different from passing the same argument
to an older Xen version, or from passing any unknown one.

Jan



 


Rackspace

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