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=-11.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 6EBB5C433DF for ; Fri, 17 Jul 2020 03:21:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 35FE5207BC for ; Fri, 17 Jul 2020 03:21:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 35FE5207BC 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 AD9CE8D0003; Thu, 16 Jul 2020 23:21:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A88F28D0001; Thu, 16 Jul 2020 23:21:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99F358D0003; Thu, 16 Jul 2020 23:21:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0215.hostedemail.com [216.40.44.215]) by kanga.kvack.org (Postfix) with ESMTP id 842F08D0001 for ; Thu, 16 Jul 2020 23:21:55 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 04428181AC9C6 for ; Fri, 17 Jul 2020 03:21:55 +0000 (UTC) X-FDA: 77046118590.27.linen97_2a0617626f07 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id C5BEB3E91A for ; Fri, 17 Jul 2020 03:21:54 +0000 (UTC) X-HE-Tag: linen97_2a0617626f07 X-Filterd-Recvd-Size: 5988 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Fri, 17 Jul 2020 03:21:54 +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 5723DD6E; Thu, 16 Jul 2020 20:21:53 -0700 (PDT) Received: from [192.168.0.129] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E0ED73F68F; Thu, 16 Jul 2020 20:21:43 -0700 (PDT) From: Anshuman Khandual Subject: Re: [PATCH V5 1/4] mm/debug_vm_pgtable: Add tests validating arch helpers for core MM features To: Steven Price , linux-mm@kvack.org Cc: Catalin Marinas , Heiko Carstens , Paul Mackerras , "H. Peter Anvin" , agordeev@linux.ibm.com, Will Deacon , linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Michael Ellerman , x86@kernel.org, christophe.leroy@csgroup.eu, Mike Rapoport , Christian Borntraeger , Ingo Molnar , linux-arm-kernel@lists.infradead.org, ziy@nvidia.com, Benjamin Herrenschmidt , linux-snps-arc@lists.infradead.org, Vasily Gorbik , cai@lca.pw, Paul Walmsley , "Kirill A . Shutemov" , Thomas Gleixner , gerald.schaefer@de.ibm.com, christophe.leroy@c-s.fr, Vineet Gupta , linux-kernel@vger.kernel.org, Palmer Dabbelt , aneesh.kumar@linux.ibm.com, Borislav Petkov , Andrew Morton , linuxppc-dev@lists.ozlabs.org, rppt@kernel.org References: <1594610587-4172-1-git-send-email-anshuman.khandual@arm.com> <1594610587-4172-2-git-send-email-anshuman.khandual@arm.com> <2ff756c5-28e2-b64a-3788-260ba30c6409@arm.com> Message-ID: Date: Fri, 17 Jul 2020 08:50:35 +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: <2ff756c5-28e2-b64a-3788-260ba30c6409@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-Rspamd-Queue-Id: C5BEB3E91A X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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 07/16/2020 07:44 PM, Steven Price wrote: > On 13/07/2020 04:23, Anshuman Khandual wrote: >> This adds new tests validating arch page table helpers for these follo= wing >> core memory features. These tests create and test specific mapping typ= es at >> various page table levels. >> >> 1. SPECIAL mapping >> 2. PROTNONE mapping >> 3. DEVMAP mapping >> 4. SOFTDIRTY mapping >> 5. SWAP mapping >> 6. MIGRATION mapping >> 7. HUGETLB mapping >> 8. THP mapping >> >> Cc: Andrew Morton >> Cc: Gerald Schaefer >> Cc: Christophe Leroy >> Cc: Mike Rapoport >> Cc: Vineet Gupta >> Cc: Catalin Marinas >> Cc: Will Deacon >> Cc: Benjamin Herrenschmidt >> Cc: Paul Mackerras >> Cc: Michael Ellerman >> Cc: Heiko Carstens >> Cc: Vasily Gorbik >> Cc: Christian Borntraeger >> Cc: Thomas Gleixner >> Cc: Ingo Molnar >> Cc: Borislav Petkov >> Cc: "H. Peter Anvin" >> Cc: Kirill A. Shutemov >> Cc: Paul Walmsley >> Cc: Palmer Dabbelt >> Cc: linux-snps-arc@lists.infradead.org >> Cc: linux-arm-kernel@lists.infradead.org >> Cc: linuxppc-dev@lists.ozlabs.org >> Cc: linux-s390@vger.kernel.org >> Cc: linux-riscv@lists.infradead.org >> Cc: x86@kernel.org >> Cc: linux-mm@kvack.org >> Cc: linux-arch@vger.kernel.org >> Cc: linux-kernel@vger.kernel.org >> Tested-by: Vineet Gupta =C2=A0=C2=A0=C2=A0 #arc >> Reviewed-by: Zi Yan >> Suggested-by: Catalin Marinas >> Signed-off-by: Anshuman Khandual >> --- >> =C2=A0 mm/debug_vm_pgtable.c | 302 +++++++++++++++++++++++++++++++++++= ++++++- >> =C2=A0 1 file changed, 301 insertions(+), 1 deletion(-) >> >> diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c >> index 61ab16fb2e36..2fac47db3eb7 100644 >> --- a/mm/debug_vm_pgtable.c >> +++ b/mm/debug_vm_pgtable.c > [...] >> + >> +static void __init pte_swap_tests(unsigned long pfn, pgprot_t prot) >> +{ >> +=C2=A0=C2=A0=C2=A0 swp_entry_t swp; >> +=C2=A0=C2=A0=C2=A0 pte_t pte; >> + >> +=C2=A0=C2=A0=C2=A0 pte =3D pfn_pte(pfn, prot); >> +=C2=A0=C2=A0=C2=A0 swp =3D __pte_to_swp_entry(pte); >=20 > Minor issue: this doesn't look necessarily valid - there's no reason a = normal PTE can be turned into a swp_entry. In practise this is likely to = work on all architectures because there's no reason not to use (at least)= all the PFN bits for the swap entry, but it doesn't exactly seem correct= . Agreed, that it is a simple test but nonetheless a valid one which makes sure that PFN value remained unchanged during pte <---> swp conversion. >=20 > Can we start with a swp_entry_t (from __swp_entry()) and check the roun= d trip of that? >=20 > It would also seem sensible to have a check that is_swap_pte(__swp_entr= y_to_pte(__swp_entry(x,y))) is true. >From past experiences, getting any these new tests involving platform helpers, working on all existing enabled archs is neither trivial nor going to be quick. Existing tests here are known to succeed in enabled platforms. Nonetheless, proposed tests as in the above suggestions do make sense but will try to accommodate them in a later patch.