lkml.org 
[lkml]   [2023]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] x86/xen: fix percpu vcpu_info allocation
From
On 27.11.2023 15:57, Boris Ostrovsky wrote:
>
>
> On 11/24/23 2:48 AM, Juergen Gross wrote:
>> Today the percpu struct vcpu_info is allocated via DEFINE_PER_CPU(),
>> meaning that it could cross a page boundary. In this case registering
>> it with the hypervisor will fail, resulting in a panic().
>>
>> This can easily be fixed by using DEFINE_PER_CPU_ALIGNED() instead,
>> as struct vcpu_info is guaranteed to have a size of 64 bytes, matching
>> the cache line size of x86 64-bit processors (Xen doesn't support
>> 32-bit processors).
>>
>> Fixes: 5ead97c84fa7 ("xen: Core Xen implementation")
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>
> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.con>
>
> although I am not sure in usefulness of BUILD_BUG_ON --- 64 bytes is part of ABI and hypervisor already has its own BUILD_BUG_ON for this.

I understood the check to guard against SMP_CACHE_BYTES < 64.

Jan

>> @@ -160,6 +163,7 @@ void xen_vcpu_setup(int cpu)
>> int err;
>> struct vcpu_info *vcpup;
>>
>> + BUILD_BUG_ON(sizeof(*vcpup) > SMP_CACHE_BYTES);
>> BUG_ON(HYPERVISOR_shared_info == &xen_dummy_shared_info);
>

\
 
 \ /
  Last update: 2023-11-27 16:00    [W:0.061 / U:1.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site