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

[PATCH v3 12/12] x86/shadow: adjust monitor table prealloc amount


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 16 May 2023 09:42:45 +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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=G0JVlC1dkAfZN2ajpySPkgKYU3aVrOZcOWe5A070b+Q=; b=A2jMq2941PMDA14/RasjE9ydKKRuX8go7nzytFKfpIgURIFqCGbugbmOzNWQWopvrdwUgB0AN32/KAnYnOMsxpmRGFbvRpXGXkL2gihcs/QgWU0e5R4l8r7odggkaT0DQc++3QsvP3aUrHjINoWSeW8tKdUTlDvBPx5k4LqXp80v+rzEu/1uMi/RiJs21vOpjbHgAM0q/dCRhv3K4QXXfETk93hD6CnA4xHe1VAkVVslESHTYDcmPVvE4J69VAo4boqzeQTp1HKjAkW/1aXQP+TprErsJ25QNfM1GeUcbrCxcwn+PkLbrZr9NR1CoybdnKM3EXzTyxIlX1De0wY5JA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uc/4rCqq9DWcdIKuGe5SoTI3rM/kqdcaQZ3qLUl0bZTDMkcHb63MJ0UCeJb2ubv58YcNNOLxnSBjlTLVO4GUxcknwHCwy3pItgfX2c2yIlC4yuJ3Sd9qLGdOQ3PuiXqREy7dCAmeI11Pe9LpMDVwSQbWaugdb1LwyEqTjwC1uGVsW1BYgDVzrL5aMO6DzN/17tFFr6/KNYLJ4/48n7eQo3iVl9C3hK2I3lxm+Si6t1YBdHrr/rb4gW3hCNKmglJefiHyUVcsIkA9M9TAnjw2zafJfmEGn0/PCU/IRX+xn3FopCkgWBJ4cngOvm7J2kyvfwnG1eZdUeZR96B3ysaYxw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>
  • Delivery-date: Tue, 16 May 2023 07:42:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

While 670d6b908ff2 ('x86 shadow: Move the shadow linear mapping for
n-on-3-on-4 shadows so') bumped the amount by one too little for the
32-on-64 case (which luckily was dead code, and hence a bump wasn't
necessary in the first place), 0b841314dace ('x86/shadow:
sh_{make,destroy}_monitor_table() are "even more" HVM-only'), dropping
the dead code, then didn't adjust the amount back. Yet even the original
amount was too high in certain cases. Switch to pre-allocating just as
much as is going to be needed.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -726,7 +726,7 @@ mfn_t sh_make_monitor_table(const struct
     ASSERT(!pagetable_get_pfn(v->arch.hvm.monitor_table));
 
     /* Guarantee we can get the memory we need */
-    if ( !shadow_prealloc(d, SH_type_monitor_table, CONFIG_PAGING_LEVELS) )
+    if ( !shadow_prealloc(d, SH_type_monitor_table, shadow_levels < 4 ? 3 : 1) 
)
         return INVALID_MFN;
 
     m4mfn = shadow_alloc(d, SH_type_monitor_table, 0);




 


Rackspace

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