Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2461436imb; Mon, 4 Mar 2019 05:53:26 -0800 (PST) X-Google-Smtp-Source: APXvYqwoHgjft4n1K+Gywx0dpn2YyBmq1ZcZRq/Zb65nUPyw1/+c2axvLz9Cms9BqXThSVhq9E5N X-Received: by 2002:a63:d5f:: with SMTP id 31mr18582240pgn.274.1551707606701; Mon, 04 Mar 2019 05:53:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551707606; cv=none; d=google.com; s=arc-20160816; b=P6zClxNGWAD5gQ8obbjz/fV1oaak9Ux721g39Xrx0C0xfp54BZI7nbHhoNu9Bel+MP LM/SbNJ8g211ri0ETk/SxAysnX1ymuNXy76w3nHLu3BS2ccLUrf7exCIK8SfoPOmlkFf KvR5EL2a1irVlkWXp0vTtJv/WFHQqMqaq14kn27npsXLys+rQwDaaai7001L0S9jgZCE rt9iZSZ+JSxHAXA87AFNwaEh3ZTzfFbTHuLIMJpQ7NrK6eNEoQqsyHNnRmt+zet2g4lQ m9bfDZ9TyuhIpa16lomfLm5qmSW7ecwEuysOr7bobHfqP0MgIu3goJxlonMCaYrc7viu 1vzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=i+uJsIH9vVyOV5Tk28y23klIfxYci68lEiPowiIlx3E=; b=wpd/sDJtgVkohyoclYVqiEVeH4fAEF8s4j18b3w2PaSkKX+ZDeyRUx1pqSh2Wurxjs yNrOllkOPx6XW09kpiWuAwsC7wyuci61indfabK7Thg5FDR+lZlulXPXhoP3uHQ7eQRz UCuq/7bZh69kjxZsW464snENP0Ou2V+Zsj0cJMGQu/sld56QiEEkIpSSGLCcIJ2/iE1w KjqPzrCryIPiztpIx5ZWA7B0P646xhZAQrxRJjaXRLDqYSXWY2Rm5h1cW9RQ/QWZir1b jIaLXQn9Wfbc1nbwjuE8R16TYwJFub1qr/+lRkhFUaf3Ykpc/13M376pgsWl4csEYE2e nGCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=sddgU2aR; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z8si5366683pfi.232.2019.03.04.05.53.11; Mon, 04 Mar 2019 05:53:26 -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=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=sddgU2aR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726786AbfCDNLA (ORCPT + 99 others); Mon, 4 Mar 2019 08:11:00 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:40984 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726094AbfCDNK7 (ORCPT ); Mon, 4 Mar 2019 08:10:59 -0500 Received: by mail-pf1-f193.google.com with SMTP id d25so3000733pfn.8 for ; Mon, 04 Mar 2019 05:10:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=i+uJsIH9vVyOV5Tk28y23klIfxYci68lEiPowiIlx3E=; b=sddgU2aRtJ2zYqDNcOUZzUk3M/eU6C/dPxzI/yarFrk5YXqKXTlkj9+V6Ej1gWGl5S 0Y00j8efBGBPNa38B9fwNBevPWrW4bRQn/oqwpPZl2mEOu7VDUlL2/NWR7kGcp/8ayOP N0WFcpQyvsiYdHTddw0D88Z+w4eW1PNS5EVEa0YW+pdelsy46Nk5okbwiL+l56G1rLRp 29tRCiS9Q840vVihdOrq3YC8lfunYrw3EvcMZxWUyrk195VG02sK+7l5nCxai5WslBOr mtj248N5e1raENfLI4cliIs/J1DmKCHFfC8aLYUNyNcKMYIUGSOidPjGzeTm7Brf/ltu pTEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=i+uJsIH9vVyOV5Tk28y23klIfxYci68lEiPowiIlx3E=; b=nmnrDjpDO0vN/WMi39oTbVV4AF4VYSv7ds50QZ/LpoeXdUwX3E6wmFkwYnHHOUCPLj Y3bp14zgOLF0Kl7LGvcHMiT6eHqFpmvhyjwebTLmh9Ab2CVksXQwqVMRzjOoUsKQQNDG wNs6bCIvsaEhevhIA8i4jXUMDOGc7N7az6ltHDJXLjiW2d6NrE0iPmFRy6ci98qOGlH2 jZQDwZxTwtjkEiow47Xe7V8w1pbkjxlaL0dNOtwbX5eQZv4OBmr22oM6zlBN20uuD3BH Ryc6tcpy9n0JIJLnoMO2JD1sU5jVZAfbX2p6+cpnr8W/hCxNByn820MiNz7tq5ChHZv2 6RUw== X-Gm-Message-State: APjAAAXZ/XtXOIo6OU7gnN7l3NpQ14GEddZ15czUf3+Y09LAD+hjfEf/ lFSaYJK49bVuv2Cla+yULDukow== X-Received: by 2002:a17:902:9a48:: with SMTP id x8mr13344843plv.98.1551705058879; Mon, 04 Mar 2019 05:10:58 -0800 (PST) Received: from kshutemo-mobl1.localdomain ([134.134.139.83]) by smtp.gmail.com with ESMTPSA id 20sm8185700pgr.80.2019.03.04.05.10.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Mar 2019 05:10:58 -0800 (PST) Received: by kshutemo-mobl1.localdomain (Postfix, from userid 1000) id 72ACC300429; Mon, 4 Mar 2019 16:10:54 +0300 (+03) Date: Mon, 4 Mar 2019 16:10:54 +0300 From: "Kirill A. Shutemov" To: Steven Price Cc: Mark Rutland , x86@kernel.org, Arnd Bergmann , Ard Biesheuvel , Peter Zijlstra , Catalin Marinas , Dave Hansen , Will Deacon , linux-kernel@vger.kernel.org, Russell King , linux-mm@kvack.org, =?utf-8?B?SsOpcsO0bWU=?= Glisse , Ingo Molnar , Borislav Petkov , Andy Lutomirski , "H. Peter Anvin" , James Morse , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, "Liang, Kan" Subject: Re: [PATCH v3 03/34] arm: mm: Add p?d_large() definitions Message-ID: <20190304131054.goxpqsosolkg7khf@kshutemo-mobl1> References: <20190227170608.27963-1-steven.price@arm.com> <20190227170608.27963-4-steven.price@arm.com> <20190301214715.hyzy5tevvwgki4w5@kshutemo-mobl1> <974310a0-0114-9a0c-9041-4e0394c4b9aa@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <974310a0-0114-9a0c-9041-4e0394c4b9aa@arm.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 04, 2019 at 11:56:13AM +0000, Steven Price wrote: > On 01/03/2019 21:47, Kirill A. Shutemov wrote: > > On Wed, Feb 27, 2019 at 05:05:37PM +0000, Steven Price wrote: > >> walk_page_range() is going to be allowed to walk page tables other than > >> those of user space. For this it needs to know when it has reached a > >> 'leaf' entry in the page tables. This information will be provided by the > >> p?d_large() functions/macros. > >> > >> For arm, we already provide most p?d_large() macros. Add a stub for PUD > >> as we don't have huge pages at that level. > > > > We do not have PUD for 2- and 3-level paging. Macros from generic header > > should cover it, shouldn't it? > > > > I'm not sure of the reasoning behind this, but levels are folded in a > slightly strange way. arm/include/asm/pgtable.h defines > __ARCH_USE_5LEVEL_HACK which means: > > PGD has 2048 (2-level) or 4 (3-level) entries which are always > considered 'present' (pgd_present() returns 1 defined in > asm-generic/pgtables-nop4d-hack.h). > > P4D has 1 entry which is always present (see asm-generic/5level-fixup.h) > > PUD has 1 entry (see asm-generic/pgtable-nop4d-hack.h). This is always > present for 2-level, and present only if the first level of real page > table is present with a 3-level. > > PMD/PTE are as you might expect. > > So in terms of tables which are more than one entry you have PGD, > (optionally) PMD, PTE. But the levels which actually read the table > entries are PUD, PMD, PTE. > > This means that the corresponding p?d_large() macros are needed for > PUD/PMD as that is where the actual entries are read. The asm-generic > files provide the definitions for PGD/P4D. Makes sense. Only additional thing worth nothing that ARM in 2-level paging case folds PMD manually without help from generic headres. I'm partly responsible for the mess with folding. Sorry that you need to explain this to :P -- Kirill A. Shutemov