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

Re: [PATCH 3/8] x86/paging: move update_paging_modes() hook


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Date: Thu, 5 Jan 2023 19:53:56 +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=fYJ4tDZPy7y5zf+0cJyZ+4IZankQAXIi/098J4yBmig=; b=RAzb1rd/Tt0g5yNmw4JdGdNvRVqvm/BZWmVMcC4o0aExQTmglKtL406tQUOYuTeXIy8RGngsEXTEF5xUVNsY4eARfQMFbc0frC+xOopXrMpO8tVSdRwvSt3vmntZtYSThRBpbg1rZtu25W4CiUXk/EMD44xMrBrf4dVksTjQXj9saxzaXZZ1vZ2fnUnPJqzfwBP1k1PS9J93Y8LjS8vVdmEajMbQUvBouzjbX+VNcqH4UqvT7o3vvIFk9jF0SRfvFV2Ua1Vt3LMLqBs0e3WmFnvxlqA8mEpl76gkmJ5ISuMB3vcpzuYJGNUvby5YkjBA6s9H2sGeB8QGy1io50aE7w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BjHFKosjOx/x+S9fXC5uTIJEUAXgW8hiR6biz8BAnZPiY3k9IisrgLtSxRWb6x/+mlT8QFZfMyRtAF1rt1f84cL0QoubN6RvDxOjhLIo+pKpa2CD9RVKOMJ4YxYgTyDNqIGxlsnFNlZ3E2FTR0kCGvUThadgNo+E/PL9OipsH55Fa2fwQluS/Amg3GijdIDPryNttNB+h9RuVs8cUW2J7GTNWWsRw3fPlbK541/eBB06lW80BMG6hynykuT5OS1z1fvi2705fv6j0GesJWmvDyNJSOO5yqYwDpTV6crEPxaNfdMo0EBDwP3V++oSJTuf6ejLLIi6PcnBppJv/m2VpA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxx>, "Tim (Xen.org)" <tim@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 05 Jan 2023 19:54:24 +0000
  • Ironport-data: A9a23:7t5sN6PseYxVTN7vrR2TlsFynXyQoLVcMsEvi/4bfWQNrUp31WBVz zQaWGrUa/nZa2agLtAgYdyz9E8Dv8fSyt42Gwto+SlhQUwRpJueD7x1DKtS0wC6dZSfER09v 63yTvGacajYm1eF/k/F3oDJ9CU6jufQA+KmU4YoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGj9SuvzrRC9H5qyo42tB5gFmPpingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0vxKGU9T+ tJbEx5TPjqyvcuk6+uaSdA506zPLOGzVG8ekldJ6GmDSM0AGNXESaiM4sJE1jAtgMwIBezZe 8cSdTtoalLHfgFLPVAUTpk5mY9EhFGmK2Ee9A3T+PVxvze7IA9ZidABNPL8fNCQSNoTtUGfv m/cpEzyAw0ANczZwj2Amp6prr6UzX+rAd1PfFG+3u9WnWyKw3QBMgBVCgqciqG4u2Kna+sKf iT4/QJr98De7neDTNPwQhm5q36spQMHVpxbFOhSwB6J4rrZ5UCeHGdsZiJAbfQ2uclwQiYlv neZktWsCTFxvbm9TXOG6qzSvT60ITISL2IJeWkDVwRt3jX4iIQ6jxaKVdA6Fqew1ofxAWuon 2/MqzUijbIOi8JNz7+84V3MnzOroN7OUxIx4QLUGGmi62uVebKYWmBh0nCDhd4oEWpTZgDpU KQs8yRG0N0zMA==
  • Ironport-hdrordr: A9a23:RX9hPKCmqgbJ/JnlHemV55DYdb4zR+YMi2TDtnoBMCC9F/bzqy nAppQmPHPP+VEssVsb6LO90dC7MBHhHP1Oj7X5X43SOTUO0VHAROpfBODZslnd8kPFh4hgPG RbH5SWyuecMbG3t6nHCcCDcuod/A==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHZFT/G4QjmyfM5nk+WhnK7qSG8yq54nRIAgADvdgCAFsfagA==
  • Thread-topic: [PATCH 3/8] x86/paging: move update_paging_modes() hook

On 22/12/2022 8:00 am, Jan Beulich wrote:
> On 21.12.2022 18:43, Andrew Cooper wrote:
>> On 21/12/2022 1:25 pm, Jan Beulich wrote:
>>> The hook isn't mode dependent, hence it's misplaced in struct
>>> paging_mode. (Or alternatively I see no reason why the alloc_page() and
>>> free_page() hooks don't also live there.) Move it to struct
>>> paging_domain.
>>>
>>> While there rename the hook and HAP's as well as shadow's hook functions
>>> to use singular; I never understood why plural was used. (Renaming in
>>> particular the wrapper would be touching quite a lot of other code.)
>> There are always two modes; Xen's, and the guest's.
>>
>> This was probably more visible back in the 32-bit days, but remnants of
>> it are still around with the fact that struct vcpu needs to be below the
>> 4G boundary for the PDPTRs for when the guest isn't in Long Mode.
>>
>> HAP also hides it fairly well given the uniformity of EPT/NPT (and
>> always 4 levels in a 64-bit Xen), but I suspect it will become more
>> visible again when we start supporting LA57.
> So does this boil down to a request to undo the rename? Or undo it just
> for shadow code (as the HAP function really does only one thing)? As to
> LA57, I'm not convinced it'll become more visible again then, but of
> course without actually doing that work it's all hand-waving anyway.

With LA57, HAP really does become 2 things.  Using a 5-level walk at the
HAP level is a prerequisite for being able to VMEntry with CR4.LA57 set,
on both Intel and AMD hardware IIRC.

Then, for VMs which don't elect to enable LA57, we will be in a 4-on-5
(to borrow the shadow terminology) situation.

The comment by paging_update_paging_modes() is fairly clear about this
operation being strictly related to guest state, which further
demonstrates that hap version playing with the monitor table is wrong.

>
>>> --- a/xen/arch/x86/mm/shadow/none.c
>>> +++ b/xen/arch/x86/mm/shadow/none.c
>>> @@ -27,6 +32,9 @@ int shadow_domain_init(struct domain *d)
>>>      };
>>>  
>>>      paging_log_dirty_init(d, &sh_none_ops);
>>> +
>>> +    d->arch.paging.update_paging_mode = _update_paging_mode;
>>> +
>>>      return is_hvm_domain(d) ? -EOPNOTSUPP : 0;
>> I know you haven't changed the logic here, but this hook looks broken. 
>> Why do we fail it right at the end for HVM domains?
> It's been a long time, but I guess my thinking back then was that it's
> better to put in place pointers which other code may rely on being non-
> NULL.

Any chance we could gain a /* set up pointers for safety, then fail */
then ?

~Andrew

 


Rackspace

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