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

Re: [PATCH] x86/pv: Unhide writes to d->arch.hv_compat_vstart


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Grygorii Strashko <grygorii_strashko@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Tue, 9 Dec 2025 17:38:10 +0000
  • 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=gkh1pdtp1x4e61u7RWbb61F2fvGqnoEAivM7WAwuyT8=; b=G9aRRBHkRe+Gb9f875nAgo8buwpIZ0tDFFLJ6q+OiO7SutFWk+9gRRnfsPp4odIYwbSEnsgm9iPIP6zuZceNQdGGh1aYwQLtYzYbw0zKKqoq1dROoXgmrMv2JdLq4kwxxIH64lDkADdFdCNDT89XmBL1CxkKt4L5UhqBlzIDtUqhhwx1ccf7DqFN7XMZObM+bh2HrXkqgCb8Ov6oQNLlVwWYgC16Pr9Eku7ItUOeqG/s9+49MdYVLQkSZmuyTOzPr/GDvoicOqNcUNY/YgWT3KWJDeLvDJEot2ejjecee3xT2DUPniOPBnIlHe6y0RVUA05tNdMOc7Bgj41mfIDuUA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=k1JchBy4oI/ONZ6lpzhFqh1vOJuJL8rN4QonRuFq6SQdgm81i3dwN38gURpqwa4SbsuOHP9Nhrc6TjyVIk/d2Unn0kGPfMZm9HYKKuYr2YwK589X8wo2+4XL4Vd5ck0z5qb3u6hE7BCERa/TX8YvLlg3olS0nZvygtKRNEJEzmak9kQeyfGz7pzPAv92mnC6lGaGj3EUgTmuJ2TgcHkx2E55Dc8RsQADeuswGAQfYfuYR5fkFHyidow+bwQNow0FJ1oh4JiOUSuMNEEmggMqPz8TreYKLEwy3fXnQONfNydlp1viexUAzfllWXrChmrUWyBbsSxhxaXkFVfbWC7pSg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: andrew.cooper3@xxxxxxxxxx, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 09 Dec 2025 17:38:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 09/12/2025 4:42 pm, Jan Beulich wrote:
> On 09.12.2025 17:06, Grygorii Strashko wrote:
>> On 09.12.25 17:57, Andrew Cooper wrote:
>>> --- a/xen/arch/x86/domain.c
>>> +++ b/xen/arch/x86/domain.c
>>> @@ -891,7 +891,7 @@ int arch_domain_create(struct domain *d,
>>>       d->arch.emulation_flags = emflags;
>>>   
>>>   #ifdef CONFIG_PV32
>>> -    HYPERVISOR_COMPAT_VIRT_START(d) =
>>> +    d->arch.hv_compat_vstart =
>>>           is_pv_domain(d) ? __HYPERVISOR_COMPAT_VIRT_START : ~0u;
>>>   #endif
>> Any chances it can be moved in pv_domain_initialise()?
> Probably, but one thing at a time? The field itself would also want to move
> from struct arch_domain to struct pv_domain, I think.

Agreed to one thing at a time.

The value itself is a total mess.  Storage exists based on CONFIG_PV32,
with 0 yielded in !PV32 builds.

Yet, in CONFIG_PV32 builds, it has the value 0xF5800000 for PV domains,
and 0xFFFFFFFF for HVM domains. 

This is nonsense, causing e.g. COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT() to
return answers at opposite ends of the pagetable for non-PV32 VMs
depending on CONFIG_PV32.  I think this all works because the logic is
behind suitable is_pv32_$FOO() checks, but it's far from clear.

It is only a PV32 dom0 which can have this set to anything besides
0xF5800000, so the "correct" thing to do would be to leave it 0 in
domain create, and set it to 0xF5800000 in switch_compat(), along with
the custom setup in dom0_construct().

But, lets get the d->arch.physaddr_bitsize adjustments sorted first
before conflicting those with this change.

~Andrew



 


Rackspace

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