Skip to contentSkip to conversation

x86/xen: Do some Xen-PV related cleanups

PATCH New Juergen Gross 1 participant 4 messages May 22

Subsystems (3)
lore
Share & tools
lore

Juergen Gross

author maintainer
#0 lore raw

cover x86/xen: Do some Xen-PV related cleanups

Cleanups related to Xen PV mode.

Note that patch 3 might be debatable.

Juergen Gross (3):
x86/xen: Guard PV-only stuff in xen-ops.h with CONFIG_XEN_PV x86/xen: Cleanup Xen related trace points
x86/xen: Remove Xen debugfs support

 arch/x86/xen/Kconfig       |   7 --
 arch/x86/xen/Makefile      |   2 -
 arch/x86/xen/debugfs.c     |  16 ---
 arch/x86/xen/mmu_pv.c      |   8 ++
 arch/x86/xen/p2m.c         |  45 -------
 arch/x86/xen/xen-ops.h     | 242 ++++++++++++++++++-------------------
 include/trace/events/xen.h |  62 +---------
 7 files changed, 126 insertions(+), 256 deletions(-)
 delete mode 100644 arch/x86/xen/debugfs.c
Signature · 1 line
2.54.0
author maintainer
#1 lore raw

PATCH 1/3 x86/xen: Guard PV-only stuff in xen-ops.h with CONFIG_XEN_PV

A lot of arch/x86/xen/xen-ops.h is meant to be for PV only. Guard all of it with CONFIG_XEN_PV in order to avoid someone misusing it in non-PV builds. Additionally any 64-bit tests for now guarded items can be dropped.

Move the enum pt_level definition to mmu_pv.c, as it is used only there.

---
 arch/x86/xen/mmu_pv.c  |   8 ++
 arch/x86/xen/xen-ops.h | 240 ++++++++++++++++++++---------------------
 2 files changed, 123 insertions(+), 125 deletions(-)
arch/x86/xen/mmu_pv.c +8 -0
index 3eee5f84f8a7..cd80406be9c6 100644
@@ -84,6 +84,14 @@
 
 #include "xen-ops.h"
 
+enum pt_level {
+	PT_PGD,
+	PT_P4D,
+	PT_PUD,
+	PT_PMD,
+	PT_PTE
+};
+
 /*
  * Prototypes for functions called via PV_CALLEE_SAVE_REGS_THUNK() in order
  * to avoid warnings with "-Wmissing-prototypes".
arch/x86/xen/xen-ops.h +115 -125

327 lines not on this page · raw message

Signature · 1 line
2.54.0
author maintainer
#2 lore raw

PATCH 2/3 x86/xen: Cleanup Xen related trace points

In reply to Juergen Gross

Since dropping Xen-PV support for 32-bit, include/trace/events/xen.h contains several stale trace point definitions. Remove them.

---
 include/trace/events/xen.h | 62 ++------------------------------------
 1 file changed, 3 insertions(+), 59 deletions(-)
include/trace/events/xen.h +3 -59
index 0577f0cdd231..e3f139f0bc78 100644
@@ -129,9 +129,10 @@ TRACE_EVENT(xen_mc_extend_args,
 		      __entry->res == XEN_MC_XE_NO_SPACE ? "NO_SPACE" : "???")
 	);
 
-TRACE_DEFINE_SIZEOF(pteval_t);
 /* mmu */
-DECLARE_EVENT_CLASS(xen_mmu__set_pte,
+TRACE_DEFINE_SIZEOF(pteval_t);
+
+TRACE_EVENT(xen_mmu_set_pte,
 	    TP_PROTO(pte_t *ptep, pte_t pteval),
 	    TP_ARGS(ptep, pteval),
 	    TP_STRUCT__entry(
@@ -146,13 +147,6 @@ DECLARE_EVENT_CLASS(xen_mmu__set_pte,
 		      (int)sizeof(pteval_t) * 2, (unsigned long long)__entry->pteval)
 	);
 
-#define DEFINE_XEN_MMU_SET_PTE(name)				\
-	DEFINE_EVENT(xen_mmu__set_pte, name,			\
-		     TP_PROTO(pte_t *ptep, pte_t pteval),	\
-		     TP_ARGS(ptep, pteval))
-
-DEFINE_XEN_MMU_SET_PTE(xen_mmu_set_pte);
-
 TRACE_DEFINE_SIZEOF(pmdval_t);
 
 TRACE_EVENT(xen_mmu_set_pmd,
@@ -170,37 +164,6 @@ TRACE_EVENT(xen_mmu_set_pmd,
 		      (int)sizeof(pmdval_t) * 2, (unsigned long long)__entry->pmdval)
 	);
 
-#ifdef CONFIG_X86_PAE
-DEFINE_XEN_MMU_SET_PTE(xen_mmu_set_pte_atomic);
-
-TRACE_EVENT(xen_mmu_pte_clear,
-	    TP_PROTO(struct mm_struct *mm, unsigned long addr, pte_t *ptep),
-	    TP_ARGS(mm, addr, ptep),
-	    TP_STRUCT__entry(
-		    __field(struct mm_struct *, mm)
-		    __field(unsigned long, addr)
-		    __field(pte_t *, ptep)
-		    ),
-	    TP_fast_assign(__entry->mm = mm;
-			   __entry->addr = addr;
-			   __entry->ptep = ptep),
-	    TP_printk("mm %p addr %lx ptep %p",
-		      __entry->mm, __entry->addr, __entry->ptep)
-	);
-
-TRACE_EVENT(xen_mmu_pmd_clear,
-	    TP_PROTO(pmd_t *pmdp),
-	    TP_ARGS(pmdp),
-	    TP_STRUCT__entry(
-		    __field(pmd_t *, pmdp)
-		    ),
-	    TP_fast_assign(__entry->pmdp = pmdp),
-	    TP_printk("pmdp %p", __entry->pmdp)
-	);
-#endif
-
-#if CONFIG_PGTABLE_LEVELS >= 4
-
 TRACE_DEFINE_SIZEOF(pudval_t);
 
 TRACE_EVENT(xen_mmu_set_pud,
@@ -236,24 +199,6 @@ TRACE_EVENT(xen_mmu_set_p4d,
 		      (int)sizeof(p4dval_t) * 2, (unsigned long long)pgd_val(native_make_pgd(__entry->p4dval)),
 		      (int)sizeof(p4dval_t) * 2, (unsigned long long)__entry->p4dval)
 	);
-#else
-
-TRACE_EVENT(xen_mmu_set_pud,
-	    TP_PROTO(pud_t *pudp, pud_t pudval),
-	    TP_ARGS(pudp, pudval),
-	    TP_STRUCT__entry(
-		    __field(pud_t *, pudp)
-		    __field(pudval_t, pudval)
-		    ),
-	    TP_fast_assign(__entry->pudp = pudp;
-			   __entry->pudval = native_pud_val(pudval)),
-	    TP_printk("pudp %p pudval %0*llx (raw %0*llx)",
-		      __entry->pudp,
-		      (int)sizeof(pudval_t) * 2, (unsigned long long)pgd_val(native_make_pgd(__entry->pudval)),
-		      (int)sizeof(pudval_t) * 2, (unsigned long long)__entry->pudval)
-	);
-
-#endif
 
 DECLARE_EVENT_CLASS(xen_mmu_ptep_modify_prot,
 	    TP_PROTO(struct mm_struct *mm, unsigned long addr,
@@ -452,7 +397,6 @@ TRACE_EVENT(xen_cpu_set_ldt,
 		      __entry->addr, __entry->entries)
 	);
 
-
 #endif /*  _TRACE_XEN_H */
 
 /* This part must be outside protection */
Signature · 1 line
2.54.0
author maintainer
#3 lore raw

PATCH 3/3 x86/xen: Remove Xen debugfs support

In reply to Juergen Gross

The only Xen file in debugfs is for dumping the p2m table when running as a Xen PV guest. This might have been useful when the PV code was young, but there haven't been any p2m related bugs requiring the p2m dump since ages.

Remove the code and the related config option.

---
Kind of RFC, as there might be different opinions. The only time I have used the p2m dump was when I reworked the p2m coding more than 10 years ago.
An alternative would be to make CONFIG_XEN_DEBUG_FS dependant on CONFIG_XEN_PV and to fix the help text (it is completely wrong, as it enables neither statistics output, nor tuning options, nor is it relevant to performance at all - the only existing functionality isn't mentioned either).

---
 arch/x86/xen/Kconfig   |  7 -------
 arch/x86/xen/Makefile  |  2 --
 arch/x86/xen/debugfs.c | 16 ---------------
 arch/x86/xen/p2m.c     | 45 ------------------------------------------
 arch/x86/xen/xen-ops.h |  2 --
 5 files changed, 72 deletions(-)
 delete mode 100644 arch/x86/xen/debugfs.c
arch/x86/xen/Kconfig +0 -7
index aa4040fd9215..51b53ce66efb 100644
@@ -65,13 +65,6 @@ config XEN_PVHVM_GUEST
 	help
 	  Support running as a Xen PVHVM guest.
 
-config XEN_DEBUG_FS
-	bool "Enable Xen debug and tuning parameters in debugfs"
-	depends on XEN && DEBUG_FS
-	help
-	  Enable statistics output and various tuning options in debugfs.
-	  Enabling this option may incur a significant performance overhead.
-
 config XEN_PVH
 	bool "Xen PVH guest support"
 	depends on XEN && XEN_PVHVM && ACPI
arch/x86/xen/Makefile +0 -2
index a9ec8c9f5c5d..717264ae269b 100644
@@ -43,8 +43,6 @@ obj-$(CONFIG_XEN_PVHVM_SMP)  	+= smp_hvm.o
 
 obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o
 
-obj-$(CONFIG_XEN_DEBUG_FS)	+= debugfs.o
-
 obj-$(CONFIG_XEN_DOM0)		+= vga.o
 
 obj-$(CONFIG_XEN_EFI)		+= efi.o
arch/x86/xen/debugfs.c deleted +0 -16
deleted file mode 100644
index b8c9f2a7d9b6..000000000000
@@ -1,16 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/init.h>
-#include <linux/debugfs.h>
-#include <linux/slab.h>
-
-#include "xen-ops.h"
-
-static struct dentry *d_xen_debug;
-
-struct dentry * __init xen_init_debugfs(void)
-{
-	if (!d_xen_debug)
-		d_xen_debug = debugfs_create_dir("xen", NULL);
-	return d_xen_debug;
-}
-
arch/x86/xen/p2m.c +0 -45

48 lines not on this page · raw message

arch/x86/xen/xen-ops.h +0 -2
index a27ab1f50cf9..6808010ac379 100644
@@ -254,8 +254,6 @@ static inline void xen_hvm_post_suspend(int suspend_cancelled) {}
 
 void xen_add_extra_mem(unsigned long start_pfn, unsigned long n_pfns);
 
-struct dentry * __init xen_init_debugfs(void);
-
 bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn);
 void xen_hvm_init_mmu_ops(void);
 
Signature · 1 line
2.54.0