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

Re: [PATCH] x86/xen: fix percpu vcpu_info allocation


  • To: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, x86@xxxxxxxxxx
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 27 Nov 2023 16:00:17 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=Ct7P1ZefeVRNmwR3+WVJwm8Vyg0MFXdJNKq8bsClr84=; b=e0YzO76KKeW3Wr7ONHBY7vBPm+utWGnFUdH9nPtCfKTOjCfHK2EIuMGVAW6GHQON39G4tCa7aFVb43ZOhUylfrwtQqoQdBR0Wucl2XiQbqKOSqRULt4MdGiWPY6Nd6q93fEZtxXGdfdaaRYHdy73XLmq89+NZTbnL2EbgVZioMd90CLkS1e7hW5cXHpIYMMYavV18rRYfYJfJs8uPePtSeb1SPOxgo6cq30sNfJy5JJmXWNf8w5ak2ga2PVikPjBGCapRY+S7Hbfx/mnMKoO/4YX3G7nad1oAsOIgBFgNI2TBITbWabM35JhshlJcn+5nu9d4elh2qHElUqw7G+2PQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eFOT0IVIqdWAGgZq2Ev0yAB/MGv2jseL8dLKPEwRiMKmk6yKLcTroRE27nd+d9O5VVFpa/To5ReVpadhL/MJKWmWquJJtApDQ138ldZ8LvT8/uTXQ/HekSMDFVxIOLKaFVLL3WWUGxaX3v5AS3aqtREybw6hUp0fG75G1DOYM6J6pK0vJYZki62yXTbN5qtGpE1f3r9yqFVjErcXR8K3WcJZ+EZ8OFtJAz9XT98Yvb0fEC7AP1TiqpXEl1uEYCPBrxJHYluS4Rcj/x6GiHDTKfvWtGezoQd713oqlN4YueQzlYcku2XjIKFrI907h6GpwTVCTeyiGF+Fa6DnpnfsOA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Juergen Gross <jgross@xxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx
  • Delivery-date: Mon, 27 Nov 2023 15:00:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxx>
> 
> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
> 
> 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);
> 




 


Rackspace

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