Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp36687323rwd; Tue, 11 Jul 2023 04:33:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlGxtnOu3x9vOuP37x9eqmPhWN92ohz2Uo/TsD+P3xflP5yMWlcmdwrA1/ze2o3wooo93goy X-Received: by 2002:a05:6a21:6d8e:b0:131:eeba:1260 with SMTP id wl14-20020a056a216d8e00b00131eeba1260mr3366902pzb.29.1689075183879; Tue, 11 Jul 2023 04:33:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689075183; cv=none; d=google.com; s=arc-20160816; b=sycpwjkxAzx3jsqPTsBYhglsQBjdvhpDLOFbeQvEzeRAx8np6VREzZLuCC34LH2fAk Rizw2xydzI3Vu/E+tfPgEWlEnMn/6pq23whsm7efBOvmNgOO832nmnPkgghmTIW7pecL gjgNFS6Ba3HYWiqPs0rxbuS+6keIpqVMNXBuIB4IAfMB4CH8nYRg/OX4o8rVbSRx4/qM 4+oMZ1q8J4pjhscIzlECpbgCF4RzIEr4rFTAN5SipO2s77PKhwN5p4FK/Z40lq3i05fn K3VnpakdUtyxPxRRNUbkZt/QqPUkTGYxU35ESnGdhW6kCTeU/iaicQIPFX8xIKtDoO+2 ddFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=1eJ7aw0W1PlYsCbGey5vvM7E3NJpHFujX0KhPwI7nlw=; fh=9MM9ZETnYJ/li1noVJvbhctVwpKwJFrXxtwzJKQnJn8=; b=oXjUJTrcBMIoXW1cO/xXvgLxawScIzrIpXkJk4Od4nvXi+/2CbZAlrRlGw9w7wbtOo 8GtOsAzNBJHNcEC62yu0ZaS2EgbGHSWFy+O/UMr/2wVmJ6IrpvgE1SuxiVUX2p1EVDHB BDgInRtAXtpDExbrB2cO42CgxT5B3JZdOu825XNO88MrKbHk9v5cyuIsEkRZnGkUkEeG uIpf9bOzLsTYu+ibn8f3KAZX/8iQHK2X2zYA7/74/L78idHL0/XZ7xuUo2Yn0wY/QrMv 6oms0WmDInuoiZ5URf87M0Nt0yn7Ej1HJKbqtxpQYWctNE2puigxtXl9gTlWB3r5Oeu7 VduA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t6-20020a6564c6000000b0054fe2dfaabcsi1301205pgv.526.2023.07.11.04.32.51; Tue, 11 Jul 2023 04:33:03 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231661AbjGKLOS (ORCPT + 99 others); Tue, 11 Jul 2023 07:14:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231654AbjGKLOR (ORCPT ); Tue, 11 Jul 2023 07:14:17 -0400 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2726998 for ; Tue, 11 Jul 2023 04:14:15 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id B4EF6240005; Tue, 11 Jul 2023 11:14:10 +0000 (UTC) Message-ID: Date: Tue, 11 Jul 2023 13:14:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] riscv: correct pt_level name via pgtable_l5/4_enabled Content-Language: en-US To: Song Shuai , paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, alexghiti@rivosinc.com, bjorn@rivosinc.com Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org References: <20230711105202.842408-1-suagrfillet@gmail.com> From: Alexandre Ghiti In-Reply-To: <20230711105202.842408-1-suagrfillet@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-GND-Sasl: alex@ghiti.fr X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,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 Song, On 11/07/2023 12:52, Song Shuai wrote: > The pt_level uses CONFIG_PGTABLE_LEVELS to display page table names. > But if downgrading page mode from kernel cmdline in 64BIT, it will > give a wrong name. > > Like, using no4lvl for sv39, ptdump named the 1G-mapping as "PUD" > that should be "PGD": > > 0xffffffd840000000-0xffffffd900000000 0x00000000c0000000 3G PUD D A G . . W R V > > So select "P4D/PUD" or "PGD" via pgtable_l5/4_enabled to correct it. > > Fixes: 26e7aacb83df ("riscv: Allow to downgrade paging mode from the command line") > Signed-off-by: Song Shuai > --- > arch/riscv/mm/ptdump.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/riscv/mm/ptdump.c b/arch/riscv/mm/ptdump.c > index 20a9f991a6d7..cfdd327981ee 100644 > --- a/arch/riscv/mm/ptdump.c > +++ b/arch/riscv/mm/ptdump.c > @@ -384,6 +384,11 @@ static int __init ptdump_init(void) > > kernel_ptd_info.base_addr = KERN_VIRT_START; > > +#ifdef CONFIG_64BIT > + pg_level[1].name = pgtable_l5_enabled ? "P4D" : "PGD"; > + pg_level[2].name = pgtable_l4_enabled ? "PUD" : "PGD"; > +#endif You don't need the #ifdef here as pgtable_lX_enabled are always declared. > + > for (i = 0; i < ARRAY_SIZE(pg_level); i++) > for (j = 0; j < ARRAY_SIZE(pte_bits); j++) > pg_level[i].mask |= pte_bits[j].mask; The Fixes tag is wrong to me, if satp mode is restricted by the hardware itself (not from the command line), the same problem happens. Maybe that should be the sv48 introduction patch? Or the sv57? It will be more cumbersome to backport with the sv48 introduction though as this patch won't apply as-is. Otherwise, you can add: Reviewed-by: Alexandre Ghiti Thanks, Alex