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=-7.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,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 70E07C43331 for ; Sun, 29 Mar 2020 14:22:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 28ADE206F6 for ; Sun, 29 Mar 2020 14:22:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28ADE206F6 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 B131D6B0010; Sun, 29 Mar 2020 10:22:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A9D836B0032; Sun, 29 Mar 2020 10:22:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 98CE16B0036; Sun, 29 Mar 2020 10:22:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by kanga.kvack.org (Postfix) with ESMTP id 7D95F6B0010 for ; Sun, 29 Mar 2020 10:22:12 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3CCF110FBF for ; Sun, 29 Mar 2020 14:22:12 +0000 (UTC) X-FDA: 76648614504.25.deer93_6a76f46dc1137 X-HE-Tag: deer93_6a76f46dc1137 X-Filterd-Recvd-Size: 6903 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Sun, 29 Mar 2020 14:22:11 +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 A5D9C31B; Sun, 29 Mar 2020 07:22:10 -0700 (PDT) Received: from [10.163.1.70] (unknown [10.163.1.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 542D63F68F; Sun, 29 Mar 2020 07:22:01 -0700 (PDT) From: Anshuman Khandual Subject: Re: [PATCH V2 0/3] mm/debug: Add more arch page table helper tests To: Christophe Leroy , linux-mm@kvack.org Cc: Jonathan Corbet , 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-doc@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org References: <1585027375-9997-1-git-send-email-anshuman.khandual@arm.com> <2bb4badc-2b7a-e15d-a99b-b1bd38c9d9bf@arm.com> <9675882f-0ec5-5e46-551f-dd3aa38bf8d8@arm.com> Message-ID: Date: Sun, 29 Mar 2020 19:51:54 +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: 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/27/2020 12:30 PM, Christophe Leroy wrote: >=20 >=20 > On 03/27/2020 06:46 AM, Anshuman Khandual wrote: >> >> On 03/26/2020 08:53 PM, Christophe Leroy wrote: >>> >>> >>> Le 26/03/2020 =C3=A0 03:23, Anshuman Khandual a =C3=A9crit=C2=A0: >>>> >>>> >>>> On 03/24/2020 10:52 AM, Anshuman Khandual wrote: >>>>> This series adds more arch page table helper tests. The new tests h= ere are >>>>> either related to core memory functions and advanced arch pgtable h= elpers. >>>>> This also creates a documentation file enlisting all expected seman= tics as >>>>> suggested by Mike Rapoport (https://lkml.org/lkml/2020/1/30/40). >>>>> >>>>> This series has been tested on arm64 and x86 platforms. >>>> >>>> If folks can test these patches out on remaining ARCH_HAS_DEBUG_VM_P= GTABLE >>>> enabled platforms i.e s390, arc, powerpc (32 and 64), that will be r= eally >>>> appreciated. Thank you. >>>> >>> >>> On powerpc 8xx (PPC32), I get: >>> >>> [=C2=A0=C2=A0 53.338368] debug_vm_pgtable: debug_vm_pgtable: Validati= ng architecture page table helpers >>> [=C2=A0=C2=A0 53.347403] ------------[ cut here ]------------ >>> [=C2=A0=C2=A0 53.351832] WARNING: CPU: 0 PID: 1 at mm/debug_vm_pgtabl= e.c:647 debug_vm_pgtable+0x280/0x3f4 >> >> mm/debug_vm_pgtable.c:647 ? >> >> With the following commits in place >> >> 53a8338ce (HEAD) Documentation/mm: Add descriptions for arch page tabl= e helper >> 5d4913fc1 mm/debug: Add tests validating arch advanced page table help= ers >> bcaf120a7 mm/debug: Add tests validating arch page table helpers for c= ore features >> d6ed5a4a5 x86/memory: Drop pud_mknotpresent() >> 0739d1f8d mm/debug: Add tests validating architecture page table helpe= rs >> 16fbf79b0 (tag: v5.6-rc7) Linux 5.6-rc7 >=20 > I have: >=20 > facaa5eb5909 (HEAD -> helpers0) mm/debug: Add tests validating arch adv= anced page table helpers > 6389fed515fc mm/debug: Add tests validating arch page table helpers for= core features > dc14ecc8b94e mm/debug: add tests validating architecture page table hel= pers > c6624071c338 (origin/merge, merge) Automatic merge of branches 'master'= , 'next' and 'fixes' into merge > 58e05c5508e6 Automatic merge of branches 'master', 'next' and 'fixes' i= nto merge > 1b649e0bcae7 (origin/master, origin/HEAD) Merge git://git.kernel.org/pu= b/scm/linux/kernel/git/netdev/net >=20 > origin is https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux= .git >=20 > I can't see your last patch in powerpc mailing list (https://patchwork.= ozlabs.org/project/linuxppc-dev/list/?series=3D166237) My bad, did not update the last patch with required lists (will fix). >=20 >> >> mm/debug_vm_pgtable.c:647 is here. >=20 > Line 647 is: >=20 > =C2=A0=C2=A0=C2=A0=C2=A0WARN_ON(!pte_same(pte, __swp_entry_to_pte(swp))= ); Both set of definitions suggest that the last three bits (if present) on the PTE will be discarded during PTE->SWP->PTE conversion which might be leading to this mismatch and subsequent failure. arch/powerpc/include/asm/nohash/32/pgtable.h arch/powerpc/include/asm/book3s/32/pgtable.h #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> = 3 }) #define __swp_entry_to_pte(x) ((pte_t) { (x).val << 3 }) Also there are some more architectures (microblaze, sh, etc) where these conversions are not always preserving. On powerpc64, it sets back _PAGE_P= TE irrespective of whether the bit was originally set or not. Probably it is wrong to expect that PTE->SWP->PTE conversion will be alwa= ys preserving. So wondering if it is worth changing this test to accommodate all such architectures or just drop it instead. >=20 >=20 >> >> #ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION >> static void __init pmd_swap_tests(unsigned long pfn, pgprot_t prot) >> { >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 swp_entry_t swp; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pmd_t pmd;=C2=A0 ----= -------------------------> Line #647 >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pmd =3D pfn_pmd(pfn, = prot); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 swp =3D __pmd_to_swp_= entry(pmd); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 WARN_ON(!pmd_same(pmd= , __swp_entry_to_pmd(swp))); >> } >> #else >> static void __init pmd_swap_tests(unsigned long pfn, pgprot_t prot) { = } >> #end >> >> Did I miss something ? >> >=20 > [...] >=20 >> Could you please point me to the exact test which is failing ? >> >>> [=C2=A0=C2=A0 53.519778] Freeing unused kernel memory: 608K >>> >>> >> So I assume that the system should have come till runtime just fine ap= art from >> the above warning message because. >> >=20 > Yes it boots fine otherwise. Cool, that is good to know. >=20 > Christophe >=20