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

Re: [PATCH] x86/domain: adjust limitation on shared_info allocation below 4G


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Wed, 4 Feb 2026 09:41:21 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=pGopkz/bIIEaSGdKEG5Vd+N5uBrmxdyBCJrzVRYlQfk=; b=gha+Bfirvdy2+yPbBPuPSWN+k8v+s4HDVaUcG8IQ6VCMMUr8T5gnRXzHh7jw3gXm89UQKr4xSlTQ3df3IGKy7sGhGty5Uv/MS4iKG9NjiWntrQjJbUjqXIwGUFfRVIGspJ2ZPpVdDAO8nlIklkQD46xeKUpvN3rPKWvJx3sDAzIfrrH9sFcmXVWcf/sIcb8prhlTNVmcXWZuSB7hcJRvJsuQdedsZC7T+rOK8/+JaHaVJp2VvQUfxpC3ok4vvov5WdBgKMyP+60ORYe4BZwMHtCwlnj0zF2aQSHKCMcH571/wy08JS6gUF0McSbgBANrsc1xmF4qMP/beylZW5Xg1A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MF5X7M5qRdz8SYZ7iErUCV0HUhP9cfdIWX1LGbgAfFO6UjPlJf2jrdixMFfkdvPgPUUBJ6ylRRL1x8kLeoVQiIf4p16f4S43nQTRd8PzkRSqYXeiMAc8zDLgOhN8YLeZCd4oT5BILqNxYje2/eE0f7fb6O0DY53BwuPhK6K4XcNVRJ0xdIJqcweMq9jFHxyqnUsI0FbWTUHfpJR2LSwmq3NAMG5H7cE+RkGTvdh/u5xTyULv5VWGqR/y1RW4uyrrft84v1s6MCIPT7EJ2Gq3nKr3091kyDPBhi/IgPciwuFIfKs7hWQQU70Hv4eMutem9dce5BxK+cW3KOTE3lwFyw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • Delivery-date: Wed, 04 Feb 2026 08:41:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 03/02/2026 10:20 am, Roger Pau Monné wrote:
> On Tue, Feb 03, 2026 at 11:10:17AM +0100, Roger Pau Monne wrote:
>> The limitation of shared_info being allocated below 4G to fit in the
>> start_info field only applies to 32bit PV guests.  On 64bit PV guests the
>> start_info field is 64bits wide.  HVM guests don't use start_info at all.
>>
>> Limit the allocation address restriction to 32bit PV guests only.
>>
>> Fixes: 3cadc0469d5c ("x86_64: shared_info must be allocated below 4GB as it 
>> is advertised to 32-bit guests via a 32-bit machine address field in 
>> start_info.")
>> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
>> ---
>>  xen/arch/x86/domain.c | 9 ++++++---
>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
>> index edb76366b596..4163568043b1 100644
>> --- a/xen/arch/x86/domain.c
>> +++ b/xen/arch/x86/domain.c
>> @@ -882,10 +882,13 @@ int arch_domain_create(struct domain *d,
>>          goto fail;
>>  
>>      /*
>> -     * The shared_info machine address must fit in a 32-bit field within a
>> -     * 32-bit guest's start_info structure. Hence we specify MEMF_bits(32).
>> +     * For 32bit PV guests the shared_info machine address must fit in a 
>> 32-bit
>> +     * field within the guest's start_info structure. Hence we specify
>> +     * MEMF_bits(32).
>>       */
>> -    if ( (d->shared_info = alloc_xenheap_pages(0, MEMF_bits(32))) == NULL )
>> +    if ( (d->shared_info =
>> +          alloc_xenheap_pages(0, is_pv_32bit_domain(d) ? MEMF_bits(32)
>> +                                                       : 0)) == NULL )
> Sorry, this is wrong, it's too early to know whether the domain is 32
> or 64bit.

It's probably fine to have this become an unrestricted xenhelp
allocation, and for switch_compat() to make a restricted allocation and
copy.

When constructing a PV32 guest in practice, the set_compat hypercall is
only moments after from the domain create, and it doesn't matter if we
discover lowmem exhaustion marginally later

That way we don't have a PV32-ism continuing to impact the all VMs.

~Andrew



 


Rackspace

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