Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 960DBC678D4 for ; Thu, 2 Mar 2023 07:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229658AbjCBH5R (ORCPT ); Thu, 2 Mar 2023 02:57:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjCBH5P (ORCPT ); Thu, 2 Mar 2023 02:57:15 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 551E934300; Wed, 1 Mar 2023 23:57:14 -0800 (PST) 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 24BF71FB; Wed, 1 Mar 2023 23:57:57 -0800 (PST) Received: from [10.162.41.9] (unknown [10.162.41.9]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4FC573F587; Wed, 1 Mar 2023 23:57:11 -0800 (PST) Message-ID: <1fa898da-efdf-cf39-4be9-1d0354d3fa41@arm.com> Date: Thu, 2 Mar 2023 13:27:08 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH] mm/debug_vm_pgtable: Replace pte_mkhuge() with arch_make_huge_pte() Content-Language: en-US To: Christophe Leroy , "linux-mm@kvack.org" Cc: "david@redhat.com" , "mike.kravetz@oracle.com" , Jonathan Corbet , Andrew Morton , "Mike Rapoport (IBM)" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20230302031833.360679-1-anshuman.khandual@arm.com> <94473cc4-f84f-d42d-2bd1-b6389d8c9ab3@csgroup.eu> From: Anshuman Khandual In-Reply-To: <94473cc4-f84f-d42d-2bd1-b6389d8c9ab3@csgroup.eu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/2/23 12:31, Christophe Leroy wrote: > > > Le 02/03/2023 à 04:18, Anshuman Khandual a écrit : >> Since the following commit arch_make_huge_pte() should be used directly in >> generic memory subsystem as a platform provided page table helper, instead >> of pte_mkhuge(). Change hugetlb_basic_tests() to call arch_make_huge_pte() >> directly, and update its relevant documentation entry as required. >> >> 'commit 16785bd77431 ("mm: merge pte_mkhuge() call into arch_make_huge_pte()")' >> >> Cc: Jonathan Corbet >> Cc: Andrew Morton >> Cc: "Mike Rapoport (IBM)" >> Cc: linux-doc@vger.kernel.org >> Cc: linux-kernel@vger.kernel.org >> Cc: linux-mm@kvack.org >> Reported-by: Christophe Leroy >> Link: https://lore.kernel.org/all/1ea45095-0926-a56a-a273-816709e9075e@csgroup.eu/ >> Signed-off-by: Anshuman Khandual >> --- >> This applies on latest mainline. >> >> Documentation/mm/arch_pgtable_helpers.rst | 2 +- >> mm/debug_vm_pgtable.c | 2 +- >> 2 files changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/Documentation/mm/arch_pgtable_helpers.rst b/Documentation/mm/arch_pgtable_helpers.rst >> index 30d9a09f01f4..af3891f895b0 100644 >> --- a/Documentation/mm/arch_pgtable_helpers.rst >> +++ b/Documentation/mm/arch_pgtable_helpers.rst >> @@ -214,7 +214,7 @@ HugeTLB Page Table Helpers >> +---------------------------+--------------------------------------------------+ >> | pte_huge | Tests a HugeTLB | >> +---------------------------+--------------------------------------------------+ >> -| pte_mkhuge | Creates a HugeTLB | >> +| arch_make_huge_pte | Creates a HugeTLB | >> +---------------------------+--------------------------------------------------+ >> | huge_pte_dirty | Tests a dirty HugeTLB | >> +---------------------------+--------------------------------------------------+ >> diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c >> index af59cc7bd307..92bed5bd5879 100644 >> --- a/mm/debug_vm_pgtable.c >> +++ b/mm/debug_vm_pgtable.c >> @@ -934,7 +934,7 @@ static void __init hugetlb_basic_tests(struct pgtable_debug_args *args) >> #ifdef CONFIG_ARCH_WANT_GENERAL_HUGETLB >> pte = pfn_pte(args->fixed_pmd_pfn, args->page_prot); >> >> - WARN_ON(!pte_huge(pte_mkhuge(pte))); >> + WARN_ON(!pte_huge(arch_make_huge_pte(pte))); > > Did you build it ? Ahh bad ! Built on arm64 which does not subscribe ARCH_WANT_GENERAL_HUGETLB. > > arch_make_huge_pte() need 3 arguments. Could call it with constants such as PMD_SHIFT and standard vm_flags without involving real arg based values (as they are not initialized for HugeTLB). But wondering if platform arch_make_huge_pte() implementation might complain. arch_make_huge_pte(pte, PMD_SHIFT, VM_READ | VM_WRITE)