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

[PATCH] mem-sharing: move (x86) / drop (Arm) arch_dump_shared_mem_info()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 8 Aug 2023 14:02:15 +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=dDsmnaGASxToYZZz1o3iNQdkmcA5nYpDQhCG+xL1ORA=; b=T8vf/wmIe5U2DwfiUQfZ0WmcAMRjjmxOC4oRi0XNuSlQ0tiVgg8Vj4DvYQewjFdlcXoh831pdwl/doUuYddl0tCMYVhH93qEfS36jFrVB5IEnkeC+5h+J0hkEuf4ZFGbqS/emwm0R5kJq/ZDVUNQ4cdlSPyS6vuV+p0sus+dYWxIrdE/v/MeRDK4sswxVtkauHVbLQl4Z2suB/NBJVy04kfgmaOPZS7/ssvOBxtayWy9/dUXQSI77YP8KVG29pBhg6QhM1uhEdz/4JPkzOwf7QUa88aVftzuiFlloHuE8leeFmFoOxvNQEurWfDxLk17igdra+amn9D2gp0ipIxy6w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sneue+UY5J8HTHSuni2y+o4Hsz8BYG5who5PLvAhUdd33Bld8LOKC7ruqbJlRNjNaLvR8PGWwzB0oCZRcNv0gjoYeqr2FgfxCVm7c7f0k6nBcQZlXw4nO8kK4VmtYYe2CABHxWxfcAtpDoOx8KygDC3VCYOfgvsVMaN6NcFuz5ysk4p5ZV7lZy94Xs3H1RQVD84epP5hP/WmyGMWDjE1bxi8AbHeT2169MpFKAwci2kOuADUPbE1lW9T6BxZTpZ6+NqkCLlulTXzwXFDjNGUO7dm7hiC5lofkpnWAKp0Ss0NUMxLvm9Q00lMZuEeC8xlqqWCjLpCDLIQb6sIllGWPw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>
  • Delivery-date: Tue, 08 Aug 2023 12:02:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

When !MEM_SHARING no useful output is produced. Move the function into
mm/mem_sharing.c while conditionalizing the call to it, thus allowing to
drop it altogether from Arm (and eliminating the need to introduce stubs
on PPC and RISC-V).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
I wasn't really sure whether introducing a stub in xen/mm.h would be any
better than adding the (further) #ifdef to dump_domains().

We could go further and also eliminate the need for the stub variants
of mem_sharing_get_nr_{shared,saved}_mfns() by moving the
XENMEM_get_sharing_{shared,freed}_pages cases in
{,compat_}arch_memory_op() into the already existing #ifdef-s there.
Returning an error for those sub-ops may be slightly more appropriate
than returning 0 when !MEM_SHARING.

--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1297,10 +1297,6 @@ void free_init_memory(void)
     printk("Freed %ldkB init memory.\n", (long)(__init_end-__init_begin)>>10);
 }
 
-void arch_dump_shared_mem_info(void)
-{
-}
-
 int steal_page(
     struct domain *d, struct page_info *page, unsigned int memflags)
 {
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -6265,13 +6265,6 @@ void memguard_unguard_stack(void *p)
     map_pages_to_xen((unsigned long)p, virt_to_mfn(p), 1, PAGE_HYPERVISOR_RW);
 }
 
-void arch_dump_shared_mem_info(void)
-{
-    printk("Shared frames %u -- Saved frames %u\n",
-            mem_sharing_get_nr_shared_mfns(),
-            mem_sharing_get_nr_saved_mfns());
-}
-
 const struct platform_bad_page *__init get_platform_badpages(unsigned int 
*array_size)
 {
     u32 igd_id;
--- a/xen/arch/x86/mm/mem_sharing.c
+++ b/xen/arch/x86/mm/mem_sharing.c
@@ -2329,3 +2329,10 @@ int mem_sharing_domctl(struct domain *d,
 
     return rc;
 }
+
+void arch_dump_shared_mem_info(void)
+{
+    printk("Shared frames %u -- Saved frames %u\n",
+            mem_sharing_get_nr_shared_mfns(),
+            mem_sharing_get_nr_saved_mfns());
+}
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -365,7 +365,9 @@ static void cf_check dump_domains(unsign
         }
     }
 
+#ifdef CONFIG_MEM_SHARING
     arch_dump_shared_mem_info();
+#endif
 
     rcu_read_unlock(&domlist_read_lock);
 }



 


Rackspace

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