Skip to contentSkip to conversation

x86: add code to dump the (kernel) page tables for visual inspection

PATCH In review Arjan van de Ven 3 participants 4 messages Feb 5, 2008 – Feb 9, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: add code to dump the (kernel) page tables for visual inspection

Subject: x86: add code to dump the (kernel) page tables for visual inspection by kernel developers
From: Arjan van de Ven <[email protected]>

This patch adds code to the kernel to have an (optional) /proc/kernel_page_tables debug file that basically dumps the kernel pagetables; this allows us kernel developers to verify that nothing fishy is going on and that the various mappings are set up correctly. This was quite useful in finding various change_page_attr() bugs, and is very likely to be useful in the future as well.

---
 arch/x86/Kconfig.debug        |   11 +
 arch/x86/mm/Makefile_64       |    1 
 arch/x86/mm/dump_pagetables.c |  301 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 313 insertions(+)
arch/x86/Kconfig.debug +11 -0
Index: linux.trees.git/arch/x86/Kconfig.debug
===================================================================
@@ -70,6 +70,17 @@ config DEBUG_PER_CPU_MAPS
 
 	  Say N if unsure.
 
+config X86_PTDUMP
+	bool "Export kernel pagetable layout to userspace in /proc"
+	depends on X86_64
+	help
+	  Say Y here if you want to show the kernel pagetable layout in
+	  a /proc file. This information is only useful for kernel developers
+	  who are working in architecture specific areas of the kernel.
+	  It is probably not a good idea to enable this feature in a production
+	  kernel.
+	  If in doubt, say "N"
+
 config DEBUG_RODATA
 	bool "Write protect kernel read-only data structures"
 	default y
arch/x86/mm/Makefile_64 +1 -0
Index: linux.trees.git/arch/x86/mm/Makefile_64
===================================================================
@@ -7,3 +7,4 @@ obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpag
 obj-$(CONFIG_NUMA) += numa_64.o
 obj-$(CONFIG_K8_NUMA) += k8topology_64.o
 obj-$(CONFIG_ACPI_NUMA) += srat_64.o
+obj-$(CONFIG_X86_PTDUMP) += dump_pagetables.o
arch/x86/mm/dump_pagetables.c new file +301 -0

301 lines not on this page · raw message

Signature · 3 lines
If you want to reach me at my work email, use [email protected]
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
#1 lore raw
Quoted 10 lines · Arjan van de Ven

Subject: x86: add code to dump the (kernel) page tables for visual inspection by kernel developers
From: Arjan van de Ven <[email protected]>

This patch adds code to the kernel to have an (optional) /proc/kernel_page_tables debug file that basically dumps the kernel pagetables; this allows us kernel developers to verify that nothing fishy is going on and that the various mappings are set up correctly. This was quite useful in finding various change_page_attr() bugs, and is very likely to be useful in the future as well.

Seems nice Arjan, but could we also add NUMA information ?

#2 lore raw
Quoted 14 lines · On Tue, 05 Feb 2008 21:46:52 +0100 Eric Dumazet <[email protected]> wrote:
Quoted 4 lines · Arjan van de Ven

Subject: x86: add code to dump the (kernel) page tables for visual inspection by kernel developers From: Arjan van de Ven <[email protected]>

Quoted 8 lines

This patch adds code to the kernel to have an (optional) /proc/kernel_page_tables debug file that basically dumps the kernel pagetables; this allows us kernel developers to verify that nothing fishy is going on and that the various mappings are set up correctly. This was quite useful in finding various change_page_attr() bugs, and is very likely to be useful in the future as well.

Quoted 2 lines

Seems nice Arjan, but could we also add NUMA information ?

ok maybe I'm missing something, but the kernel VA space currently
is totally not numa dependent in any shape or form...
so can you explain what kind of information you're looking for?
(I guess I just don't really understand your request; can you expand a bit on it?)

Signature · 3 lines
If you want to reach me at my work email, use [email protected]
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
#3 lore raw
In reply to Arjan van de Ven
Quoted 5 lines · Arjan van de Ven

Subject: x86: add code to dump the (kernel) page tables for visual inspection by kernel developers
From: Arjan van de Ven <[email protected]>

This patch adds code to the kernel to have an (optional) /proc/kernel_page_tables debug file that basically dumps the kernel

'No new crap goes to /proc?'

It does not seem to be per process -> it should probably go to debugfs.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html