Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp958320pxb; Thu, 15 Apr 2021 10:20:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1+v+JpqAbjNQgCjz7XBBWrH5oxR/IxjCnFv0PzACDKF85DO2nsZmBDdk24EQzaejiUmr+ X-Received: by 2002:a05:6402:441:: with SMTP id p1mr5516225edw.298.1618507210192; Thu, 15 Apr 2021 10:20:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618507210; cv=none; d=google.com; s=arc-20160816; b=aYdJO3OhESWVop+rtQTbCbpW3xLoxZUT+cfgraLX1wL3CIckXHCQP8NezFxEQvOtsO w7eoU0zFEqDwtBtRfxoXmh+kPpcFhyA0cgI21uOKhCt+/+/QG7812dwew0GEaxu23xkU xHK9kHj/W8wW/+gEhoGhc5cC6Eu6/C2vlhHIGxOhVQRzcBVy/smNm5H7cTvBUwhljhsR ReVagHCUaCi4Gn6J34EwM6FIMX8t5dt4ouGaFzaRSmGOFmiGG+wq02OW6XmDjuY0SnAA 7zAJ8i+UywQugaVQ6JI/JryRptzHWB6VbDl1klBUI+YE6wF0iSycBGZPZetiAyzGaPGm pppA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:cc:to:subject:from:references:in-reply-to :message-id; bh=fh+2ixoLTPew6SeovzvmzT1cMZnLdSwFOwmbVP8LXs4=; b=idIzAW8YnMSEV8JvKKh18yF0ezUUr9dUbtr2uE4KnH3H4nonGz+qZfAfDk5pgYf7x/ BiUbBwp98I5YDzxd7QXuoAoU7YaSA0dQMi3tw6HYRn0dPTAnXD+1r+An7Hv1ndgZsV7V +ZJ8JCBAFtqcDCXKoSv3qQ2UzIiDu4UFRQDQWZ8IMwppZQkTc5WngWLM2hhIg5yCOx+m cnlsl5FobzodlvoE83w78cBycW9sDM2wbIjWxVgC6X5l3OORkewfI+lnlIMQ/aiFsk42 WsULQb8J2P9VOJTVGSDf+IBxEUTla1Ik6PJdf2b/PylsJuxR0xIGpPPqx91lvRYVCTuW 1QZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u19si2861259edo.583.2021.04.15.10.19.46; Thu, 15 Apr 2021 10:20:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234458AbhDORS4 (ORCPT + 99 others); Thu, 15 Apr 2021 13:18:56 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:15894 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234068AbhDORSm (ORCPT ); Thu, 15 Apr 2021 13:18:42 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4FLmJV2HD4z9twp2; Thu, 15 Apr 2021 19:18:18 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id sbTtLwb0wT4h; Thu, 15 Apr 2021 19:18:18 +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 4FLmJV1TDDz9twp0; Thu, 15 Apr 2021 19:18:18 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 080EE8B805; Thu, 15 Apr 2021 19:18:18 +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 0MknObgQkv_3; Thu, 15 Apr 2021 19:18:17 +0200 (CEST) Received: from po16121vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B838C8B7F6; Thu, 15 Apr 2021 19:18:17 +0200 (CEST) Received: by po16121vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 96B23679F6; Thu, 15 Apr 2021 17:18:17 +0000 (UTC) Message-Id: In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v1 4/5] mm: ptdump: Support hugepd table entries To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Steven Price , akpm@linux-foundation.org Cc: linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, x86@kernel.org, linux-mm@kvack.org Date: Thu, 15 Apr 2021 17:18:17 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Which hugepd, page table entries can be at any level and can be of any size. Add support for them. Signed-off-by: Christophe Leroy --- mm/ptdump.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/mm/ptdump.c b/mm/ptdump.c index 61cd16afb1c8..6efdb8c15a7d 100644 --- a/mm/ptdump.c +++ b/mm/ptdump.c @@ -112,11 +112,24 @@ static int ptdump_pte_entry(pte_t *pte, unsigned long addr, { struct ptdump_state *st = walk->private; pte_t val = ptep_get(pte); + unsigned long page_size = next - addr; + int level; + + if (page_size >= PGDIR_SIZE) + level = 0; + else if (page_size >= P4D_SIZE) + level = 1; + else if (page_size >= PUD_SIZE) + level = 2; + else if (page_size >= PMD_SIZE) + level = 3; + else + level = 4; if (st->effective_prot) - st->effective_prot(st, 4, pte_val(val)); + st->effective_prot(st, level, pte_val(val)); - st->note_page(st, addr, 4, pte_val(val), PAGE_SIZE); + st->note_page(st, addr, level, pte_val(val), page_size); return 0; } -- 2.25.0