Skip to contentSkip to conversation

powerpc/pagetable: Add option to dump the linux pagetables

PATCH New Rashmica Gupta 1 participant 2 messages Mar 29, 2016 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 powerpc/pagetable: Add option to dump the linux pagetables

Useful to be able to dump the kernels page tables to check permissions and memory types - derived from arm64's implementation.

Add a debugfs file to check the page tables. To use this the PPC_PTDUMP config option must be selected.

---
Do not check for COMBO pages if default page size is 4K.

 arch/powerpc/Kconfig.debug             |  12 +
 arch/powerpc/mm/Makefile               |   1 +
 arch/powerpc/mm/dump_linuxpagetables.c | 398 +++++++++++++++++++++++++++++++++
 3 files changed, 411 insertions(+)
 create mode 100644 arch/powerpc/mm/dump_linuxpagetables.c
arch/powerpc/Kconfig.debug +12 -0
index 638f9ce740f5..26a60effea1a 100644
@@ -344,4 +344,16 @@ config FAIL_IOMMU
 
 	  If you are unsure, say N.
 
+config PPC_PTDUMP
+        bool "Export kernel pagetable layout to userspace via debugfs"
+        depends on DEBUG_KERNEL
+        select DEBUG_FS
+        help
+	  This option exports the state of the kernel pagetables to a
+	  debugfs file. This is only useful for kernel developers who are
+	  working in architecture specific areas of the kernel - probably
+	  not a good idea to enable this feature in a production kernel.
+
+	  If you are unsure, say N.
+
 endmenu
arch/powerpc/mm/Makefile +1 -0
index adfee3f1aeb9..6935c6204fbc 100644
@@ -41,3 +41,4 @@ obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o
 obj-$(CONFIG_HIGHMEM)		+= highmem.o
 obj-$(CONFIG_PPC_COPRO_BASE)	+= copro_fault.o
 obj-$(CONFIG_SPAPR_TCE_IOMMU)	+= mmu_context_iommu.o
+obj-$(CONFIG_PPC_PTDUMP)	+= dump_linuxpagetables.o
arch/powerpc/mm/dump_linuxpagetables.c new file +398 -0

398 lines not on this page · raw message

Signature · 1 line
2.5.0
#1 lore raw

PATCH 2/2 powerpc/pagetable: Add option to dump kernel hashpagetable

Useful to be able to dump the kernel hash page table to check which pages are hashed along with their sizes and other details.

Add a debugfs file to check the page tables. To use this the PPC_PTDUMP config option must be selected.

---
 arch/powerpc/mm/Makefile             |   3 +-
 arch/powerpc/mm/dump_hashpagetable.c | 501 +++++++++++++++++++++++++++++++++++
 2 files changed, 503 insertions(+), 1 deletion(-)
 create mode 100644 arch/powerpc/mm/dump_hashpagetable.c
arch/powerpc/mm/Makefile +2 -1
index 6935c6204fbc..0bd48b345ff3 100644
@@ -41,4 +41,5 @@ obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o
 obj-$(CONFIG_HIGHMEM)		+= highmem.o
 obj-$(CONFIG_PPC_COPRO_BASE)	+= copro_fault.o
 obj-$(CONFIG_SPAPR_TCE_IOMMU)	+= mmu_context_iommu.o
-obj-$(CONFIG_PPC_PTDUMP)	+= dump_linuxpagetables.o
+obj-$(CONFIG_PPC_PTDUMP)	+= dump_linuxpagetables.o \
+				   dump_hashpagetable.o
arch/powerpc/mm/dump_hashpagetable.c new file +501 -0

501 lines not on this page · raw message

Signature · 1 line
2.5.0