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=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 89C7AC433DF for ; Wed, 12 Aug 2020 13:34:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4F651207DA for ; Wed, 12 Aug 2020 13:34:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4F651207DA 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 D3C4F8D0019; Wed, 12 Aug 2020 09:34:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CC6198D0001; Wed, 12 Aug 2020 09:34:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8F5D8D0019; Wed, 12 Aug 2020 09:34:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0211.hostedemail.com [216.40.44.211]) by kanga.kvack.org (Postfix) with ESMTP id 9F3678D0001 for ; Wed, 12 Aug 2020 09:34:54 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 2C7FC8248047 for ; Wed, 12 Aug 2020 13:34:54 +0000 (UTC) X-FDA: 77142012108.22.base77_531355026feb Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id C8CC418038E60 for ; Wed, 12 Aug 2020 13:34:53 +0000 (UTC) X-HE-Tag: base77_531355026feb X-Filterd-Recvd-Size: 5044 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Wed, 12 Aug 2020 13:34:53 +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 8576131B; Wed, 12 Aug 2020 06:34:52 -0700 (PDT) Received: from [10.163.66.87] (unknown [10.163.66.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AF5EB3F70D; Wed, 12 Aug 2020 06:34:50 -0700 (PDT) Subject: Re: [PATCH 14/16] debug_vm_pgtable/hugetlb: Disable hugetlb test on ppc64 To: "Aneesh Kumar K.V" , linux-mm@kvack.org, akpm@linux-foundation.org Cc: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org References: <20200812063358.369514-1-aneesh.kumar@linux.ibm.com> <20200812063358.369514-14-aneesh.kumar@linux.ibm.com> From: Anshuman Khandual Message-ID: <83766a01-6ffb-798c-c5b9-46b2d672f618@arm.com> Date: Wed, 12 Aug 2020 19:04:21 +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 X-Rspamd-Queue-Id: C8CC418038E60 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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 08/12/2020 06:46 PM, Aneesh Kumar K.V wrote: > On 8/12/20 6:33 PM, Anshuman Khandual wrote: >> >> >> On 08/12/2020 12:03 PM, Aneesh Kumar K.V wrote: >>> The seems to be missing quite a lot of details w.r.t allocating >>> the correct pgtable_t page (huge_pte_alloc()), holding the right >>> lock (huge_pte_lock()) etc. The vma used is also not a hugetlb VMA. >>> >>> ppc64 do have runtime checks within CONFIG_DEBUG_VM for most of these= . >>> Hence disable the test on ppc64. >> >> This test is free from any platform specific #ifdefs which should >> never be broken. If hugetlb_advanced_tests() does not work or is >> not detailed enough for ppc64, then it would be great if you could >> suggest some improvements so that it works for all enabled platforms. >> >> >=20 > As mentioned the test is broken. For hugetlb, the pgtable_t pages shoul= d be allocated by huge_pte_alloc(). We need to hold huget_pte_lock() befo= re=C2=A0 updating huge tlb pte. That takes hugepage size, which is mostly= derived out of vma. Hence vma need to be a hugetlb vma. Some of the func= tions also depend on hstate. Also we should use set_huge_pte_at() when se= tting up hugetlb pte entries. I was tempted to remove that test completel= y marking it broken. But avoided that by marking it broken on only PPC64. The test is not broken, hugetlb helpers on multiple platforms dont compla= in about this at all. The tests here emulate 'enough' MM objects required for the = helpers on enabled platforms, to perform the primary task i.e page table transfor= mation it is expected to do. The test does not claim to emulate a perfect MM enviro= nment for a given subsystem's (like HugeTLB) arch helpers. Now in this case, the MM= objects being emulated for the HugeTLB advanced tests does not seem to be suffici= ent for ppc64 but it can be improved. But that does not mean it is broken in it's= current form for other platforms. >=20 >=20 >=20 >>> Signed-off-by: Aneesh Kumar K.V >>> --- >>> =C2=A0 mm/debug_vm_pgtable.c | 6 +++++- >>> =C2=A0 1 file changed, 5 insertions(+), 1 deletion(-) >>> >>> diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c >>> index 529892b9be2f..3e112d0ba1b2 100644 >>> --- a/mm/debug_vm_pgtable.c >>> +++ b/mm/debug_vm_pgtable.c >>> @@ -800,6 +800,7 @@ static void __init hugetlb_basic_tests(unsigned l= ong pfn, pgprot_t prot) >>> =C2=A0 #endif /* CONFIG_ARCH_WANT_GENERAL_HUGETLB */ >>> =C2=A0 } >>> =C2=A0 +#ifndef CONFIG_PPC_BOOK3S_64 >>> =C2=A0 static void __init hugetlb_advanced_tests(struct mm_struct *mm= , >>> =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=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 str= uct vm_area_struct *vma, >>> =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=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pte= _t *ptep, unsigned long pfn, >>> @@ -842,6 +843,7 @@ static void __init hugetlb_advanced_tests(struct = mm_struct *mm, >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pte =3D huge_ptep_get(ptep); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 WARN_ON(!(huge_pte_write(pte) && huge_= pte_dirty(pte))); >>> =C2=A0 } >>> +#endif >>> =C2=A0 #else=C2=A0 /* !CONFIG_HUGETLB_PAGE */ >>> =C2=A0 static void __init hugetlb_basic_tests(unsigned long pfn, pgpr= ot_t prot) { } >>> =C2=A0 static void __init hugetlb_advanced_tests(struct mm_struct *mm= , >>> @@ -1053,7 +1055,9 @@ static int __init debug_vm_pgtable(void) >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pud_populate_tests(mm, pudp, saved_pmd= p); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 spin_unlock(ptl); >>> =C2=A0 -=C2=A0=C2=A0=C2=A0 //hugetlb_advanced_tests(mm, vma, ptep, pt= e_aligned, vaddr, prot); >>> +#ifndef CONFIG_PPC_BOOK3S_64 >>> +=C2=A0=C2=A0=C2=A0 hugetlb_advanced_tests(mm, vma, ptep, pte_aligned= , vaddr, prot); >>> +#endif >>> =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 spin_lock(&mm->page_table_lock)= ; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 p4d_clear_tests(mm, p4dp); >>> >=20 >=20