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=-7.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 E17EDC2B9F4 for ; Mon, 28 Jun 2021 05:56:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BFEAA613EF for ; Mon, 28 Jun 2021 05:56:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232181AbhF1F6x (ORCPT ); Mon, 28 Jun 2021 01:58:53 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:60420 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232172AbhF1F6w (ORCPT ); Mon, 28 Jun 2021 01:58:52 -0400 Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4GCxgV1Yc3zBBlp; Mon, 28 Jun 2021 07:56:22 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XDK_m3pCk78b; Mon, 28 Jun 2021 07:56:22 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4GCxgV0d9PzBBgx; Mon, 28 Jun 2021 07:56:22 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id ECF008B776; Mon, 28 Jun 2021 07:56:21 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id QcdPGwq5KisL; Mon, 28 Jun 2021 07:56:21 +0200 (CEST) Received: from [172.25.230.102] (po15451.idsi0.si.c-s.fr [172.25.230.102]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B1C728B763; Mon, 28 Jun 2021 07:56:21 +0200 (CEST) Subject: Re: [PATCH v3] mm: pagewalk: Fix walk for hugepage tables To: Andrew Morton Cc: Steven Price , linux-mm@kvack.org, Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , dja@axtens.net, Oliver O'Halloran , linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <38d04410700c8d02f28ba37e020b62c55d6f3d2c.1624597695.git.christophe.leroy@csgroup.eu> <20210627181226.983d899cc30c02420e1a6af5@linux-foundation.org> From: Christophe Leroy Message-ID: Date: Mon, 28 Jun 2021 07:56:20 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210627181226.983d899cc30c02420e1a6af5@linux-foundation.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 28/06/2021 à 03:12, Andrew Morton a écrit : > On Fri, 25 Jun 2021 05:10:12 +0000 (UTC) Christophe Leroy wrote: > >> Pagewalk ignores hugepd entries and walk down the tables >> as if it was traditionnal entries, leading to crazy result. >> >> Add walk_hugepd_range() and use it to walk hugepage tables. > > More details, please? I assume "crazy result" is userspace visible? > For how long has this bug existed? Is a -stable backport needed? Has > a Fixes: commit been identified? etcetera! > I discovered the problem while porting powerpc to generic page table dump. The generic page table dump uses walk_page_range_novma() . Yes, "crazy result" is that when dumping /sys/kernel/debug/kernel_page_tables, you get random entries because at the time being the pagewalk code sees huge page directories as standard page tables. The bug has always existed as far as I can see, but as no other architectures than powerpc use huge page directories, it only pops up now when powerpc is trying to use that generic page walking code. So I don't think it is worth a backport to -stable, and about a Fixes: tag I don't know. IIUC, hugepd was introduced for the first time in mm by commit cbd34da7dc9a ("mm: move the powerpc hugepd code to mm/gup.c") Before that, hugepd was internal to powerpc. I guess you are asking about Fixes: tag and backporting because of the patch subject. Should I reword the page subject to something like "mm: enable the generic page walk code to walk huge page directories" ?