Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp1463986imk; Mon, 4 Jul 2022 03:43:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vE1DLbfwap19Pp4+s/I/rTmO1Ar9qMOq+OkDE3mzwCsLPTqIdM2LMWHcnAHQEgeTjdm55C X-Received: by 2002:a17:902:dad1:b0:16a:75cb:5d97 with SMTP id q17-20020a170902dad100b0016a75cb5d97mr35136289plx.64.1656931393355; Mon, 04 Jul 2022 03:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656931393; cv=none; d=google.com; s=arc-20160816; b=UTcev7n07hF/fFxWLGqqcOYUQic9alhGCI0d3l6xAVBclxFI421jlHUhx05jAAPXma g7M+HMY1cTm1pSOiqSDnXsLCH0P2hLpzuCA4vophg6QMUA86EpxRZgVaUE/ekgB5vITa NVR2NF23eqV8KG9hXKGWHwo7IO0QDXbwWVW5J3YiymL+LyGZir0sYtdqL9ex/N72CaEI vUyW1jDlAVw0IfU/OrCZ7dSnEmkSVR+/hj/BWoqmpSrSFyu3AyVGqwx7ACw38sN21c8i TfNlhynsIc2pDhWE+cTjfaJ8IN6/dwTl3v5ZtJqAU/ceruiu44POSgs1lcniY3oKlFHS eaJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=i+Ykkr7QihudOMA/IIpqZozG++x/ehG6+x1y1ApNITU=; b=Fn/dZyrA3aD++H9UUwhqay+gl1JDluWLpSNoeM6T6GGyZdIOJnHg5Fl2IhzMMuRtdH eZORjaT9qxjgkwNGo5ZJjONLRdACQiJeZYCGIxLa34KcJ6laEsq7l3MeU7nDJliKI36o WDjqsW++NfhC+RVpM1XIO4kqh15SDHL4fysec27QAK4XgzcwEDyuDX2lcNHE//HFfX12 Qr9ZPqEiPBQ0L/6PzRlxOn7mBeUZZXTfwWPG5LlJekc4dFiPI/3RDMAb0Za08B1SHTrz VPlQuvG2u45kHv1tEsI2UU26JEER5lWX7zvBhlsJD4dtH6R3Nv+0+TTkRO5JXeqmMxRq 8peg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IZwvcqpO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e11-20020a63744b000000b00411ef13203fsi13692877pgn.44.2022.07.04.03.43.01; Mon, 04 Jul 2022 03:43:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IZwvcqpO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229961AbiGDK3l (ORCPT + 99 others); Mon, 4 Jul 2022 06:29:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233023AbiGDK3j (ORCPT ); Mon, 4 Jul 2022 06:29:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E9EE2AED; Mon, 4 Jul 2022 03:29:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2B9BC61588; Mon, 4 Jul 2022 10:29:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91DE3C341CF; Mon, 4 Jul 2022 10:29:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656930577; bh=S1U7c4vumgaGxKIy+Le6U140pOZn3tAuCvMMwQCWlN8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=IZwvcqpOF372czI8gtJbB/SdCPkAimnJnkhBW/En4r1NZrW0u2J1+WHMwoUIu+wRU wguCC2iT/oy0oRQ1ii2t/CWWWKkHT57+4BArh3EDutEZMnyVCRPY00KRRfMQQUAYfX qZQMYBk0etV8ZOaN5iy1R5fxXvu4nayOuJEjCWOO7uOEg9eyp7ebCPkLXVQyYWEQ+E Z7yxB0B8Acw5gw6xlxYGCOk6ZRqEc9wpMfy2e4QQBeunLjA6QR+wQ+uAQYE4zFgrE2 eqcM8lkUPX7Gykmyv77q5hBMcUWwCursu9QZ7OgG85O4u86lONwQ8TALs1vJWwcImb m9Gt2xlVx7XSQ== Received: by mail-vs1-f54.google.com with SMTP id o13so8547966vsn.4; Mon, 04 Jul 2022 03:29:37 -0700 (PDT) X-Gm-Message-State: AJIora9ZhLA4DMyRlI2VMdGsRs0PitE2q7m9xycMlSq62BbL8SDvkBgE VBrpgjIgGwrOMwHPWrTGGDxlGJB7q5u77xxUEOo= X-Received: by 2002:a67:f958:0:b0:354:3f56:8a2d with SMTP id u24-20020a67f958000000b003543f568a2dmr15408042vsq.59.1656930576462; Mon, 04 Jul 2022 03:29:36 -0700 (PDT) MIME-Version: 1.0 References: <20220702080021.1167190-1-chenhuacai@loongson.cn> <20220702080021.1167190-4-chenhuacai@loongson.cn> <20220704092658.GA31220@willie-the-truck> In-Reply-To: <20220704092658.GA31220@willie-the-truck> From: Huacai Chen Date: Mon, 4 Jul 2022 18:29:24 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V3 3/4] mm/sparse-vmemmap: Generalise vmemmap_populate_hugepages() To: Will Deacon Cc: Huacai Chen , Arnd Bergmann , Thomas Bogendoerfer , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Catalin Marinas , loongarch@lists.linux.dev, linux-arch , Xuefeng Li , Guo Ren , Xuerui Wang , Jiaxun Yang , Andrew Morton , Linux-MM , "open list:MIPS" , LKML , linux-arm-kernel , Feiyang Chen Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Will, On Mon, Jul 4, 2022 at 5:27 PM Will Deacon wrote: > > On Sat, Jul 02, 2022 at 04:00:20PM +0800, Huacai Chen wrote: > > From: Feiyang Chen > > > > Generalise vmemmap_populate_hugepages() so ARM64 & X86 & LoongArch can > > share its implementation. > > > > Signed-off-by: Feiyang Chen > > Signed-off-by: Huacai Chen > > --- > > arch/arm64/mm/mmu.c | 53 ++++++----------------- > > arch/loongarch/mm/init.c | 63 ++++++++------------------- > > arch/x86/mm/init_64.c | 92 ++++++++++++++-------------------------- > > include/linux/mm.h | 6 +++ > > mm/sparse-vmemmap.c | 54 +++++++++++++++++++++++ > > 5 files changed, 124 insertions(+), 144 deletions(-) > > > > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > > index 626ec32873c6..b080a65c719d 100644 > > --- a/arch/arm64/mm/mmu.c > > +++ b/arch/arm64/mm/mmu.c > > @@ -1158,49 +1158,24 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node, > > return vmemmap_populate_basepages(start, end, node, altmap); > > } > > #else /* !ARM64_KERNEL_USES_PMD_MAPS */ > > +void __meminit vmemmap_set_pmd(pmd_t *pmd, void *p, int node, > > + unsigned long addr, unsigned long next) > > +{ > > + pmd_set_huge(pmd, __pa(p), __pgprot(PROT_SECT_NORMAL)); > > +} > > + > > +int __meminit vmemmap_check_pmd(pmd_t *pmd, int node, unsigned long addr, > > + unsigned long next) > > +{ > > + vmemmap_verify((pte_t *)pmd, node, addr, next); > > + return 1; > > +} > > nit, but please can you use 'pmdp' instead of 'pmd' for the pointers? We're > pretty consistent elsewhere for arch/arm64 and it makes the READ_ONCE() > usage easier to follow once functions end up loading the entry. OK, I will change to pmdp for ARM64, thanks. Huacai > > Thanks, > > Will