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

[PATCH v2 13/13] x86/shadow: adjust monitor table prealloc amount


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 30 Mar 2023 13:32:30 +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=X1l2fkRqRJiGKZyq0x1zbIscrbjHpZaIQjMcBMuPrbQ=; b=SDgh5ofhCzXCC3CvMd+3OGGiwuLTQtQrzDEfE81XBWe7BNvQ22uKi97miKVHm+/VShFr4KkakwHDS8ClmCJoFlLYLG38A3HrkMI67XkKDML7tQoJ+rvsGog4SlGHmHRpKALHBgRl7ViseXGjnrFj53O7pC1T3ufoFBfBmZvlzy7mmZMXVCYDVJLfPBqHEHZeyLPlsWRSmZi8JknDefRQFXbonZYQu7P0rvV49TAjT4KffGmWILWvQoGXPHoq95kd08pwkh+RyhmA2T4uAbQ+3A5xKpziYCuuxzIxWOTnbG1kK0b02HO63v9QWtgW8awkQk3IDSbc/++wN5echwWAPA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gh/ofto/1gHJ02qlDvJj6RD30SdIKBaldip+atea+Z4sxd41vbYa3PR8L79arSc1uphxUiW6C/t7bEmAlRoKQvvtUbG6YgazjSj0dntfl6w5z0gxCjbaqTpi6DGJBHhN4cPSBRAsthZqC40Io8s0J2L0KJ40LSO2dKHKcOUM1NQQbpasjK6CdxMt4WhiIDdPMU+EQODqySVTVlZJ8WvlBv7zsAzHym2mSdcd8GUb4YBsnOgutSCDG83ip5QhW7B6coN9uBIMVRv1Ew7R+QEek9Zh7HHohmnJ0pblLSh+qfvY6WxJTRU22ks2qP/6V9AOMMig07o+mv7Gde2dwCu6XQ==
  • 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: Thu, 30 Mar 2023 11:32:41 +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
@@ -738,7 +738,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®.