Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp585369ybv; Wed, 19 Feb 2020 05:25:02 -0800 (PST) X-Google-Smtp-Source: APXvYqwwNpap/9sd/PS2KJXg3/r695s7AsSQa1IdwBUdLNOp/UyAZD/G6lg1sVCXKxVFPFD18fKV X-Received: by 2002:aca:2114:: with SMTP id 20mr4322187oiz.9.1582118702567; Wed, 19 Feb 2020 05:25:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582118702; cv=none; d=google.com; s=arc-20160816; b=P7usc2m64uEhUQIxUu3BYQ2EK+J2vfvpr0S9iCC0fM9LspzLBr6woyR/PdHpA0Iz9A gUpMa4IpqvnqOKMEn1N9VMrZb0GrzpcfHpVFjQQqt8gjwjlJsVq26nJpNhm9pSOV9mHs VyV+zQXIXU2YEAs89remDm2pOh8KDF7gYhusR64UrBcqTqLnDyj44HbRFK8CgFtOR1Vg WFPOVZbsyusu/Bn6kxXDZaBq9Z6G+ifXHj/UoL4Wv8F+ZGefUPaZiCQugsJKjHPOpnlS Ps9g4CpIm2fuvoQuPpvS36Kkq2oyQwKzJL/vMC8SxPePRlrRNMeIKnG18oZVBzOeY7VS ML0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=NEohUZJaie54Ffw9FOpN2eLsZq1zPE2OtikKCsGkeHg=; b=RTDAPRu95TDxTz2ii4HO1SIk7wX0LV5tejinwoJH8LFPu2eD2rsfP/+nYL0d0jTJSf iVj+y3cf1DUZkgV0hWnbraXD4wlQihg6ez22umCW1m5XbF7QUx71sSOicgiQNpfDuvmm aQSaP7mgpYSzajtnNtB4NUrfYArD+CBOEjpd52lhcOYtySLPbUIWil93P0bxD/cSPQtX EsCjVlDZfEGZ/9Xie3Z/NXY+PM1gWZ34d3hc2shH9pXW87jZAly2ArofsyaRrFLf/y+g T3MiJyTZGTzhjlxdC1o2rKJwnhB2yVFZoJYTal9aeb7cbYHhT1jflIdtvKcpRZc6Tvzq srRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CrDKTg0K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 24si8635270oip.248.2020.02.19.05.24.49; Wed, 19 Feb 2020 05:25:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CrDKTg0K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727434AbgBSNYm (ORCPT + 99 others); Wed, 19 Feb 2020 08:24:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:33228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbgBSNYm (ORCPT ); Wed, 19 Feb 2020 08:24:42 -0500 Received: from hump (unknown [147.67.241.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 02D8B24654; Wed, 19 Feb 2020 13:24:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582118681; bh=WeK8iDiz+u7KGQl8xdyYvIuPvj8pRW13k3gZGmGmUOU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CrDKTg0KsoKO1U07yyagx89/mJ6hieOjLuM/lo6w3mB9Y9R+aQAidXZSv/ywuM3au r4bYkFE2ZGGFM/SSIBeOb3LJun+6yquvbVIUq2PH+U+U65CCtHToRoSUxXZ4LnlfNf XO/4CZv966+4qxBk+L+tbRqcMNDfbzR2x3+83oH0= Date: Wed, 19 Feb 2020 14:24:20 +0100 From: Mike Rapoport To: Christophe Leroy Cc: linux-kernel@vger.kernel.org, Andrew Morton , Arnd Bergmann , Benjamin Herrenschmidt , Brian Cain , Catalin Marinas , Fenghua Yu , Geert Uytterhoeven , Guan Xuetao , James Morse , Jonas Bonn , Julien Thierry , Ley Foon Tan , Marc Zyngier , Michael Ellerman , Paul Mackerras , Rich Felker , Russell King , Stafford Horne , Stefan Kristiansson , Suzuki K Poulose , Tony Luck , Will Deacon , Yoshinori Sato , kvmarm@lists.cs.columbia.edu, kvm-ppc@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, nios2-dev@lists.rocketboards.org, openrisc@lists.librecores.org, uclinux-h8-devel@lists.sourceforge.jp, Mike Rapoport Subject: Re: [PATCH v2 07/13] powerpc: add support for folded p4d page tables Message-ID: <20200219132420.GA5559@hump> References: <20200216081843.28670-1-rppt@kernel.org> <20200216081843.28670-8-rppt@kernel.org> <5b7c3929-5833-8ceb-85c8-a8e92e6a138e@c-s.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5b7c3929-5833-8ceb-85c8-a8e92e6a138e@c-s.fr> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 19, 2020 at 01:07:55PM +0100, Christophe Leroy wrote: > > Le 16/02/2020 ? 09:18, Mike Rapoport a ?crit?: > > diff --git a/arch/powerpc/mm/ptdump/ptdump.c b/arch/powerpc/mm/ptdump/ptdump.c > > index 206156255247..7bd4b81d5b5d 100644 > > --- a/arch/powerpc/mm/ptdump/ptdump.c > > +++ b/arch/powerpc/mm/ptdump/ptdump.c > > @@ -277,9 +277,9 @@ static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start) > > } > > } > > -static void walk_pud(struct pg_state *st, pgd_t *pgd, unsigned long start) > > +static void walk_pud(struct pg_state *st, p4d_t *p4d, unsigned long start) > > { > > - pud_t *pud = pud_offset(pgd, 0); > > + pud_t *pud = pud_offset(p4d, 0); > > unsigned long addr; > > unsigned int i; > > @@ -293,6 +293,22 @@ static void walk_pud(struct pg_state *st, pgd_t *pgd, unsigned long start) > > } > > } > > +static void walk_p4d(struct pg_state *st, pgd_t *pgd, unsigned long start) > > +{ > > + p4d_t *p4d = p4d_offset(pgd, 0); > > + unsigned long addr; > > + unsigned int i; > > + > > + for (i = 0; i < PTRS_PER_P4D; i++, p4d++) { > > + addr = start + i * P4D_SIZE; > > + if (!p4d_none(*p4d) && !p4d_is_leaf(*p4d)) > > + /* p4d exists */ > > + walk_pud(st, p4d, addr); > > + else > > + note_page(st, addr, 2, p4d_val(*p4d)); > > Level 2 is already used by walk_pud(). > > I think you have to increment the level used in walk_pud() and walk_pmd() > and walk_pte() Thanks for catching this! I'll fix the numbers in the next version. > > + } > > +} > > + > > static void walk_pagetables(struct pg_state *st) > > { > > unsigned int i; > > @@ -306,7 +322,7 @@ static void walk_pagetables(struct pg_state *st) > > for (i = pgd_index(addr); i < PTRS_PER_PGD; i++, pgd++, addr += PGDIR_SIZE) { > > if (!pgd_none(*pgd) && !pgd_is_leaf(*pgd)) > > /* pgd exists */ > > - walk_pud(st, pgd, addr); > > + walk_p4d(st, pgd, addr); > > else > > note_page(st, addr, 1, pgd_val(*pgd)); > > } > > Christophe -- Sincerely yours, Mike.