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

[PATCH v2 2/5] x86/paging: drop set-allocation from final-teardown


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 9 Jan 2023 14:39:52 +0100
  • 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=qCeUlm4/DsmO3G3gcntNt7cjbvdyT3iGeg4tOoUssFE=; b=Mb28XGvCoXUrcF1+Lw16yDhoZmXYAcfjSlEQK9Q9E9/7QkQ6VL84YzTOuRTmnmxNGgzYx58HTUZcdMdVGw3LK397B4UGXJ0SxAQ1lKxNhYSw1VFxwQEtOVG9sIfQfVKktS5UffBB3HKpuOtY61vkRuRxHn5KuZcMEK63+vqkt/8C2H7rbFNrYQrsakeq/N9EUWjPe2eeHj9XTpOU4znF7W/Ae+PALX26xWXRFs2HyyOFFxWsqfw05bffkg+e+MIOnZFnw7/zRmeJwYFtC17tF4EKzUU1PUgzaH/bdrDGQTgH6d1JILea/upUPDSqUIVsmNQNCj2mwqgS7adLaOzaIQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NIhcv3sj7hHMzNyVFwdLe1PWuBigcoIRGMpDC8tsMA/bODvEVSAaL27RqYaMEImUl13K4mpaxLlGbj/rmL52XmaVssCUuUWA/TTZkZb3yFTshLar+yv2ORSjothtefUNEebr4RVkJ5rmju1xgDE0zZUMWGUZaxvGPBttKwp+jkWM8LOPQ1O6cfmXRXYGdNoJwdE/wu/42364wwAj+d3emm0VeeBuxa5uGbxZQqe41ZQijNRkBuev5PqeYiegxtdZVo7vMsFOgSMt6rYyoOO8JRPXiO3x/N8+atwLovccpyQuBmMb2pwxfPlKIh8hJVCFoF9ps8Q/lCSaaY3oUXXA5A==
  • 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: Mon, 09 Jan 2023 13:40:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The fixes for XSA-410 have arranged for P2M pages being freed by P2M
code to be properly freed directly, rather than being put back on the
paging pool list. Therefore whatever p2m_teardown() may return will no
longer need taking care of here. Drop the code, leaving the assertions
in place and adding "total" back to the PAGING_PRINTK() message.

With merely the (optional) log message and the assertions left, there's
really no point anymore to hold the paging lock there, so drop that too.

Requested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
The remaining parts of hap_final_teardown() could be moved as well, at
the price of a CONFIG_HVM conditional. I wasn't sure whether that was
deemed reasonable.
---
v2: New.

--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -866,22 +866,13 @@ void paging_final_teardown(struct domain
     /* It is now safe to pull down the p2m map. */
     p2m_teardown(p2m_get_hostp2m(d), true, NULL);
 
-    /* Free any paging memory that the p2m teardown released. */
-    paging_lock(d);
-
-    if ( hap )
-        hap_set_allocation(d, 0, NULL);
-    else
-        shadow_set_allocation(d, 0, NULL);
-
-    PAGING_PRINTK("%pd done: free = %u, p2m = %u\n",
-                  d, d->arch.paging.free_pages, d->arch.paging.p2m_pages);
+    PAGING_PRINTK("%pd done: total = %u, free = %u, p2m = %u\n",
+                  d, d->arch.paging.total_pages,
+                  d->arch.paging.free_pages, d->arch.paging.p2m_pages);
     ASSERT(!d->arch.paging.p2m_pages);
     ASSERT(!d->arch.paging.free_pages);
     ASSERT(!d->arch.paging.total_pages);
 
-    paging_unlock(d);
-
     p2m_final_teardown(d);
 }
 




 


Rackspace

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