[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/4] x86/PV: properly set shadow allocation for Dom0
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Mon, 30 Aug 2021 15:03:44 +0200
- 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-SenderADCheck; bh=cxe0bKR24hXFw8oL69FTgKPiPaq5fBdyi4Hvj6JwhJU=; b=HkWCQLo2nvnk6rZtGQbFfYy9xt5umaUq0UG6NEt3wT8kmYXTCTgVGjFqEvJ3tr+AnKQqA2QL1nm1u0lQj9wQUMKW+x816HjrOPnXiQSu8rxaiCgbbp6ZY6FbfPeOikPtoZyvm/IYDVLkR9QZ5hLIyQ19tCGkCQmhtEtg756gNS0rDIECUs3sW2fh9LnOEgFBwsQddkVhd6Pxc5OO3ojg+SYB+WbOAvn936/8434SKq8fUcGXpigmRYNacFx0F+USI/NP4YQ54XRQwD8gR87FyB96v0RUrEB36M7j2nSGJ4T9Eiy7FJQssVobt362gJIXtjHoXMe0NrrGzVLvy+x0ww==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IWeB4F9zIiQoyGkaG1OeCefCZ7HyAfqW9oapo+ORPNLrBeJYtN8ShrOmxKrxYsO3XuR6T0OErfnZi6ZalZHJppN0v2RPjiaXMgBDlLQ2pMEi9LHtc3r4/yBcvexCF9TtXGym3J1M/t/XBztG6aX1zBm/FpISf9zfm7wDjLa/9Nn1Cx7lPq0RD1T9Yqfgmu+F+snL8xyRKnEfn9QKDENpgFeBHl62+NoNsZy435tVBqfSEdROgzZmY6CxhNVjwiJmYYEvNlqJFWJwvOljB11FwWMB/69UGWUD01UaOZtrGpSF96yVcC4bRNaDki48aqRBEHm9tmFg4kWQsjlKD0y5aA==
- Authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=suse.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>
- Delivery-date: Mon, 30 Aug 2021 13:03:51 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Leaving shadow setup just to the L1TF tasklet means running Dom0 on a
minimally acceptable shadow memory pool, rather than what normally
would be used (also, for example, for PVH). Populate the pool before
triggering the tasklet, on a best effort basis (again like done for
PVH).
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -1298,7 +1298,7 @@ int shadow_set_allocation(struct domain
{
struct page_info *sp;
- ASSERT(paging_locked_by_me(d));
+ ASSERT(paging_locked_by_me(d) || system_state < SYS_STATE_active);
if ( pages > 0 )
{
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -21,6 +21,7 @@
#include <asm/page.h>
#include <asm/pv/mm.h>
#include <asm/setup.h>
+#include <asm/shadow.h>
/* Allow ring-3 access in long mode as guest cannot use ring 1 ... */
#define BASE_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)
@@ -933,7 +934,17 @@ int __init dom0_construct_pv(struct doma
#ifdef CONFIG_SHADOW_PAGING
if ( opt_dom0_shadow )
{
+ bool preempted;
+
printk("Switching dom0 to using shadow paging\n");
+
+ do {
+ preempted = false;
+ shadow_set_allocation(d, dom0_paging_pages(d, nr_pages),
+ &preempted);
+ process_pending_softirqs();
+ } while ( preempted );
+
tasklet_schedule(&d->arch.paging.shadow.pv_l1tf_tasklet);
}
#endif
|