Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp571301rwp; Wed, 12 Jul 2023 19:11:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlFCeXLwaanb9FDPZndh787DoGl3+ujf0AqF+EgZiLWx2ZQF8D6Et4R5iblvU/vtwRdlkTxB X-Received: by 2002:a05:622a:588:b0:403:aeba:9c51 with SMTP id c8-20020a05622a058800b00403aeba9c51mr282206qtb.63.1689214268353; Wed, 12 Jul 2023 19:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689214268; cv=none; d=google.com; s=arc-20160816; b=L6tSoBxKuyFLV/Fntzt1rEqkSgwZzKlJUuWgZpvYWXGqEav90IGerICP7NZmA402y8 ByxKYsQWsf7pqrowo+sbcRFS2LTOXzkJAFWkT1tIi4eloEN+VQqfS2nd9s57hcKZk2j8 dDYER3Y5VZ7A56V5rH/4EG4plOCjZ7r4b0J5LSP3M/XT2si8uHzeYg0DMFXMuO3FGA6g Vs/D4wOKIHWpE1Sm03/82xKua7gIs9ufUjgoUPNCRlbhc+o2vUOniF+xP8t6qCBFq0xu 2aVlLihgu82f8nj30eae+BSfQQmyWt3Vpnkk0tRsG0w1fZZiKfM4lQtry7VZDSBgdUoE YAWg== 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:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=DqHFSQOzO/XxaRJXgZdmByKAXPqRNRjyMIQrSCq8enU=; fh=bAc3EqIx/ZjGbtleZ9lyuQYUzn33iTp5oGCqYmaDI7U=; b=HjQ1e+ybYthFkaVnxxt5UrM2DyQwOA9IEOjhbun82msDEzzy0bPggzkqnuZHqu0rlv LZBMiAdcdI4OP9ZprY1LhgApViPzz2sPn+HVlGvvJEab55kZ8Y8cs7fvUrxpcgCre7iu 5aVtyMgX+priz+9Fcj0GopgNZrRL6xuHN67OdmtAvdaAcb8YBnEX6D0NVnmIk85be6nN pyOTv8oeHdNeY8Cd4HHawBjcAFajpAhdrJQLwaySBwwObchQ8vtXSbfChloxzvhQXJkA JgOftJkNqkvnJ8Ya7TTsMiu9GB/gOFFqH6xfRcpCftjuUwpB8+Bu6i6Lvl2iQVXhdE55 OdHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=TR1zcSgL; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f13-20020a170902684d00b001a97a54c3a2si4262054pln.197.2023.07.12.19.10.54; Wed, 12 Jul 2023 19:11:08 -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=@gmail.com header.s=20221208 header.b=TR1zcSgL; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232412AbjGMBZH (ORCPT + 99 others); Wed, 12 Jul 2023 21:25:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231592AbjGMBZG (ORCPT ); Wed, 12 Jul 2023 21:25:06 -0400 Received: from mail-yw1-x1135.google.com (mail-yw1-x1135.google.com [IPv6:2607:f8b0:4864:20::1135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F7E61FDE for ; Wed, 12 Jul 2023 18:25:05 -0700 (PDT) Received: by mail-yw1-x1135.google.com with SMTP id 00721157ae682-570877f7838so691537b3.0 for ; Wed, 12 Jul 2023 18:25:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689211504; x=1691803504; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=DqHFSQOzO/XxaRJXgZdmByKAXPqRNRjyMIQrSCq8enU=; b=TR1zcSgLsGdmzMtZo6rrfSeyFREsDN1hEgUGIQnsUj6D/y4MixnzaKm0TUUXUraFwe 2F0LDbtwW4iuL6ZL9pCKL4rUTrOqCSCZZRR9ZFV0WoW1dkCim58yW/WWVsrghjNXlKHI 5KYpB2Da5i3luvXCWoava16QYYilQTAcmlSJnvpc2sIm3Zmk+G7Gv5Hr7YveQ4qOK4to SO/jex5T3nRzAkV4ClyWpLIIFaLioFJ+90gVR7MVjnXN8KDSJ8xzKMchFpyrSqxTLhyk ZfvVMbaN1aMIp7RpifwWEHhDY2vrz2gUCcIuHkwiugM9TNL+d82KgwTlzLyGMlc0psdx VCwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689211504; x=1691803504; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=DqHFSQOzO/XxaRJXgZdmByKAXPqRNRjyMIQrSCq8enU=; b=F03f+xscBGI4HKnF7maAD+QMJ8fscewas2n70mt/lHxDnUe78Icrx4ybWOZI6pc9lA 6Q8QtY5qitTotlS9ApaNJ7MxlPvNpdAY60jUwqsOCH9NbHaeNqQ7Whce7G9ycJiQmAc8 SsdW09CAegDEVobRExEn1hE23FCdGgHyqviMKQ7zf/LsJrhngNaSateld1ES11felTNy zapRCrhcZIgk0sbGCii4PmWHN9mgCW1nuDpKWbNbdZBLaV3gfjRLICEXi1t5HH32AZOp kIvHFbhDT0rCfDHOvOT6RcBkFXjaf99tLTCq2Ym4WjqASaeRxlI8RP72G9aTOByjf4s4 EsFg== X-Gm-Message-State: ABy/qLaiedwKXx1KjLIw/mhMrKTNlnDIo2ow7LU3R2RNsBCjEOMbRuWe pogIOqkyf4RjQNTVa3pg0pUFJJxR2lA= X-Received: by 2002:a0d:e615:0:b0:565:e48d:32cf with SMTP id p21-20020a0de615000000b00565e48d32cfmr366971ywe.7.1689211504176; Wed, 12 Jul 2023 18:25:04 -0700 (PDT) Received: from [0.0.0.0] ([5.180.77.117]) by smtp.gmail.com with ESMTPSA id b14-20020a170902b60e00b001ac591b0500sm4599862pls.134.2023.07.12.18.25.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Jul 2023 18:25:03 -0700 (PDT) Message-ID: Date: Thu, 13 Jul 2023 09:24:58 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH] riscv: correct pt_level name via pgtable_l5/4_enabled To: Palmer Dabbelt , alex@ghiti.fr Cc: Paul Walmsley , aou@eecs.berkeley.edu, alexghiti@rivosinc.com, Bjorn Topel , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org References: From: Song Shuai In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,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 在 2023/7/12 21:58, Palmer Dabbelt 写道: > On Tue, 11 Jul 2023 04:14:10 PDT (-0700), alex@ghiti.fr wrote: >> 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. > > Sometimes it's easier to base the fix on the original offending commit > and then forward-port it via a merge, I haven't looked at this one to > know for sure though. > >> Otherwise, you can add: >> >> Reviewed-by: Alexandre Ghiti > > Thanks. > > Song: do you have a v2 that addresses the comments? > Here is V2 : https://lore.kernel.org/linux-riscv/20230712115740.943324-1-suagrfillet@gmail.com/ >> >> Thanks, >> >> Alex -- Thanks Song Shuai