public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Qian Cai <cai@lca•pw>
To: Anshuman Khandual <anshuman.khandual@arm•com>, linux-mm@kvack•org
Cc: Catalin Marinas <catalin.marinas@arm•com>,
	Heiko Carstens <heiko.carstens@de•ibm.com>,
	Paul Mackerras <paulus@samba•org>,
	"H. Peter Anvin" <hpa@zytor•com>,
	linux-riscv@lists•infradead.org, Will Deacon <will@kernel•org>,
	linux-arch@vger•kernel.org, linux-s390@vger•kernel.org,
	Michael Ellerman <mpe@ellerman•id.au>,
	x86@kernel•org, Mike Rapoport <rppt@linux•ibm.com>,
	Christian Borntraeger <borntraeger@de•ibm.com>,
	Ingo Molnar <mingo@redhat•com>,
	Benjamin Herrenschmidt <benh@kernel•crashing.org>,
	linux-snps-arc@lists•infradead.org,
	Vasily Gorbik <gor@linux•ibm.com>, Borislav Petkov <bp@alien8•de>,
	Paul Walmsley <paul.walmsley@sifive•com>,
	"Kirill A . Shutemov" <kirill@shutemov•name>,
	Thomas Gleixner <tglx@linutronix•de>,
	linux-arm-kernel@lists•infradead.org,
	Christophe Leroy <christophe.leroy@c-s•fr>,
	Vineet Gupta <vgupta@synopsys•com>,
	linux-kernel@vger•kernel.org, Palmer Dabbelt <palmer@dabbelt•com>,
	Andrew Morton <akpm@linux-foundation•org>,
	linuxppc-dev@lists•ozlabs.org
Subject: Re: [PATCH V15] mm/debug: Add tests validating architecture page table helpers
Date: Fri, 06 Mar 2020 15:44:41 -0500	[thread overview]
Message-ID: <1583527481.7365.165.camel@lca.pw> (raw)
In-Reply-To: <1583452659-11801-1-git-send-email-anshuman.khandual@arm.com>

On Fri, 2020-03-06 at 05:27 +0530, Anshuman Khandual wrote:
> 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
> inside kernel_init() right after async_synchronize_full().
> 
> 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 ppc32 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. Meanwhile for
> better platform coverage, the test can also be enabled with CONFIG_EXPERT
> even without ARCH_HAS_DEBUG_VM_PGTABLE.
> 
> 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.

OK, I get this working on powerpc hash MMU as well, so this?

diff --git a/Documentation/features/debug/debug-vm-pgtable/arch-support.txt
b/Documentation/features/debug/debug-vm-pgtable/arch-support.txt
index 64d0f9b15c49..c527d05c0459 100644
--- a/Documentation/features/debug/debug-vm-pgtable/arch-support.txt
+++ b/Documentation/features/debug/debug-vm-pgtable/arch-support.txt
@@ -22,8 +22,7 @@
     |       nios2: | TODO |
     |    openrisc: | TODO |
     |      parisc: | TODO |
-    |  powerpc/32: |  ok  |
-    |  powerpc/64: | TODO |
+    |     powerpc: |  ok  |
     |       riscv: | TODO |
     |        s390: |  ok  |
     |          sh: | TODO |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 2e7eee523ba1..176930f40e07 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -116,7 +116,7 @@ config PPC
 	#
 	select ARCH_32BIT_OFF_T if PPC32
 	select ARCH_HAS_DEBUG_VIRTUAL
-	select ARCH_HAS_DEBUG_VM_PGTABLE if PPC32
+	select ARCH_HAS_DEBUG_VM_PGTABLE
 	select ARCH_HAS_DEVMEM_IS_ALLOWED
 	select ARCH_HAS_ELF_RANDOMIZE
 	select ARCH_HAS_FORTIFY_SOURCE
diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c
index 96a91bda3a85..98990a515268 100644
--- a/mm/debug_vm_pgtable.c
+++ b/mm/debug_vm_pgtable.c
@@ -256,7 +256,8 @@ static void __init pte_clear_tests(struct mm_struct *mm,
pte_t *ptep,
 	pte_t pte = READ_ONCE(*ptep);
 
 	pte = __pte(pte_val(pte) | RANDOM_ORVALUE);
-	WRITE_ONCE(*ptep, pte);
+	set_pte_at(mm, vaddr, ptep, pte);
+	barrier();
 	pte_clear(mm, vaddr, ptep);
 	pte = READ_ONCE(*ptep);
 	WARN_ON(!pte_none(pte));

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-03-06 20:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05 23:57 [PATCH V15] mm/debug: Add tests validating architecture page table helpers Anshuman Khandual
2020-03-06 20:44 ` Qian Cai [this message]
2020-03-07  0:03   ` Anshuman Khandual
2020-03-07  0:34     ` Qian Cai
2020-03-07  0:56       ` Anshuman Khandual
2020-03-07  1:10         ` Qian Cai
2020-03-07  7:05         ` Christophe Leroy
2020-03-10  2:31           ` Anshuman Khandual

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1583527481.7365.165.camel@lca.pw \
    --to=cai@lca$(echo .)pw \
    --cc=akpm@linux-foundation$(echo .)org \
    --cc=anshuman.khandual@arm$(echo .)com \
    --cc=benh@kernel$(echo .)crashing.org \
    --cc=borntraeger@de$(echo .)ibm.com \
    --cc=bp@alien8$(echo .)de \
    --cc=catalin.marinas@arm$(echo .)com \
    --cc=christophe.leroy@c-s$(echo .)fr \
    --cc=gor@linux$(echo .)ibm.com \
    --cc=heiko.carstens@de$(echo .)ibm.com \
    --cc=hpa@zytor$(echo .)com \
    --cc=kirill@shutemov$(echo .)name \
    --cc=linux-arch@vger$(echo .)kernel.org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-mm@kvack$(echo .)org \
    --cc=linux-riscv@lists$(echo .)infradead.org \
    --cc=linux-s390@vger$(echo .)kernel.org \
    --cc=linux-snps-arc@lists$(echo .)infradead.org \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=mingo@redhat$(echo .)com \
    --cc=mpe@ellerman$(echo .)id.au \
    --cc=palmer@dabbelt$(echo .)com \
    --cc=paul.walmsley@sifive$(echo .)com \
    --cc=paulus@samba$(echo .)org \
    --cc=rppt@linux$(echo .)ibm.com \
    --cc=tglx@linutronix$(echo .)de \
    --cc=vgupta@synopsys$(echo .)com \
    --cc=will@kernel$(echo .)org \
    --cc=x86@kernel$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox