From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA33EC3F2C6 for ; Sat, 7 Mar 2020 00:03:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3DF04205C9 for ; Sat, 7 Mar 2020 00:03:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3DF04205C9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 90F006B0003; Fri, 6 Mar 2020 19:03:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8BF136B0006; Fri, 6 Mar 2020 19:03:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7FD306B0007; Fri, 6 Mar 2020 19:03:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0080.hostedemail.com [216.40.44.80]) by kanga.kvack.org (Postfix) with ESMTP id 649706B0003 for ; Fri, 6 Mar 2020 19:03:28 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 221588248068 for ; Sat, 7 Mar 2020 00:03:28 +0000 (UTC) X-FDA: 76566616896.01.bee19_3b520a8873a14 X-HE-Tag: bee19_3b520a8873a14 X-Filterd-Recvd-Size: 6501 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Sat, 7 Mar 2020 00:03:27 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9A3A530E; Fri, 6 Mar 2020 16:03:26 -0800 (PST) Received: from [10.163.1.59] (unknown [10.163.1.59]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 689F93F237; Fri, 6 Mar 2020 16:03:17 -0800 (PST) Subject: Re: [PATCH V15] mm/debug: Add tests validating architecture page table helpers To: Qian Cai , linux-mm@kvack.org Cc: Andrew Morton , Mike Rapoport , Vineet Gupta , Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "Kirill A . Shutemov" , Paul Walmsley , Palmer Dabbelt , linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-riscv@lists.infradead.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Christophe Leroy References: <1583452659-11801-1-git-send-email-anshuman.khandual@arm.com> <1583527481.7365.165.camel@lca.pw> From: Anshuman Khandual Message-ID: <61250cdc-f80b-2e50-5168-2ec67ec6f1e6@arm.com> Date: Sat, 7 Mar 2020 05:33:15 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1583527481.7365.165.camel@lca.pw> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 03/07/2020 02:14 AM, Qian Cai wrote: > On Fri, 2020-03-06 at 05:27 +0530, Anshuman Khandual wrote: >> This adds tests which will validate architecture page table helpers an= d >> 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 vario= us >> 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 s= ize >> and alignments. The mapped pfns at page table levels are derived from = a >> real pfn representing a valid kernel text symbol. This test gets calle= d >> 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 sel= ect >> 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 successfu= lly. >> Going forward, other architectures too can subscribe the test after fi= xing >> any build or runtime problems with their page table helpers. Meanwhile= for >> better platform coverage, the test can also be enabled with CONFIG_EXP= ERT >> even without ARCH_HAS_DEBUG_VM_PGTABLE. >> >> Folks interested in making sure that a given platform's page table hel= pers >> conform to expected generic MM semantics should enable the above confi= g >> 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 M= M and >> enable platforms to accommodate it thereafter. >=20 > OK, I get this working on powerpc hash MMU as well, so this? >=20 > 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 @@ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= nios2: | TODO | > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A0=C2=A0=C2=A0openrisc: | TODO= | > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0pari= sc: | TODO | > -=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A0powerpc/32: |=C2=A0=C2=A0ok=C2=A0= =C2=A0| > -=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A0powerpc/64: | TODO | > +=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0powerpc: |=C2=A0= =C2=A0ok=C2=A0=C2=A0| > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= riscv: | TODO | > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0s390: |=C2=A0=C2=A0ok=C2=A0=C2=A0| > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0sh: | 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 > =C2=A0 # > =C2=A0 select ARCH_32BIT_OFF_T if PPC32 > =C2=A0 select ARCH_HAS_DEBUG_VIRTUAL > - select ARCH_HAS_DEBUG_VM_PGTABLE if PPC32 > + select ARCH_HAS_DEBUG_VM_PGTABLE > =C2=A0 select ARCH_HAS_DEVMEM_IS_ALLOWED > =C2=A0 select ARCH_HAS_ELF_RANDOMIZE > =C2=A0 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, > =C2=A0 pte_t pte =3D READ_ONCE(*ptep); > =C2=A0 > =C2=A0 pte =3D __pte(pte_val(pte) | RANDOM_ORVALUE); > - WRITE_ONCE(*ptep, pte); > + set_pte_at(mm, vaddr, ptep, pte); Hmm, set_pte_at() function is not preferred here for these tests. The ide= a is to avoid or atleast minimize TLB/cache flushes triggered from these so= rt of 'static' tests. set_pte_at() is platform provided and could/might trig= ger these flushes or some other platform specific synchronization stuff. Just wondering is there specific reason with respect to the soft lock up probl= em making it necessary to use set_pte_at() rather than a simple WRITE_ONCE()= ? > + barrier(); > =C2=A0 pte_clear(mm, vaddr, ptep); > =C2=A0 pte =3D READ_ONCE(*ptep); > =C2=A0 WARN_ON(!pte_none(pte)); >=20