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 04A1DC433E2 for ; Fri, 17 Jul 2020 03:23:55 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 75BCC207BC for ; Fri, 17 Jul 2020 03:23:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 75BCC207BC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4B7GgD3MrmzDqtG for ; Fri, 17 Jul 2020 13:23:52 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=arm.com (client-ip=217.140.110.172; helo=foss.arm.com; envelope-from=anshuman.khandual@arm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lists.ozlabs.org (Postfix) with ESMTP id 4B7Gd248GwzDqTN for ; Fri, 17 Jul 2020 13:21:55 +1000 (AEST) 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 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 Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 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, x86@kernel.org, Mike Rapoport , Christian Borntraeger , Ingo Molnar , gerald.schaefer@de.ibm.com, ziy@nvidia.com, Catalin Marinas , linux-snps-arc@lists.infradead.org, Vasily Gorbik , cai@lca.pw, Paul Walmsley , "Kirill A . Shutemov" , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, 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 Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 following >> core memory features. These tests create and test specific mapping types 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     #arc >> Reviewed-by: Zi Yan >> Suggested-by: Catalin Marinas >> Signed-off-by: Anshuman Khandual >> --- >>   mm/debug_vm_pgtable.c | 302 +++++++++++++++++++++++++++++++++++++++++- >>   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) >> +{ >> +    swp_entry_t swp; >> +    pte_t pte; >> + >> +    pte = pfn_pte(pfn, prot); >> +    swp = __pte_to_swp_entry(pte); > > 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. > > Can we start with a swp_entry_t (from __swp_entry()) and check the round trip of that? > > It would also seem sensible to have a check that is_swap_pte(__swp_entry_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.