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

Re: [PATCH v2] xen/arm: p2m: Populate pages for GICv2 mapping in arch_domain_create()


  • To: Julien Grall <julien@xxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Date: Fri, 9 Dec 2022 22:18:12 +0000
  • Accept-language: en-GB, en-US
  • 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=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=4VvoiurTIRcFDyaJT1J6saju4JtfCw1P/3KaeTaG2ZA=; b=DcMP5/L6hQ1c15ED5Pe1FqyQ9pM0LPvaOQFjMKlzywk5q1Kvl5nWJ5Wpc+Sgwsf7e26w1FXHu8YVqmAiaT6i3ABmeCI4gzXmFKB2uzi75e31GKQLDfG81kIVH8vBkp1zQBy6BtyXajqL84iLkvfrkTVYsgHuOW2Hxg5UWv7GIgL6eC70D8CX4a0tnIt3B1KEpsKG5qTKOzjX5YVqNUDJPjEpy8BLdZ9mBnHd2Q/U3fbwhxP9ssTbsA7WUH0K3Z7XJHBL1ZHcTzeZ4g2hU+ObnZNb0oSHUeS2omNvkjylaqIa/6SgvFJOYStWqlKPV44hoC65qLDFO/eDI7ELKTpvUw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QgMfLqH1kKEGXvXCR/3mnAuCnaY3cfdVT+Ing3NpsQmKxrquqANWFH7XV+PAHqQzR4fNGDAGj5A2VNulQ1jQqAIp9TsfKLSQ0Lu+0Xyy2vOx9umOgB1iJ2foB7HidKJOo9pL7GL0wuoKvgxkWDxC7xAn2KfS9/+u7CHjowOBcwNiqZ3LH2bI58s1EJ6M1KKdxlTM504oefya70+XNPCwpQZjDPZrNUwbMuCLxsyZWiU6RFm4C4G2mkuLCMsNTw70ZJG01DPn6EKVTYKox0tTlaF/Ks9ZBZakNkRdaB3w8e0fwpzvMg2/47UOTJQCl6LWlp0uNdGl9OX4Wjka7dO64g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Wei Chen <Wei.Chen@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 09 Dec 2022 22:18:25 +0000
  • Ironport-data: A9a23:gSOdU6xLVlTzXCXCkNZ6t+e5xyrEfRIJ4+MujC+fZmUNrF6WrkUCy 2IaCGmCPfyONGv1c9F1a4Ww/U8A6pfQm9RiQVA++CAxQypGp/SeCIXCJC8cHc8wwu7rFxs7s ppEOrEsCOhuExcwcz/0auCJQUFUjP3OHfykTbaeYUidfCc8IA85kxVvhuUltYBhhNm9Emult Mj75sbSIzdJ4RYtWo4vw//F+U0HUMja4mtC5AVkPaET5zcyqlFOZH4hDfDpR5fHatE88t6SH 47r0Ly/92XFyBYhYvvNfmHTKxBirhb6ZGBiu1IOM0SQqkEqSh8ai87XAME0e0ZP4whlqvgqo Dl7WT5cfi9yVkHEsLx1vxC1iEiSN4UekFPMCSDXXcB+UyQq2pYjqhljJBheAGEWxgp4KUto9 vYyKy4kVCignuLnnb7ie8Nuuv12eaEHPKtH0p1h5RfwKK58BKvlGuDN79Ie2yosjMdTG/qYf 9AedTdkcBXHZVtIJ0sTD5U92uyvgxETcRUB8A7T+fVxvjeVkFIZPLvFabI5fvSjQ8lPk1nej WXB52njWTkRNcCFyCrD+XWp7gPKtXKjAdlLTePonhJsqH+onUc4NxxRb3iy+8fhgE6UR+xEa FNBr0LCqoB3riRHVOLVXQC8oXOClg4RXZxXCeJSwCGAzLDFpTmQAGcsRyRELtchsaceXic23 1WEm9foAz1Hs7CPT3+ZsLCOoluaEyUPMXULYyNCaAIf+sTiu6k6lBeJRdFmeIaKg9yzMjH9x RiDti14jLIW5eY10KG88UHCkiibjJHDRQ4o5S3aRmugqAh+YeaNd4GurFTW8/tEBIKYVUWa+ mgJndCE6+IDBo3LkzaCKNjhB5ms7veBdSba2FhmGsF78yz3oyL9O4dN/Dt5OUFldN4efiPka 1PSvgUX44JPOHytbul8ZIfZ59kW8JUM3O/NDpj8BueiqLAoHONb1EmCvXKt4l0=
  • Ironport-hdrordr: A9a23:0BmBg6NdOrAk38BcTnqjsMiBIKoaSvp037Dk7SFMoHtuA6qlfq GV7ZMmPHrP4gr5N0tMpTntAsW9qDbnhP1ICWd4B8bfYOCkghrUEGlahbGSvAEIYheOiNK1t5 0BT0EOMqyVMbEgt7eC3ODQKb9Jq+VvsprY59s2qU0DcegAUdAE0+4WMGim+2RNNXh7LKt8Op qAx9ZN4wGtcW4Qaa2AdwM4dtmGid3XtY7sJSULDR4/6AWIkFqTmcXHOind8BcCci9FhYwv+2 jdkwD/++GKvvyhxgXHvlWjn6h+qZ/OysZjGMfJsMQTJzn24zzYHLhcZw==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHY36RYpnqEmDBlDEOtMGFZEODQVK4NsO2AgAANc4CAAYyLAIBUWeeAgAKahgCAADmfAA==
  • Thread-topic: [PATCH v2] xen/arm: p2m: Populate pages for GICv2 mapping in arch_domain_create()

On 09/12/2022 18:51, Julien Grall wrote:
> Hi Henry,
>
> On 08/12/2022 03:06, Henry Wang wrote:
>> I am trying to work on the follow-up improvements about the Arm P2M
>> code,
>> and while trying to address the comment below, I noticed there was an
>> unfinished
>> discussion between me and Julien which I would like to continue and here
>> opinions from all of you (if possible).
>>
>>> -----Original Message-----
>>> From: Julien Grall <julien@xxxxxxx>
>>> Subject: Re: [PATCH v2] xen/arm: p2m: Populate pages for GICv2
>>> mapping in
>>> arch_domain_create()
>>>>> I also noticed that relinquish_p2m_mapping() is not called. This
>>>>> should
>>>>> be fine for us because arch_domain_create() should never create a
>>>>> mapping that requires p2m_put_l3_page() to be called.
>>
>> For the background of the discussion, this was about the failure path of
>> arch_domain_create(), where we only call p2m_final_teardown() which does
>> not call relinquish_p2m_mapping()...
> So all this mess with the P2M is necessary because we are mapping the
> GICv2 CPU interface in arch_domain_create(). I think we should
> consider to defer the mapping to later.
>
> Other than it makes the code simpler, it also means we could also the
> P2M root on the same numa node the domain is going to run (those
> information are passed later on).
>
> There is a couple of options:
>  1. Introduce a new hypercall to finish the initialization of a domain
> (e.g. allocating the P2M and map the GICv2 CPU interface). This option
> was briefly discussed with Jan (see [2])./
>  2. Allocate the P2M when populate the P2M pool and defer the GICv2
> CPU interface mapping until the first access (similar to how with deal
> with MMIO access for ACPI).
>
> I find the second option is neater but it has the drawback that it
> requires on more trap to the hypervisor and we can't report any
> mapping failure (which should not happen if the P2M was correctly
> sized). So I am leaning towards option 2.
>
> Any opinions?

A DOMCTL_creation_finished hypercall (name subject to improvement) is
mandatory for encrypted VM support in x86 (there's crypto needed at this
point to complete the measurement of the guest and create an attestation
report), so we are going to gain something to this effect one way or
another.

Such a hypercall also removes the giant bodge of using
domain_unpause_by_systemcontroller() for this purpose.

But it seems like ARM already has arch_domain_creation_finished() so you
can do 1) independently of adding a new hypercall.  x86 uses that hook
for hooking up the magic APICv sinc page into the p2m, so you're already
in good(?) company with a GIC bodge.


As to where the logic *should* be, it should be done in the hypercall(s)
where the toolstack is describing the guests phymap to Xen.  The fact
that these don't exist is yet another problem needing to be worked on.


That said, moving the creation side of things doesn't change the
teardown requirements.  When I get time to respin the fault_ttl series,
Gitlab CI will be able to demonstrate the bug I keep on telling you is
still there, the fix for which is taking the patch I already wrote for
you.  There is no correct way to move the final loop out of
complete_domain_destroy(), even if in the general case you can make it
more preemptible by moving the allocation later.

~Andrew

 


Rackspace

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