[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 05/12] arm/sve: save/restore SVE context switch
- To: Luca Fancellu <Luca.Fancellu@xxxxxxx>
- From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
- Date: Thu, 20 Apr 2023 08:33:18 +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=IvpCEQ0WeMAYJbTx3wkz02Zg2UNJAx0Run0ZkNj+LAE=; b=AlDY5iWwvWve462+WXeEKoXYC9uxBbe3iNsfixYyk67eRQ6kbzbmLcDx7WAGivD/t+atn3Qu0+XN3dpo00bJ8WufaOjyH9hI80raE+fA5hYKAr9xmKJZKQrfMOTthBCTrcfcdNmyiZ1Np05SoEGTbChjQBQbGbsRDdtcLyYAuYmHW0w6Gtpe4m5em7pw9RJ1i1xCvmvgCfi47f4GfcWjMm5DTupNC14DySGK/MnGpvXt3pjr+eA4Ppu34WSULuHenbOakxudXIh4lWo9PRK3Y6yavgdFuGtsNjSDIQCdCF0rIf+fa6BCpne+vs8zfUIDm7TRwlKtrLe74kvhVUWTDg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J+5jCV9p1l0IijFPj/le/l8MkPi5DyDmGCzdx9HeNWVViK+MHEY7JJEo7NtwVoJNXfj9nqTqvEoT+xc3JrOYfSluWr34Lq8qVpZC5uoKBYeo75TyaMvCjg8QlNA8oaQHBOgXL69jo+51wme8UrZ/HDUuvldtNbWzXKzdDF9KienhWabgj6jbksCrnWMdZx8hdP6nZHmoUhTq3GA4WKF1qk0y7jH963wqqJESAnAeDl/oPy10+0ZkhWf9D8gsYyNdD/Qe8RwK0VwoWl1CLi6+amlbpzd6ipEmmHizYbGJq16pdl9mbJnMrxrLVRK+2/1qDOCykpbBpayfZSu1Pt3lwg==
- 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>, Wei Chen <Wei.Chen@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Thu, 20 Apr 2023 08:33:54 +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: AQHZbSQq1oowf9vRd0a2ZPNGYXQmqK8xC64AgAE14QCAAAESAIABmpCAgAADSgCAAAEcAIAACZgA
- Thread-topic: [PATCH v5 05/12] arm/sve: save/restore SVE context switch
Hi Luca,
> On 20 Apr 2023, at 09:58, Luca Fancellu <Luca.Fancellu@xxxxxxx> wrote:
>
>>>
>>> Hi Bertrand,
>>>
>>> These are the changes I’m doing to this patch to address your comment, are
>>> you ok with them?
>>>
>>> diff --git a/xen/arch/arm/arm64/sve.c b/xen/arch/arm/arm64/sve.c
>>> index f0eab18dc384..1fef466ba0aa 100644
>>> --- a/xen/arch/arm/arm64/sve.c
>>> +++ b/xen/arch/arm/arm64/sve.c
>>> @@ -91,35 +91,35 @@ int sve_context_init(struct vcpu *v)
>>> if ( !ctx )
>>> return -ENOMEM;
>>>
>>> - v->arch.vfp.sve_context = ctx;
>>> + /* Point to the end of Z0-Z31 memory, just before FFR memory */
>>> + v->arch.vfp.sve_zreg_ctx_end = ctx +
>>> + (sve_zreg_ctx_size(sve_vl_bits) / sizeof(uint64_t));
>>>
>>> return 0;
>>> }
>>>
>>> void sve_context_free(struct vcpu *v)
>>> {
>>> - XFREE(v->arch.vfp.sve_context);
>>> + unsigned int sve_vl_bits = sve_decode_vl(v->domain->arch.sve_vl);
>>> +
>>> + /* Point back to the beginning of Z0-Z31 + FFR memory */
>>> + v->arch.vfp.sve_zreg_ctx_end = v->arch.vfp.sve_zreg_ctx_end -
>>> + (sve_zreg_ctx_size(sve_vl_bits) / sizeof(uint64_t));
>>
>> Please use a local variable here instead.
>>
>> For the rest all good yes, it makes the save/restore code simpler :-)
>>
>
> I did at the beginning, but then I realised XFREE would set to NULL the local
> variable instead,
> I could open code it and call xfree on the local variable and put
> v->arch.vfp.sve_zreg_ctx_end
> to NULL afterwards, but Julien asked me to use XFREE.
>
> What is your preference here?
>
I did not realised XFREE was actually also setting it to NULL.
Then i would keep your code but use -= instead.
Cheers
Bertrand
|