Commit 399145f9 authored by Anshuman Khandual's avatar Anshuman Khandual Committed by Linus Torvalds
Browse files

mm/debug: add tests validating architecture page table helpers

This adds tests which will validate architecture page table helpers and
other accessors in their compliance with expected generic MM semantics.
This will help various architectures in validating changes to existing
page table helpers or addition of new ones.

This test covers basic page table entry transformations including but not
limited to old, young, dirty, clean, write, write protect etc at various
level along with populating intermediate entries with next page table page
and validating them.

Test page table pages are allocated from system memory with required size
and alignments.  The mapped pfns at page table levels are derived from a
real pfn representing a valid kernel text symbol.  This test gets called
via late_initcall().

This test gets built and run when CONFIG_DEBUG_VM_PGTABLE is selected.
Any architecture, which is willing to subscribe this test will need to
select ARCH_HAS_DEBUG_VM_PGTABLE.  For now this is limited to arc, arm64,
x86, s390 and powerpc platforms where the test is known to build and run
successfully Going forward, other architectures too can subscribe the test
after fixing any build or runtime problems with their page table helpers.

Folks interested in making sure that a given platform's page table helpers
conform to expected generic MM semantics should enable the above config
which will just trigger this test during boot.  Any non conformity here
will be reported as an warning which would need to be fixed.  This test
will help catch any changes to the agreed upon semantics expected from
generic MM and enable platforms to accommodate it thereafter.

[anshuman.khandual@arm.com: v17]
  Link: http://lkml.kernel.org/r/1587436495-22033-3-git-send-email-anshuman.khandual@arm.com
[anshuman.khandual@arm.com: v18]
  Link: http://lkml.kernel.org/r/1588564865-31160-3-git-send-email-anshuman.khandual@arm.com


Suggested-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: default avatarQian Cai <cai@lca.pw>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Tested-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>	[s390]
Tested-by: Christophe Leroy <christophe.leroy@c-s.fr>	[ppc32]
Reviewed-by: default avatarIngo Molnar <mingo@kernel.org>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Link: http://lkml.kernel.org/r/1583919272-24178-1-git-send-email-anshuman.khandual@arm.com


Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8898ad58
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
#
# Feature name:          debug-vm-pgtable
#         Kconfig:       ARCH_HAS_DEBUG_VM_PGTABLE
#         description:   arch supports pgtable tests for semantics compliance
#
    -----------------------
    |         arch |status|
    -----------------------
    |       alpha: | TODO |
    |         arc: |  ok  |
    |         arm: | TODO |
    |       arm64: |  ok  |
    |         c6x: | TODO |
    |        csky: | TODO |
    |       h8300: | TODO |
    |     hexagon: | TODO |
    |        ia64: | TODO |
    |        m68k: | TODO |
    |  microblaze: | TODO |
    |        mips: | TODO |
    |       nds32: | TODO |
    |       nios2: | TODO |
    |    openrisc: | TODO |
    |      parisc: | TODO |
    |     powerpc: |  ok  |
    |       riscv: | TODO |
    |        s390: |  ok  |
    |          sh: | TODO |
    |       sparc: | TODO |
    |          um: | TODO |
    |   unicore32: | TODO |
    |         x86: |  ok  |
    |      xtensa: | TODO |
    -----------------------
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
config ARC
	def_bool y
	select ARC_TIMERS
	select ARCH_HAS_DEBUG_VM_PGTABLE
	select ARCH_HAS_DMA_PREP_COHERENT
	select ARCH_HAS_PTE_SPECIAL
	select ARCH_HAS_SETUP_DMA_OPS
+1 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ config ARM64
	select ARCH_HAS_DEBUG_WX
	select ARCH_BINFMT_ELF_STATE
	select ARCH_HAS_DEBUG_VIRTUAL
	select ARCH_HAS_DEBUG_VM_PGTABLE
	select ARCH_HAS_DEVMEM_IS_ALLOWED
	select ARCH_HAS_DMA_PREP_COHERENT
	select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
+1 −0
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@ config PPC
	#
	select ARCH_32BIT_OFF_T if PPC32
	select ARCH_HAS_DEBUG_VIRTUAL
	select ARCH_HAS_DEBUG_VM_PGTABLE
	select ARCH_HAS_DEVMEM_IS_ALLOWED
	select ARCH_HAS_ELF_RANDOMIZE
	select ARCH_HAS_FORTIFY_SOURCE
+1 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ config KASAN_SHADOW_OFFSET
config S390
	def_bool y
	select ARCH_BINFMT_ELF_STATE
	select ARCH_HAS_DEBUG_VM_PGTABLE
	select ARCH_HAS_DEVMEM_IS_ALLOWED
	select ARCH_HAS_ELF_RANDOMIZE
	select ARCH_HAS_FORTIFY_SOURCE
Loading