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

Re: Ping: [PATCH v2 8/8] Arm/optee: don't open-code xzalloc_flex_struct()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Tue, 4 May 2021 23:49:44 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.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-SenderADCheck; bh=qc+HixMJxamX3swsunGRJaTdq8WZhDGUY8qU1/TMy/c=; b=AJCppXvBabdy3Ty5h4iDsNGpNQioThcDvrYsOAJPdJz0PsT2sfQZcFNp0dpnZxq0yKMxyDIAOqDlUK8Pv9jFJguWvaTG0Ip/6Z6ejez0Gvtiaf5IaSCbx/BWbkOnok4Kj/Xs4Jb9TTLUfO3i9rRN6VTod/zWs9InaEbq4XNRW73r21xbRKm6gf1GFxpsT+ikAbeZBhl1s9u8XU7anK+R4MBkBGrMGT/4CZPpBxdHwPewu1f9VNLaN1IDAFWmKUIBZg5v54BrZiUwVe4tafdLB4KTUko+4VAMdfZClNHorvitiCUmjkFtybTqmr6JNOGFrRRfYgWvZZ8X4OVr08X8hg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NDyPnfcphszEVUaIt932EAhKfoupyLKZG7shGeeFGsMgLVoxqjx65CT8SMnEwbeh3Z0CBppNx6LhCM5e6YCtJJv/dUsfcGY9YM0elIHzOnQZBJxajhN8eKMztQI4oLveQ/R65eoU/p2LrNUBHRv6PcXpmGd1B2xusdfZzp2p05jS9Cq/MvfZQZRTqSZQjyOPljTzTFTWZ7YaKMfzdq8QDYfe6Enqeo7q5wYQ9UvYnAsBIfEq3GkfqKjARpFvzuHzmt9NZ0BNv3Q7YHAEmDsaiPjalnmd79Doe8EZAvDgjdIso00GCP1FUnyFnWg6Qj1gisI0GUfzkJGwEV+4dCUGCw==
  • Authentication-results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=epam.com;
  • Cc: George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 04 May 2021 23:50:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHXNr8I7//bY0jNu0uR6+4GJdDAWKrR2dcAgAI4+wA=
  • Thread-topic: Ping: [PATCH v2 8/8] Arm/optee: don't open-code xzalloc_flex_struct()

Hi Jan,

Jan Beulich writes:

> On 21.04.2021 16:59, Jan Beulich wrote:
>> The current use of xzalloc_bytes() in optee is nearly an open-coded
>> version  of xzalloc_flex_struct(), which was introduced after the driver
>> was merged.
>> 
>> The main difference is xzalloc_bytes() will also force the allocation to
>> be SMP_CACHE_BYTES aligned and therefore avoid sharing the cache line.
>> While sharing the cache line can have an impact on the performance, this
>> is also true for most of the other users of x*alloc(), x*alloc_array(),
>> and x*alloc_flex_struct(). So if we want to prevent sharing cache lines,
>> arranging for this should be done in the allocator itself.
>> 
>> In this case, we don't need stricter alignment than what the allocator 
>> provides. Hence replace the call to xzalloc_bytes() with one of
>> xzalloc_flex_struct().
>> 
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>> Signed-off-by: Julien Grall <julien@xxxxxxx>
>> ---
>> v2: Use commit message very close to what was suggested by Julien.
>
> I realize I forgot to Cc you on the v2 submission, but I didn't hear
> back on v1 from you either. May I ask for an ack or otherwise?

You already had discussion on v1, so I just wanted to see how it will
conclude before stepping in.

I'm fine with this change:

Acked-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>

>
>> --- a/xen/arch/arm/tee/optee.c
>> +++ b/xen/arch/arm/tee/optee.c
>> @@ -529,8 +529,7 @@ static struct optee_shm_buf *allocate_op
>>      while ( unlikely(old != atomic_cmpxchg(&ctx->optee_shm_buf_pages,
>>                                             old, new)) );
>>  
>> -    optee_shm_buf = xzalloc_bytes(sizeof(struct optee_shm_buf) +
>> -                                  pages_cnt * sizeof(struct page *));
>> +    optee_shm_buf = xzalloc_flex_struct(struct optee_shm_buf, pages, 
>> pages_cnt);
>>      if ( !optee_shm_buf )
>>      {
>>          err_code = -ENOMEM;
>> 
>> 


-- 
Volodymyr Babchuk at EPAM


 


Rackspace

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