[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: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
- From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
- Date: Thu, 20 Apr 2023 07:58:48 +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=irotP6+UbtqFU53+Q4mHgUkGGsv/vRCZx313XL/vIlc=; b=QjRntaNrUURCd6zEzTJIFaJQniVV3kOm9DSoO6pphCtuI/SrJ7LS5m0zt4jnXHljkv1FDdbY/tMEhJqjdFRJgsFAdg+JVrBgEnVmlq05RwKNLFF4rDZcnM3edQgBcudW0zpb3BSGUnTMuk2yuURZmCoICmJ/Ol+Rds6KZkNfI169OkHnmEOZfecqHtNV1WOBAePqroxbdwcPTZ47vpU7QrYf/MOn+3OQZN9acCV2syiSiWZODJHqaC2I2RC1G27DU62q9KEQzCnL1b7d4QhhzwpOJs1UJWFSqRZWmpu/Ohf6D5GBMp4siwvCSd2bE++h9sp3ZP+wXzktVwn6YfxklQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gzAn80FGNgSxdWHW0jhx74bEbiAWZq9NuZEpRWUTeq6EHZTPEgtSE3Rl7YmukGY0S32jicnPdCL07IFar4O8hpQDJ8YXld0AjmlVbHFvhN1Pn2B1PcaF6KMdu4v+uHGPXSop/00nxoVOpbBz9x16EafZsgQ41KKvGb8/1T2UN5f+nOXENccAzSFTX5G20MJaAm4g3RAsGhuyynTagKyhq14BV3fi2FMio/Lu0Ho9LTDiknuPtEMen2bYIfhjS6GBGAJgjsrKj4H0RosK1RSxvDPKuf8xt/RZy+0W+m9whup10i4GwGmFpKAEc0dVnep7NfeEAyogjpc75mZZZEkkiw==
- 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 07:59:09 +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: AQHZbSQ26+FC1T02dEGoq+zimN/6Ra8xC6+AgAE104CAAAEsgIABmneAgAADY4CAAAEDAA==
- Thread-topic: [PATCH v5 05/12] arm/sve: save/restore SVE context switch
>>
>> 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?
|