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

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


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Mon, 24 Apr 2023 14:57:04 +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=pKD+Fyz15gU9iw9drqZOddrYVIxIps9dxcfAe7g8E+g=; b=cgQOu8dQEaYLpfDAfn/7rlMidiiVVjJF2+BvJo3zdNutLL2Ph9gyWmG3qSFvaNaMu0UNnSWWGkELuq8rWJQMBIZxnSxkzEFtFj+qYJ8LawZlrcB5DxXX53g/92HmLh/3WDGFbyaef0+sjWKZlEpNy879o8/jKX1be0QG6huz7Xh5Xb4P5p0vUmCLBrp85gZD4OEnfE8HjmU2rSgnqKHeXxYHi8pEa4VJqvsqbGfOLh2PZN1XGW4lrYUXoZW4rm/0Fq/shs2hkqI/G0phuAY6u8vhz8WwzCMy0TMWXXyNfMSjCx43jy/PCLyzqDIXeEongXl0Mz1b1rBbWRljKhI65w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e3UbRblaaS77f8/KRVbZigMDycp6R7x9N4sn2Gn8TTmUhp19b6pZKpPNdQn0ps/2NMboOk722dM36ui9J2LBsCiRVsJAPYlMj+2BzLCWsz1zXyRgOyGCFSgU994oh7MF6/pihe6BYxoF8Mt3fAuAfuMvxiXVPbpx2x4+lGqExf8tyMQ15xLKl/bGnZPJKqgbi2//2E12lQ0kvFS8D9kxNrNGYBpO2F5kfmIOCQCGzkX3Ml2Yc0mDEKVNFUvDpqIDvNFX5Ku+LVPCQpZI63+Rw0T0mEybXCD7Ib4fHbstrqcmW/ql63CrJulmoIILy6jxDNfKnPkuWVfZc4Nhr2iLWw==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, 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>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 24 Apr 2023 14:57:40 +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: AQHZdnKG11PjGcmQuE2MpJrElBiS3686VJGAgAAo1ICAAAFsAIAADk4A
  • Thread-topic: [PATCH v6 07/12] xen: enable Dom0 to use SVE feature


> On 24 Apr 2023, at 15:05, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> On 24.04.2023 16:00, Luca Fancellu wrote:
>>> On 24 Apr 2023, at 12:34, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>> On 24.04.2023 08:02, Luca Fancellu wrote:
>>>> @@ -30,9 +37,11 @@ int sve_context_init(struct vcpu *v);
>>>> void sve_context_free(struct vcpu *v);
>>>> void sve_save_state(struct vcpu *v);
>>>> void sve_restore_state(struct vcpu *v);
>>>> +bool sve_domctl_vl_param(int val, unsigned int *out);
>>>> 
>>>> #else /* !CONFIG_ARM64_SVE */
>>>> 
>>>> +#define opt_dom0_sve     (0)
>>>> #define is_sve_domain(d) (0)
>>>> 
>>>> static inline register_t compute_max_zcr(void)
>>>> @@ -59,6 +68,11 @@ static inline void sve_context_free(struct vcpu *v) {}
>>>> static inline void sve_save_state(struct vcpu *v) {}
>>>> static inline void sve_restore_state(struct vcpu *v) {}
>>>> 
>>>> +static inline bool sve_domctl_vl_param(int val, unsigned int *out)
>>>> +{
>>>> +    return false;
>>>> +}
>>> 
>>> Once again I don't see the need for this stub: opt_dom0_sve is #define-d
>>> to plain zero when !ARM64_SVE, so the only call site merely requires a
>>> visible declaration, and DCE will take care of eliminating the actual call.
>> 
>> I’ve tried to do that, I’ve put the declaration outside the ifdef so that it 
>> was always included
>> and I removed the stub, but I got errors on compilation because of undefined 
>> function.
>> For that reason  I left that change out.
> 
> Interesting. I don't see where the reference would be coming from.

Could it be because the declaration is visible, outside the ifdef, but the 
definition is not compiled in? 

>>>> --- a/xen/common/kernel.c
>>>> +++ b/xen/common/kernel.c
>>>> @@ -314,6 +314,31 @@ int parse_boolean(const char *name, const char *s, 
>>>> const char *e)
>>>>    return -1;
>>>> }
>>>> 
>>>> +int __init parse_signed_integer(const char *name, const char *s, const 
>>>> char *e,
>>>> +                                long long *val)
>>>> +{
>>>> +    size_t slen, nlen;
>>>> +    const char *str;
>>>> +    long long pval;
>>>> +
>>>> +    slen = e ? ({ ASSERT(e >= s); e - s; }) : strlen(s);
>>> 
>>> As per this "e" may come in as NULL, meaning that ...
>>> 
>>>> +    nlen = strlen(name);
>>>> +
>>>> +    /* Check that this is the name we're looking for and a value was 
>>>> provided */
>>>> +    if ( (slen <= nlen) || strncmp(s, name, nlen) || (s[nlen] != '=') )
>>>> +        return -1;
>>>> +
>>>> +    pval = simple_strtoll(&s[nlen + 1], &str, 0);
>>>> +
>>>> +    /* Number not recognised */
>>>> +    if ( str != e )
>>>> +        return -2;
>>> 
>>> ... this is always going to lead to failure in that case. (I guess I could
>>> have spotted this earlier, sorry.)
>>> 
>>> As a nit, I'd also appreciate if style here (parenthesization in particular)
>>> could match that of parse_boolean(), which doesn't put parentheses around
>>> the operands of comparison operators (a few lines up from here). With the
>>> other function in mind, I'm then not going to pick on the seemingly
>>> redundant (with the subsequent strncmp()) "slen <= nlen", which has an
>>> equivalent there as well.
>> 
>> You are right, do you think this will be ok:
> 
> It'll do, I guess.
> 
>> --- a/xen/common/kernel.c
>> +++ b/xen/common/kernel.c
>> @@ -324,11 +324,14 @@ int __init parse_signed_integer(const char *name, 
>> const char *s, const char *e,
>>     slen = e ? ({ ASSERT(e >= s); e - s; }) : strlen(s);
>>     nlen = strlen(name);
>> 
>> +    if ( !e )
>> +        e = s + slen;
>> +
>>     /* Check that this is the name we're looking for and a value was 
>> provided */
>> -    if ( (slen <= nlen) || strncmp(s, name, nlen) || (s[nlen] != '=') )
>> +    if ( slen <= nlen || strncmp(s, name, nlen) || s[nlen] != '=' )
>>         return -1;
>> 
>> -    pval = simple_strtoll(&s[nlen + 1], &str, 0);
>> +    pval = simple_strtoll(&s[nlen + 1], &str, 10);
>> 
>>     /* Number not recognised */
>>     if ( str != e )
>> 
>> 
>> Please note that I’ve also included your comment about the base, which I 
>> forgot to add, apologies for that.
>> 
>> slen <= nlen doesn’t seems redundant to me, I have that because I’m 
>> accessing s[nlen] and I would like
>> the string s to be at least > nlen
> 
> Right, but doesn't strncmp() guarantee that already?

I thought strncmp() guarantees s contains at least nlen chars, meaning from 0 
to nlen-1, is my understanding wrong?

> 
> Jan



 


Rackspace

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