From patchwork Wed Feb 27 17:05:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831913 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3E4E415AC for ; Wed, 27 Feb 2019 17:06:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A7D62E2E9 for ; Wed, 27 Feb 2019 17:06:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B5592E305; Wed, 27 Feb 2019 17:06:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A374F2E2F5 for ; Wed, 27 Feb 2019 17:06:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 516BA8E0005; Wed, 27 Feb 2019 12:06:35 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4C5C78E0001; Wed, 27 Feb 2019 12:06:35 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 31E028E0005; Wed, 27 Feb 2019 12:06:35 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id C9CB68E0001 for ; Wed, 27 Feb 2019 12:06:34 -0500 (EST) Received: by mail-ed1-f69.google.com with SMTP id d31so7236708eda.1 for ; Wed, 27 Feb 2019 09:06:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=6FoKm4T/vulm4WLeNhgEiUXQspfPhFcFQ9eklNtsPfA=; b=I/F3zalIatLP+CQBuBzSY2FXkzOzolVD/SQ6zNaaMn67Snpq7hGx6PYUP4VFyZ5tXF 38+vgexeJKzFze4x607UM4oEnB6mPZ8kZp6J9SoMN9BCORQGTcxWTic93o4WAzCafdzd Yh7+8wbHy665+Wuq7xIaZdPP71vX2NIr77J3vCJigV3rQJ3WhE8P5JFfZHOOQsAfM5XD aDJh1qCiGzoV0pZrwOZI1DEqwfPc8mSCS6xlw204zbvbWHmc0hi/Svy7UZyKbULYJDsk HeWFAeMCdlSusCdw/ywKKc8+tybKmZ5f54fdj0QvfFQ7jkUHuiv7E3eTlUAxGIf31sEn cU+g== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuZx6uGirf4re7anvW1ZvfIwTFGbkfYQ0KWhvIL7SzVwYkyM3Hkb FE8ExVlgPCjU8xsMMPC52n+dcTIhJFODSPT2X5CPW+UpYZDpt5PKdjiHk6xl7xP5He15Xh2hjYa SDMySJ6qxQiNncJ4X8zdj10ci5juc22bCM6nTK7KS0rxFoNkov6LzbEFPFEjL5s9fpw== X-Received: by 2002:a17:906:7621:: with SMTP id c1mr2294852ejn.47.1551287194278; Wed, 27 Feb 2019 09:06:34 -0800 (PST) X-Google-Smtp-Source: AHgI3IZStC6IxWqlAsK3JascZaVoxTQV1z77068N3ylgXF8NbWZw7KMWYjO4gGmltbnCyUZPK56e X-Received: by 2002:a17:906:7621:: with SMTP id c1mr2294798ejn.47.1551287193264; Wed, 27 Feb 2019 09:06:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287193; cv=none; d=google.com; s=arc-20160816; b=GJHqMLljhpVBZMvT/MSt8ecE46ouUWlSf0xj+6K3x5eBvDPJ93a6+J6f+hxB/hxIX6 xPizgTCogGyRhyIXXP6gA1cCtCg7JWx9GUHJmDcWx7eRFPpdvyig2VhN+CM1GIiztdtt CyRqD7M/MwBqkmE8p5tOPVYdWKnFzBIu89lCSRio4tI1ztOuu8j3RXPPgfa+qAU4nudZ B5jPjacHTJWqzt+hQEkKKpgwEJSrIU7GPLMFEl5BTLT1+/bLewOGRG1vjU9AZc5LeiSp RJkOhRzteEKmvUYvGiEf+pzuuUJu2obMEPfj1wG/twW7EbsRidoEmbwe7nrmHFvkT19Q m8Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=6FoKm4T/vulm4WLeNhgEiUXQspfPhFcFQ9eklNtsPfA=; b=A4IHDSFTVAWUCIFpNWjMV8rs+8gR+PQIRcqzWy6ig8UxRlkma63CuuEwja26pYLqQR YaDEVMiLN2RSBYHse3ybcLtXJ8YqbJFewZX48fHEgzw0mLWKbD+HJwTPqmkwlpOj7zP7 FBRHzu4btiUXCfseABjG9/j1pN+Ib0KCVkm9xq7PJmOerWXRi50cWF6h2GMGj1ZWRoR6 zHeqEo/mKLCObBH8Yz9QHrorHIM1FeB4iE4Xz+XSFLSvo6RHhjZB9n6a/pAiXZ3jzJ0Z kdjdZlFZDDFeK0WBbKLO7gYEhQRK5wbhNuYkuqsJWHzl/j6h8P1o4nLQT3lWebnAEfeq oHhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id n30si5344087edd.3.2019.02.27.09.06.32 for ; Wed, 27 Feb 2019 09:06:33 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2E2BD1684; Wed, 27 Feb 2019 09:06:32 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5A1D23F738; Wed, 27 Feb 2019 09:06:28 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , linux-alpha@vger.kernel.org, Richard Henderson , Ivan Kokshaysky , Matt Turner Subject: [PATCH v3 01/34] alpha: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:35 +0000 Message-Id: <20190227170608.27963-2-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 alpha, we don't support huge pages, so add stubs returning 0. CC: linux-alpha@vger.kernel.org CC: Richard Henderson CC: Ivan Kokshaysky CC: Matt Turner Signed-off-by: Steven Price --- arch/alpha/include/asm/pgtable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/alpha/include/asm/pgtable.h b/arch/alpha/include/asm/pgtable.h index 89c2032f9960..e5726d3a3200 100644 --- a/arch/alpha/include/asm/pgtable.h +++ b/arch/alpha/include/asm/pgtable.h @@ -254,11 +254,13 @@ extern inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt extern inline int pmd_none(pmd_t pmd) { return !pmd_val(pmd); } extern inline int pmd_bad(pmd_t pmd) { return (pmd_val(pmd) & ~_PFN_MASK) != _PAGE_TABLE; } extern inline int pmd_present(pmd_t pmd) { return pmd_val(pmd) & _PAGE_VALID; } +extern inline int pmd_large(pmd_t pmd) { return 0; } extern inline void pmd_clear(pmd_t * pmdp) { pmd_val(*pmdp) = 0; } extern inline int pgd_none(pgd_t pgd) { return !pgd_val(pgd); } extern inline int pgd_bad(pgd_t pgd) { return (pgd_val(pgd) & ~_PFN_MASK) != _PAGE_TABLE; } extern inline int pgd_present(pgd_t pgd) { return pgd_val(pgd) & _PAGE_VALID; } +extern inline int pgd_large(pgd_t pgd) { return 0; } extern inline void pgd_clear(pgd_t * pgdp) { pgd_val(*pgdp) = 0; } /* From patchwork Wed Feb 27 17:05:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831915 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 67EA91390 for ; Wed, 27 Feb 2019 17:06:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FD692E2E9 for ; Wed, 27 Feb 2019 17:06:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40BC42E305; Wed, 27 Feb 2019 17:06:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB13C2E2E9 for ; Wed, 27 Feb 2019 17:06:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2F0AE8E0006; Wed, 27 Feb 2019 12:06:39 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2C6D58E0001; Wed, 27 Feb 2019 12:06:39 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 169B28E0006; Wed, 27 Feb 2019 12:06:39 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id B55D08E0001 for ; Wed, 27 Feb 2019 12:06:38 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id i22so7222381eds.20 for ; Wed, 27 Feb 2019 09:06:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=64nlTJ5kHDNpXPvnMC77gIztv7iCOTrax7wYjYpzDA0=; b=EsDlAPyQRHNLb/urXCB/IzqJXtIk7HChOg8ezzKvDLegBLmMr+cbh6eS1f1cH3IJYZ IEscP2fcV6b4wFvoyZ6BKuccF6NzkUTWs4hKrPXkXtJ/4hlsMu5f8eRPPFU8FWqI7PA4 RFYu5aEQtn45yia8x1ogm7pwsTEvJXbsGUeVbrZf6d/L1C/Yh8CSrxoouqT5z1ci+jDl R3cJehOULfzu+hZWRJfg+0MJ88Qed+LkXJrMeaWx10ZhJej5rNM1NNe8bXWk9sxDPdwg v1e8hq24LuXdt1oB4iZwelVeAdptmxF+IBb4CTiPMewB+I36KBbkYVz8LFuw5GgpXvql FfGg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAua45znXo4W2ULpmY38bsRDLW97fjO6JXFHoOXIC5eEt48cHtOlL nkgnt2CoI8Wa5mcbTVejvlaS1z7a7Gyf0oaMf9DtIyAaCA6KlPdFIrwxK8D2d+z1igg0cFpf5yv TawfvgRSMuhdP3uEjUFC9qlgggg/QdbBLZxi6+L9OmGld1zHYYX3FmZErRDSTbsRCuw== X-Received: by 2002:a17:906:ee2:: with SMTP id x2mr2295614eji.202.1551287198189; Wed, 27 Feb 2019 09:06:38 -0800 (PST) X-Google-Smtp-Source: AHgI3IYp84nmvK20JrI0OE9BgxQyAHJvS1yc1C++1FiXYV41vHIk/MkULBRAHhs2lDZKqPNhEfCG X-Received: by 2002:a17:906:ee2:: with SMTP id x2mr2295550eji.202.1551287197082; Wed, 27 Feb 2019 09:06:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287197; cv=none; d=google.com; s=arc-20160816; b=hWf5DYGpbIqbpxQIbnNrfg3mUSHGj8A/LOWTMuO+p8KyJVlAkgXcvbUxT7jGuvOHuw zUWjQkY33xqBC0e751YcG1OZ6rt/7ghZ+Nm7JXOJ/m5yRnXpvfalOBY2w144jyy4rhO6 4KxPMF+EHGwhWGmyKOZX8g5bIbCZjee7rPjwL16ZWCmO5x91ZpxDVkTuk8d3z0YzNsSt JFZ+PVdoh/xsnz89Sjmf/t4Ctf7BWMwEVYv7DxFv6OQZTLWsoL2vZtSXuhcoPACG8W4A BGe4ZxOZ1vfITLKGRsf0+wHt8RybW1vGZDDCI1hb27yqIDbrnBCsVE8c1WlS+42Sw9ln 2vXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=64nlTJ5kHDNpXPvnMC77gIztv7iCOTrax7wYjYpzDA0=; b=ZK8/i8Mig7lvrpole9br8Aw1hkjEQmpcwbXBnPVZamk0zKIcqTcK1K1TudkEYd1BlH +rRYkQdx1CBkneKsF15FteWj2mOCsGd6Zt6Ae2sQibXqyctfJ+Fp6Kre1soTFBrx/jMR DUbY4WG0+w2pqgxD+xCZbHS/R0FuRBFIRD0HE9toXw+Z9gGTD2bl47M4btqT8Frgr8LA K+l7+SbOCXiae+g+Yt1m2zBny4I9nu9TzbP/h4r2mvcUt9g/LcArL2xX7yHSPzo+Vvfu DSdxMhjASATVFfyJGjIgv40ez9YvwPsmZKD2XCMAxZiufoPnoYiLWyTzGGbiLOzOeAPj racQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id q33si1491179edd.299.2019.02.27.09.06.36 for ; Wed, 27 Feb 2019 09:06:37 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EF507A78; Wed, 27 Feb 2019 09:06:35 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6E0723F738; Wed, 27 Feb 2019 09:06:32 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Vineet Gupta , linux-snps-arc@lists.infradead.org Subject: [PATCH v3 02/34] arc: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:36 +0000 Message-Id: <20190227170608.27963-3-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 arc, we only have two levels, so only pmd_large() is needed. CC: Vineet Gupta CC: linux-snps-arc@lists.infradead.org Signed-off-by: Steven Price Acked-by: vineet Gupta --- arch/arc/include/asm/pgtable.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h index cf4be70d5892..0edd27bc7018 100644 --- a/arch/arc/include/asm/pgtable.h +++ b/arch/arc/include/asm/pgtable.h @@ -277,6 +277,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep) #define pmd_none(x) (!pmd_val(x)) #define pmd_bad(x) ((pmd_val(x) & ~PAGE_MASK)) #define pmd_present(x) (pmd_val(x)) +#define pmd_large(x) (pmd_val(pmd) & _PAGE_HW_SZ) #define pmd_clear(xp) do { pmd_val(*(xp)) = 0; } while (0) #define pte_page(pte) pfn_to_page(pte_pfn(pte)) From patchwork Wed Feb 27 17:05:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831917 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C81571390 for ; Wed, 27 Feb 2019 17:06:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B333B2E2E9 for ; Wed, 27 Feb 2019 17:06:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A772E2E328; Wed, 27 Feb 2019 17:06:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E60C52E2E9 for ; Wed, 27 Feb 2019 17:06:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A6D1A8E0007; Wed, 27 Feb 2019 12:06:42 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A1A918E0001; Wed, 27 Feb 2019 12:06:42 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E30C8E0007; Wed, 27 Feb 2019 12:06:42 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id 364D98E0001 for ; Wed, 27 Feb 2019 12:06:42 -0500 (EST) Received: by mail-ed1-f71.google.com with SMTP id k21so4249773eds.19 for ; Wed, 27 Feb 2019 09:06:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=0Y7UWc/BL+I5JF6to7BpP8ad3m37Zc7N8zd7C9Ufk2E=; b=alPWLLg4eNQeY790Fg5c+UmnmOKiNYs7qiBWKODVKDV7aaFgOota0CVP5+u44BnGTy YhJ8jNHCz5mtImBp6BpJQmmPjrzJV2AjxHHerATq0tHreKYN5wxyPZNiEdcPwJR1ynON NkThJmV5fBolzt/Z1knCV3JKYQcJRDv5GcPpT8HzYWprEiT0Ybi7BHut9tUwHkFg0yCi 9DwOU+U8bmMR30c/rkbPi3GoLewGJI6h8soShlvYmOUg2hPGKquWeRe9+zUz+PQbjgyV 6Ym1Dmrniwr2RV1nLZihYJ8buCLutDXKI+5IYSLU1f9ZNSgDWL+/ZHhbNq5nnBwrBvQp 5t4Q== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAubALJYG6AeHUNO+/gheZPI8Z/qiVgGygvjrrQa1sUDPcBeQMQY9 BFZfPmmCHfCYaAIn+AdsVMTP01F4WF37WdJ7ZHigxspi5FKl+X5fCK6+6oUZO+HDCxP8iRm5i8Y 2dnFDuR4WvZSYG4eNib2wDYuhQyb1/HxxHzn4CcWo49b2lWT6oL0FGGAKvE0A/eWTHg== X-Received: by 2002:a17:906:eb95:: with SMTP id mh21mr2273529ejb.220.1551287201698; Wed, 27 Feb 2019 09:06:41 -0800 (PST) X-Google-Smtp-Source: AHgI3IYDYr86BJ/luYKBd+4T+KzKQqJEOZde4H8jMwPNCdZYR+6/vgy+A5M9EiggbS6mc0MXLevc X-Received: by 2002:a17:906:eb95:: with SMTP id mh21mr2273468ejb.220.1551287200683; Wed, 27 Feb 2019 09:06:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287200; cv=none; d=google.com; s=arc-20160816; b=KaGAmXpqhCxynLkPgZFr2vGaX6AyZGeHC+hQLaELxw+bLNh+C2gefppwdkJSYwjcJI zLFiSilH5TggUi3AR/IiQZGmhtnTzx8eqYUJ41DTiKL/JmgrnS+5DEZHT5IM0cVPR3Ou BG7putNQoqLZX45zoo7OuiU1LQ0F6z3tJNYXPfr4EKulO8r1W3Zpv/6/m0ok9auEoX7v 9y9iPEARcOkrOiVrK6nLtOn1d+B8MyX2CCl7Hzal9yM8RRRGysLf1zHjOf4VT76EzuOz JptvSuSFDm2LFR+69XwGbYHniIbu2ZByqI/AMsINtHYLyMhBexfW78nPcWOqRqVIJIpm HJGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=0Y7UWc/BL+I5JF6to7BpP8ad3m37Zc7N8zd7C9Ufk2E=; b=LqIGxlNpaF1B967oXVugCAo+GNXSaH+DPz1/HKfVdtmuRCRVQiDjtABCcFTwu9TK5t a338uc1YILhstsLzUEsjylKivRM5gAFb15xhbz0+X4vXQSm3EHFm4EU0fiw8XgQFu+U0 BQ25FggrhW+nn59Jo3YVK+b92zLxT+u8FlXGx7l4qT+7J6al2NC+6wKE5QQchxdnE7hx 30e3GKegvWQUC8NBjd+enR3T2L31A/ZPChOTYCLsra7IMrZJbC2dIvZGq+fqayHENIRr clpIZSWQZlmmCSaSRc/CjPFvsHk3SsX7wsF6uABQa4rVXuwXpSIov6OWSkCbS6tB6FBm gAmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id f19si1031408edf.175.2019.02.27.09.06.40 for ; Wed, 27 Feb 2019 09:06:40 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9A01B16A3; Wed, 27 Feb 2019 09:06:39 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3AE843F738; Wed, 27 Feb 2019 09:06:36 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Russell King Subject: [PATCH v3 03/34] arm: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:37 +0000 Message-Id: <20190227170608.27963-4-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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. CC: Russell King Signed-off-by: Steven Price --- arch/arm/include/asm/pgtable-2level.h | 1 + arch/arm/include/asm/pgtable-3level.h | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h index 12659ce5c1f3..adcef1306892 100644 --- a/arch/arm/include/asm/pgtable-2level.h +++ b/arch/arm/include/asm/pgtable-2level.h @@ -183,6 +183,7 @@ #define pud_none(pud) (0) #define pud_bad(pud) (0) #define pud_present(pud) (1) +#define pud_large(pud) (0) #define pud_clear(pudp) do { } while (0) #define set_pud(pud,pudp) do { } while (0) diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h index 6d50a11d7793..9f63a4b89f45 100644 --- a/arch/arm/include/asm/pgtable-3level.h +++ b/arch/arm/include/asm/pgtable-3level.h @@ -141,6 +141,7 @@ #define pud_none(pud) (!pud_val(pud)) #define pud_bad(pud) (!(pud_val(pud) & 2)) #define pud_present(pud) (pud_val(pud)) +#define pud_large(pud) (0) #define pmd_table(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ PMD_TYPE_TABLE) #define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ From patchwork Wed Feb 27 17:05:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831919 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2FCE115AC for ; Wed, 27 Feb 2019 17:06:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AA5F2E2E9 for ; Wed, 27 Feb 2019 17:06:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E30F2E305; Wed, 27 Feb 2019 17:06:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A020A2E2E9 for ; Wed, 27 Feb 2019 17:06:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3671F8E0008; Wed, 27 Feb 2019 12:06:46 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 316BE8E0001; Wed, 27 Feb 2019 12:06:46 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 144128E0008; Wed, 27 Feb 2019 12:06:46 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id ACCF08E0001 for ; Wed, 27 Feb 2019 12:06:45 -0500 (EST) Received: by mail-ed1-f71.google.com with SMTP id y26so2499044edb.4 for ; Wed, 27 Feb 2019 09:06:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=BRz1fLaVHJrWps04LeU/9kcyNHUo1yfdaodtNUtdXHA=; b=fz3/GNRkaNKpOFa5Tmpe51RcAF9EAV39lb2nWPYRbGnzNDbDMtyjYX8Vx29pHQSbVf 1ghJ8LRo2uSbKsbLXRqkTWRJFd9hXdT88tVr+ZzqkVnZIEp5nClmcGX7kyFKeKT5FJwd 0LMDg9eerQd6sLHvPRmyZoBpblHtCIP/RyXMvaPM/Xy7c9kj+2y2NSjwQCUV4CvhQLBG xfpCCLhd4rAoYysv1QPHMPWpjbLaA5Pmo80W0UpeIMrrjONG9zE0t6lArWMlbrGxhVFy M8VbjI8XVOAs0BKzSyNLfkP330US5QciITZ6wOuAbGiFODJSeqJePzv+u9Cflm9h1wqy UkjQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuapKNJY//MLQd9jHRhvteWXJDeoHrP++uTRIAw9vlkUwUkkhddA FS/aLsA3ZeP6KSa/6rrRWEGcRR+xyzWkZosb2OTZx6lRZKf70Ne4znjtiDwuvJbFRBtiUZcLTWt aiUkVHrFJOqJUdcwBC/2rC5mUZHiRc8EjxeZPvWepkRF8CmIbG2apbLqWT23QHkF6TQ== X-Received: by 2002:a50:b16e:: with SMTP id l43mr3012872edd.99.1551287205215; Wed, 27 Feb 2019 09:06:45 -0800 (PST) X-Google-Smtp-Source: AHgI3IaHIdR5UqBcZZjizTuNL6/H1VWonyJzQmPy/fovgexu1xL50PjY3a3wg2PPNptFTJnIR949 X-Received: by 2002:a50:b16e:: with SMTP id l43mr3012804edd.99.1551287204136; Wed, 27 Feb 2019 09:06:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287204; cv=none; d=google.com; s=arc-20160816; b=kEJSYqqNy84JmfYhTd/rrktbi5D9EZ2p6GqAQrCeC0PMs3RBwYeY4jj7UBc714J394 lRrKANH/nam/gGYI5pi5f+81jC9fjVk5+pA8J2W36Rgo65ui/7RcTgHgINyuzmBtqts7 HtHJUR11UyZoNu6kHH/2RNwpCa3wUnsdWPtBSyD+QnDo0m97VehtrMANFd/EMHG6FivM YMppHu69HQnHn4GthYRgDFJopcmb/SzaNe8YVJa/VbRWL0xQI/WNRgANJHGTdFO5hcJe GU0XSNTMIj31jS6kX7vgNpsVLCEqJEZJF1kMhowXOYtxlszR2zoFDDtCL5cCnzvCP/y+ PCKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=BRz1fLaVHJrWps04LeU/9kcyNHUo1yfdaodtNUtdXHA=; b=rXJok0Sh7VIFmLugHChG2XnExyDpEFp3AWXJ9An5XDlkhq2cIFgrQdgYXvUckpKno7 F4+HN9NGPCAy+eISxzEAuKQhILgDfHO73jCTqYINRRyeDwnE2xMuBemDY/2h0tmiVV45 uUpW2uiNccOYRTOEoi8dQ0YT6/G1WVileE3A04cLb2BsFUyEfUapX5mfV2PKDGozp0YD nIVqqxRgHfGkoUSUH+Ds5H+D6g7+y/893T45kK3T2R8pL49YWqO9zc02d8QdfPGkiTrX Uzt2xCMCdtw4k+fx0JIeg3HoXRyOiQ39wqzhcPstrF6jK8JyiWSRRX51ArRy4aWRSLdG hTAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id o40si3285221edc.108.2019.02.27.09.06.43 for ; Wed, 27 Feb 2019 09:06:44 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1ED3A1688; Wed, 27 Feb 2019 09:06:43 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D7FD83F738; Wed, 27 Feb 2019 09:06:39 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" Subject: [PATCH v3 04/34] arm64: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:38 +0000 Message-Id: <20190227170608.27963-5-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 arm64, we already have p?d_sect() macros which we can reuse for p?d_large(). CC: Catalin Marinas CC: Will Deacon Signed-off-by: Steven Price --- arch/arm64/include/asm/pgtable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index de70c1eabf33..6eef345dbaf4 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -428,6 +428,7 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, PMD_TYPE_TABLE) #define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ PMD_TYPE_SECT) +#define pmd_large(pmd) pmd_sect(pmd) #if defined(CONFIG_ARM64_64K_PAGES) || CONFIG_PGTABLE_LEVELS < 3 #define pud_sect(pud) (0) @@ -511,6 +512,7 @@ static inline phys_addr_t pmd_page_paddr(pmd_t pmd) #define pud_none(pud) (!pud_val(pud)) #define pud_bad(pud) (!(pud_val(pud) & PUD_TABLE_BIT)) #define pud_present(pud) pte_present(pud_pte(pud)) +#define pud_large(pud) pud_sect(pud) #define pud_valid(pud) pte_valid(pud_pte(pud)) static inline void set_pud(pud_t *pudp, pud_t pud) From patchwork Wed Feb 27 17:05:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831921 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2220715AC for ; Wed, 27 Feb 2019 17:06:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BBAD2E2E9 for ; Wed, 27 Feb 2019 17:06:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F241D2E305; Wed, 27 Feb 2019 17:06:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AECB2E2E9 for ; Wed, 27 Feb 2019 17:06:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A9228E0009; Wed, 27 Feb 2019 12:06:50 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 030118E0001; Wed, 27 Feb 2019 12:06:49 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E615C8E0009; Wed, 27 Feb 2019 12:06:49 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 8EE828E0001 for ; Wed, 27 Feb 2019 12:06:49 -0500 (EST) Received: by mail-ed1-f72.google.com with SMTP id k32so7091827edc.23 for ; Wed, 27 Feb 2019 09:06:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=F2Zj9D+6mzZU1aa6902mR5rKdYqk0kidu/xuD/i/Puw=; b=lRA9Vj2lxNUJCiL38FBpJgx8n7DXPtktG38/pSTzNYd9vGpI/R2zEw2alys4saE3Bm 7IrqECi14F9/bWhkr0LdwqwcytpOmFtacaP86uupMlY0Nmqiau3DCC0FXNJqayY29YzB VADD0vOqvyonR6fAR/2A1F0TDnzYwZfq629VDen0lvgFdtr26YAbHad0BgJbJ9vYw1/0 zaROV36m6lEK0pwT4iW2pKprgwYs6+t/BgwH9TYsgS3jtcOd6nlxv+bYlNJsO4U7nDNY T8x/L8LUmfX0prqUF7LGxQyXffsRw32hP63tEfYl+VgMTjUnVWKKKQqkmT0OYTUtX6Mj UkXQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuZyRJwAko4Ha0c0ooKZ+BP3YF1hjE1PlsxELnDDmDF6MOeERzow iwdalhcMuGJWCPGi2b5kUVnJa+xPOkhyl0nVkpEMs+/5DchLkk+DN0J8PyW76+86omjlur7lebG SGPcmnLDjliCY8fKK26fHHkN3pMzJ3peEzpX3auM4297Nim3epIZBtU8ejZqnXd9ayA== X-Received: by 2002:a17:906:4ccc:: with SMTP id q12mr2284404ejt.201.1551287209063; Wed, 27 Feb 2019 09:06:49 -0800 (PST) X-Google-Smtp-Source: AHgI3IYgw2khElJAi6wZOvR0h1r9WmZo1NLBUMjvMPOROXboT2ZafhGHdZJYjB+KT3r3jWrJQD/O X-Received: by 2002:a17:906:4ccc:: with SMTP id q12mr2284346ejt.201.1551287208113; Wed, 27 Feb 2019 09:06:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287208; cv=none; d=google.com; s=arc-20160816; b=rpfLfSzopST8YP4gHNd3bjhxPLXdz/h/eONJajeE4rpragp6UVe/RC1eSbrNixeH3J HEJIuwCoIePZZRjUK/PuKbmUFteEaShrYX86OFtqwuuguZgApMOAUe3gJWrz2XDux8l0 qfjslI+CrcspqPV7JpDfNehxiLB6YVgwnLbKv1k8t15YnybFKxk44vU8KhBIDVWo/YhT fhFvKOYFJHRHmTUIzITYUlXU8Y6HwbbIwPh0589XWfoQzek93lKQxGi6Hr0Cj55GRePT Qqgl2ho6OtyxV1h6Tzyt35Kbu35Zwtuqbtdmwk79w4/M2FD9423J1CZNEXOZiRxoJnsW NvTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=F2Zj9D+6mzZU1aa6902mR5rKdYqk0kidu/xuD/i/Puw=; b=CbgCULLHXJa1G6mQbR3Mn0fdcIGSWdONNez1Rte/7cIKBIXToM89t66DolDDtOINDa gvs41SFyW7euZtMm1Y1u/uNUxqsCR9oX50JR7etZT3Zb7ZDTshoSlC6+d3uLujpzETF5 x5b6D3NcCT5KYbe6F1itb1gQTW2td6KjeRcEbiixv1JcCD3JBgGsEyqsIMi18ZxmQDy3 roiJSrMu9MqjNMMkdsYivbLm/7EiDzq0z/TLL7EQGnLDkyejKtnugCTtKwHFsJJjYvo7 RHOoYbtnCTYsxilcpAc99cnQSZZ+3z7NI3CHgrWh0WodLf/r0RInWwEPGBlDK6xTpmMi yUzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id m5si1981548eje.78.2019.02.27.09.06.47 for ; Wed, 27 Feb 2019 09:06:48 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 11CBA1684; Wed, 27 Feb 2019 09:06:47 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5EEB53F738; Wed, 27 Feb 2019 09:06:43 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Mark Salter , Aurelien Jacquiot , linux-c6x-dev@linux-c6x.org Subject: [PATCH v3 05/34] c6x: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:39 +0000 Message-Id: <20190227170608.27963-6-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For c6x there's no MMU so there's never a large page, so just add stubs. CC: Mark Salter CC: Aurelien Jacquiot CC: linux-c6x-dev@linux-c6x.org Signed-off-by: Steven Price --- arch/c6x/include/asm/pgtable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/c6x/include/asm/pgtable.h b/arch/c6x/include/asm/pgtable.h index ec4db6df5e0d..d532b7df9001 100644 --- a/arch/c6x/include/asm/pgtable.h +++ b/arch/c6x/include/asm/pgtable.h @@ -26,6 +26,7 @@ #define pgd_present(pgd) (1) #define pgd_none(pgd) (0) #define pgd_bad(pgd) (0) +#define pgd_large(pgd) (0) #define pgd_clear(pgdp) #define kern_addr_valid(addr) (1) @@ -34,6 +35,7 @@ #define pmd_present(x) (pmd_val(x)) #define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) #define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK) +#define pmd_large(pgd) (0) #define PAGE_NONE __pgprot(0) /* these mean nothing to NO_MM */ #define PAGE_SHARED __pgprot(0) /* these mean nothing to NO_MM */ From patchwork Wed Feb 27 17:05:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831923 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D53781390 for ; Wed, 27 Feb 2019 17:06:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEF042E2E9 for ; Wed, 27 Feb 2019 17:06:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B246D2E305; Wed, 27 Feb 2019 17:06:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46B7B2E2E9 for ; Wed, 27 Feb 2019 17:06:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7392C8E000A; Wed, 27 Feb 2019 12:06:53 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6C46C8E0001; Wed, 27 Feb 2019 12:06:53 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58A3C8E000A; Wed, 27 Feb 2019 12:06:53 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id 035E68E0001 for ; Wed, 27 Feb 2019 12:06:53 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id d31so7237084eda.1 for ; Wed, 27 Feb 2019 09:06:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=J233IL1FGhNVHQPbZ8NtivYHyMkhcYW8XDURBlgnssI=; b=HA6NQxbV40DL3acKYOREcdy/7Ri+IwVFSortUIilRFHmIhAWX2y2CDxtoijWKT7QY1 kzBLNCm1rJAFT3Zx2oVBK4eI6hgM9gw2jodj5ERrWB6zy5oyF7WdaQqE/ibYLo+FG4f/ ZOErldVbuKWzKNteP7/xT4tCjF2X5btKJe8sxCY9CByu0qJ+lUKOLA5Jv3YcHxpiob7A OO/PCRq1F+igC4XDqBYyrf6xtddvcj1oIXUJLRgCAabq5ioNTUdStfcGioIGiGWdErKT UAQsDCupTbm72YvuXJCLzC7n0k7RA1IAMmHPqb1Tr4aebN8zUqkRkF3dAHjnsxau+sL7 8aiA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAubF4Lo12smgNBJSRupL1aAGgduKKX0Y+lvD0wv9tDiylHRLOV+g mOsUlEvhsSIbfVtHkJtQ4njXk4nMH/ZJuAJnQQ0NbCtCoPSxmyRbf222BZKrk+EVbyGxpES3WfA uKPEZuwQGE8IOhVJ6fsrRRFG6qY2QgMrqB4Alf7cvuGi2VZ53dWq2CXxxZFh0XMFDnw== X-Received: by 2002:a17:906:a4c4:: with SMTP id cc4mr2290381ejb.198.1551287212521; Wed, 27 Feb 2019 09:06:52 -0800 (PST) X-Google-Smtp-Source: AHgI3IZPep9jA/zJRaodqpOQ2CvPONoGIwZMUcIgWykg/qU1eKw4sxNnNqoY+LAjFODK2FHexBTK X-Received: by 2002:a17:906:a4c4:: with SMTP id cc4mr2290328ejb.198.1551287211590; Wed, 27 Feb 2019 09:06:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287211; cv=none; d=google.com; s=arc-20160816; b=J9JaoC7t8/FVbkP9q8oA2gi++UzQhpFB46fj4G7XtzVCWg9qGbiy3n5LPVHaiFCL7C QBAdAavi1Xa12n4FudV3kenf2/jFbRjMA9JN9kBJV6JHrKQxmCbqedjfEHsHpQJntJMu 3jBsEqrvppQL99kXPmz1qGZ5txEpiME81UQom5Jt2hNVnWDrneSCcucC+aHATLXtzrFO GiHhmyR4yiZ2hrlQ3LVcbP/h1pZJ/Q6KIWcBijl2QKkuoyvYVulE1xIVQMcOKhEZfMoI rgPwxm5NaCS96sirgvJkJfvxXoG0KMOYXOAa+VA03g7Yp0zgL9NsnZIF59uBcktZjqV5 iSDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=J233IL1FGhNVHQPbZ8NtivYHyMkhcYW8XDURBlgnssI=; b=jiOsr4OQigizbIjWga+WJRyCN1QKJ+vDcM9U0zVbR+I2hjdjpZ58gq96mlzUOZJuct bbG9DW8TYbw1N2Gt0ILIoaHFscf2PBbxjD1U8nstSEdneYJ4UvHopcGxs88dF66zbHaV Py4ekD2yOr2/dA6CDmGD+wRnxYUEJT0MauUTp2Q/WmshbBVmS7aklthUZUddwLfxCM4j JVPwkBhetLtFgdmhpev66GEdEjtZeNayl7nOMh4/SDKLoeP4dpemrlFra9aaPU2Q6N2t 6xp68zM4Pz0drcUZP7KNps946zh7pHT7bgb/Y9l7JXpQIrS8otCTiax1tQN74ZGdAVoL uNzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id j21si800791ejx.273.2019.02.27.09.06.51 for ; Wed, 27 Feb 2019 09:06:51 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AE821A78; Wed, 27 Feb 2019 09:06:50 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4FE223F738; Wed, 27 Feb 2019 09:06:47 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Guo Ren Subject: [PATCH v3 06/34] csky: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:40 +0000 Message-Id: <20190227170608.27963-7-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For csky, we don't support large pages, so add a stub returning 0. CC: Guo Ren Signed-off-by: Steven Price --- arch/csky/include/asm/pgtable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/csky/include/asm/pgtable.h b/arch/csky/include/asm/pgtable.h index edfcbb25fd9f..4ffdb6bfbede 100644 --- a/arch/csky/include/asm/pgtable.h +++ b/arch/csky/include/asm/pgtable.h @@ -158,6 +158,8 @@ static inline int pmd_present(pmd_t pmd) return (pmd_val(pmd) != __pa(invalid_pte_table)); } +#define pmd_large(pmd) (0) + static inline void pmd_clear(pmd_t *p) { pmd_val(*p) = (__pa(invalid_pte_table)); From patchwork Wed Feb 27 17:05:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 275231880 for ; Wed, 27 Feb 2019 17:07:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10E0E2E2E9 for ; Wed, 27 Feb 2019 17:07:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 043522E305; Wed, 27 Feb 2019 17:07:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D5BA2E2F5 for ; Wed, 27 Feb 2019 17:06:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BCB9B8E000B; Wed, 27 Feb 2019 12:06:57 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B7AE08E0001; Wed, 27 Feb 2019 12:06:57 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A46858E000B; Wed, 27 Feb 2019 12:06:57 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id 4A4378E0001 for ; Wed, 27 Feb 2019 12:06:57 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id o25so7120591edr.0 for ; Wed, 27 Feb 2019 09:06:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ZHm1cyXfjE8tEi0dNKBdwMdPKaBv8xSlMukgn6XJeJU=; b=AlWq8fAxr006EYuTE8MLztX04HseHXaeRKt5/q5jvnFZjcL+i2KV/sniCz+NOv0TLR 9Rd/6/Rl8WL3ncOHj5kG5wL0QPC4x2SrWJJIrNLJQGWkHMQQBcFK5rRXXSiC6MxOudn3 j3CqBIE//IMMGNEsVHitjbdOM58Xxwwru/gKEfLfIt75s0809G0EPramH2WjoEl7Uf66 4bSSgH1fnlfkAfqSyXb9K/1bLulaDAtDO3ko5MwHe0xkFp3NOHWNEC2C+qMFZWyk+XQP xQCgR1lBQt0w59q07UhVpFncp2SBvNlVTqyZt/EnomSTP+7pHt836HPGR9Ni3AokViK9 f3wA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAubb/sT5623aMGHOO0i4Bz9MPBiSCDIyCJGekdyGSffjUIS3v8P6 69UnLZl3hhxp/YNwxuyj+kdtGYLoOXNO7Hu+OWBqYNumHTDc5JDlh06c1tSIFEG/Lhq45Ya4UZA f4t8eMBHbu8LF/O8uLsXRUKaYNxWVJjGuCgKGFPb8AMXJM+JImwTq7s1AnJtBBd+B0Q== X-Received: by 2002:a17:906:5586:: with SMTP id y6mr2289581ejp.197.1551287216813; Wed, 27 Feb 2019 09:06:56 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ4bVM1dAt1LOyn9IbcqlZyd62civEHohiNf+4aM0sSvuRRc5/iaxMpiWDU1+zsw5Sk8kjj X-Received: by 2002:a17:906:5586:: with SMTP id y6mr2289519ejp.197.1551287215763; Wed, 27 Feb 2019 09:06:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287215; cv=none; d=google.com; s=arc-20160816; b=QkeiCsVAH7tAG35osYHEEZRYTK+zJliqA/QHhhYBeoDDoajyq0qQs85PoaBgQmdJlp r7MiaaWE1sxr/2wtOnFX0x0d223XsYlVR9Uuj4JB6haekVUntUQuYUi3fu12GRUkHWF/ UdH43kvLKi+fu6N6g/CweNCLHOcRDP/8ZUk/AjaooUL5xuAILC5VK+CE/LsqUmaofLy+ oO/WcKKlK3WQCkRYin4HX+n2BpjIBBoGyaWWnZ6kz9dENjPnbIWBgkihrgb0PgAZk3Ny O0CTXM9uML6nc8ZwPMnb/g7RjNXTdRRIUYQwpiyf2/vRIi8SPkFwveXmkm8EVAgZiwsA l7AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=ZHm1cyXfjE8tEi0dNKBdwMdPKaBv8xSlMukgn6XJeJU=; b=lZYS47ajllmeT5R9lAHDCnp8zQNZ384bPniHcPd2boJ+OH13W5uMUZluSGdyZW9mat 82N3HNpEfrK6Cbo9zosZoh6b4oyyAXSJ64ouWVvF1l1TrMy2sqzUYu9CE1iAGljltAXa qBLw/wSCLhhbS6h1gjROh2omiacxBdEbpnv2xKcnlG1F0YetIw7WWx1eaA5sofMAcQQm EBiOj+0Cfx8sDuNeBaZcLuYnPwNzbIWfXH1jtZY9gs15WtRuEfPZ6MHNPzi98uMBh93G +YDGVdtCjK8nnllwohfpsoGxZZ9WcfocvQXTTEQCgSXMTkCHsQ9QJTsmhBrsdLxEkQlD YOWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id i3si5075214ejc.34.2019.02.27.09.06.55 for ; Wed, 27 Feb 2019 09:06:55 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7B91D1684; Wed, 27 Feb 2019 09:06:54 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EE5103F738; Wed, 27 Feb 2019 09:06:50 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Richard Kuo , linux-hexagon@vger.kernel.org Subject: [PATCH v3 07/34] hexagon: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:41 +0000 Message-Id: <20190227170608.27963-8-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For hexagon, we don't support large pages, so add a stub returning 0. CC: Richard Kuo CC: linux-hexagon@vger.kernel.org Signed-off-by: Steven Price --- arch/hexagon/include/asm/pgtable.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/hexagon/include/asm/pgtable.h b/arch/hexagon/include/asm/pgtable.h index 65125d0b02dd..422e6aa2a6ef 100644 --- a/arch/hexagon/include/asm/pgtable.h +++ b/arch/hexagon/include/asm/pgtable.h @@ -281,6 +281,11 @@ static inline int pmd_bad(pmd_t pmd) return 0; } +static inline int pmd_large(pmd_t pmd) +{ + return 0; +} + /* * pmd_page - converts a PMD entry to a page pointer */ From patchwork Wed Feb 27 17:05:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831929 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C179A1390 for ; Wed, 27 Feb 2019 17:07:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABE522E305 for ; Wed, 27 Feb 2019 17:07:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E8A92E31F; Wed, 27 Feb 2019 17:07:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2723F2E305 for ; Wed, 27 Feb 2019 17:07:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 42B9C8E000C; Wed, 27 Feb 2019 12:07:01 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3D9208E0001; Wed, 27 Feb 2019 12:07:01 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A2F08E000C; Wed, 27 Feb 2019 12:07:01 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id C4E3F8E0001 for ; Wed, 27 Feb 2019 12:07:00 -0500 (EST) Received: by mail-ed1-f69.google.com with SMTP id x47so7110445eda.8 for ; Wed, 27 Feb 2019 09:07:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=oM9cZS/lHtdk47vkYK9PYvG9U6l+ctb4fui4NkIJKv4=; b=HQ9e7O5pgp4xj7po6sgZnFuVQiI3zZnRs4ODrdjfSvpSaWv2DPFJ2CecIy/slEo1bd A8qVSS/yZiVJTXDq6T5OTzDLHqxm2+CH4mrMHRPoGG6HwkKiM+nooMVUMKf9BrNStX/G ESMxX6nf8td+jV7IJkiW4Ap2wDpQuEJNfovMHHZrOu/2qSXkE9xJgausizxTN3NbAjsg MbmEoj4bB/sHUdqtKhGoV0a4M2YlUgOQpsO8X+PxiptC5ByXM4A7zvKpAWN83knOpBVn I6FnxcWtFAG6gsUJNZE6x7+NrjTxGpa79dVN8ukNMwU8YYOFqXuQ7ZbQ5GYXFDjgA08r 1xHQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuZKCbc0LdaFcYdwj+Vz2I8OUnOddlkJn4U/es7yv0j1MNhUOSil 5OhVUXBtrRinOjMoX499xe4UYVi2hzh1C7a4tniXQhByoQpiGSGnCWL+sNvb8SyLcq9x4SSYbdG mvfWZUQL19QB1ijrHvoVW6+tKe/Ana8JEoSBiaZLRCrSCDN8W9J66F3+qOBHU/Ib5JA== X-Received: by 2002:a17:906:a12:: with SMTP id w18mr2296612ejf.70.1551287220312; Wed, 27 Feb 2019 09:07:00 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib3MDX51F7MbZYGBCg7OIzEZUVb4HPOxpoDtbitD26Xa6w4N2ZoHbqoBuTQQrx3ME8QdTkK X-Received: by 2002:a17:906:a12:: with SMTP id w18mr2296555ejf.70.1551287219317; Wed, 27 Feb 2019 09:06:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287219; cv=none; d=google.com; s=arc-20160816; b=W821YtIkP32aRlWgvEgisd+jO1jcI8+vHwHXItWTqe18gGxLPpoQxOcuktu5TlrVKn 1PXevU+PndZRoy8Y+bwdBpyNjVzTLu3dUBHBeR5Ww8xcZ+uaAi/qzAi9yn2Wq409MI9A csYQJq3yzZV2xthEXMC6Gnhs8eYSziOfjMCMdHe6c6EIZ4O/wRVgJ3l6/hZH04zZsbvF VKMpE6F3ZyuWM0S14N03ZIvT+wh9odBmnSTXItZyG2hKFOq6pnW1DwO8WdBM/01e/LaO I1oxjSiZIrgIbvsJqubNJ/M/o0bdBNX5aYCWn27IPvNA9ZMRyvvmszqs/Etuh7wQoU+v YpTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=oM9cZS/lHtdk47vkYK9PYvG9U6l+ctb4fui4NkIJKv4=; b=aGIVu8fD+DfzBXDdREH0fYyXxICEiqrn6Y+2tEuWUI+Oa3RMN+s2f99XsnKpr33Htb qVg4ZLlH3qAuwX2eYHIdlwDsZrM2XqwWFH8hdoaUIEf8kKuajE+Y6PeAP6g1tj10efj1 +02zw8hzPH7AqcJCxWulTzQDUmKMxwHvTTwbuwIiG1rhStbqgloXHQWCtjIiV+suPjYs PeiWj5h1+tczEPPx/1LIvZsTHPu4S4K44Zh39sWvKO9S2DGj7TnPTz+3/k37wJxiEnlh ic/wI41mLKzaptl0eRAPi6rzo0ZBhYtxHGOniLBS/Qm2rvha0jC4kuRav52H/Q+3piDZ ilPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id y57si4755582edd.320.2019.02.27.09.06.59 for ; Wed, 27 Feb 2019 09:06:59 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6C7F3A78; Wed, 27 Feb 2019 09:06:58 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BB5463F738; Wed, 27 Feb 2019 09:06:54 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Tony Luck , Fenghua Yu , linux-ia64@vger.kernel.org Subject: [PATCH v3 08/34] ia64: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:42 +0000 Message-Id: <20190227170608.27963-9-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For ia64 leaf entries are always at the lowest level, so implement stubs returning 0. CC: Tony Luck CC: Fenghua Yu CC: linux-ia64@vger.kernel.org Signed-off-by: Steven Price --- arch/ia64/include/asm/pgtable.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/ia64/include/asm/pgtable.h b/arch/ia64/include/asm/pgtable.h index b1e7468eb65a..84dda295391b 100644 --- a/arch/ia64/include/asm/pgtable.h +++ b/arch/ia64/include/asm/pgtable.h @@ -271,6 +271,7 @@ extern unsigned long VMALLOC_END; #define pmd_none(pmd) (!pmd_val(pmd)) #define pmd_bad(pmd) (!ia64_phys_addr_valid(pmd_val(pmd))) #define pmd_present(pmd) (pmd_val(pmd) != 0UL) +#define pmd_large(pmd) (0) #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL) #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & _PFN_MASK)) #define pmd_page(pmd) virt_to_page((pmd_val(pmd) + PAGE_OFFSET)) @@ -278,6 +279,7 @@ extern unsigned long VMALLOC_END; #define pud_none(pud) (!pud_val(pud)) #define pud_bad(pud) (!ia64_phys_addr_valid(pud_val(pud))) #define pud_present(pud) (pud_val(pud) != 0UL) +#define pud_large(pud) (0) #define pud_clear(pudp) (pud_val(*(pudp)) = 0UL) #define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & _PFN_MASK)) #define pud_page(pud) virt_to_page((pud_val(pud) + PAGE_OFFSET)) @@ -286,6 +288,7 @@ extern unsigned long VMALLOC_END; #define pgd_none(pgd) (!pgd_val(pgd)) #define pgd_bad(pgd) (!ia64_phys_addr_valid(pgd_val(pgd))) #define pgd_present(pgd) (pgd_val(pgd) != 0UL) +#define pgd_large(pgd) (0) #define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0UL) #define pgd_page_vaddr(pgd) ((unsigned long) __va(pgd_val(pgd) & _PFN_MASK)) #define pgd_page(pgd) virt_to_page((pgd_val(pgd) + PAGE_OFFSET)) From patchwork Wed Feb 27 17:05:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831931 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1895415AC for ; Wed, 27 Feb 2019 17:07:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02FB02E305 for ; Wed, 27 Feb 2019 17:07:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E88CD2E31F; Wed, 27 Feb 2019 17:07:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52B282E305 for ; Wed, 27 Feb 2019 17:07:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6E92C8E000D; Wed, 27 Feb 2019 12:07:05 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6A5E38E0001; Wed, 27 Feb 2019 12:07:05 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 563088E000D; Wed, 27 Feb 2019 12:07:05 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id EA6598E0001 for ; Wed, 27 Feb 2019 12:07:04 -0500 (EST) Received: by mail-ed1-f71.google.com with SMTP id k32so7092093edc.23 for ; Wed, 27 Feb 2019 09:07:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=o8V0Tzxsi6NTsG8lOFeqs8u+PtO84JGBEV7Wz4LTce4=; b=LxGzt2zZ/NGfQ0CGvIIh7dPz2diSo8zlMCxLHz537PEfdh2kfl3hCrrRGk2un2WNvB epq6dtW+w0WQrlHTCafrQbALSQ3p7rtitVPvoQzANEccr9XqeggENFNP4c2+QWArS69t ECsYPbcwRUxTQmalBarhM67xzj0oNf/VG3El7evS/zlRbnZLD1zP7YrGWXTdL8qvmVu+ DQ8E+aIyCytLeTzbaRK/vEbP+ZqEYpocXgUiJhopU1ZON5oX3Kaes3LMGWlVklpXjbbI QQ2rGNPYgm9Fh6nstJd4Jn7FnDC3/G064C39t1oYp6PUS8ic+KMr3WGds4ZQBWw+3wZX XYZA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuYkdISXCuFZT0eg/lC3p9ock6b1NGXmWthEYVFaktAp1U+TVBLW cmoeqlaqY+RcLGLxKojK1xOsSNrm3elq5pc+cEkhq+WXOfNBmFliVICwxv6DJ6/WRg4l3z+IOvd 1L6cuCS7xpdATWPuDqFRH7RzQ58sZcsVjavJvSb5T9JnMzyxEr1rO5TYplcSnKuRO+w== X-Received: by 2002:a50:a4b1:: with SMTP id w46mr3063234edb.215.1551287224442; Wed, 27 Feb 2019 09:07:04 -0800 (PST) X-Google-Smtp-Source: AHgI3IblG78CeEKuIk9bs/gZX9MIwi9w7z9cGy0jDbJDbyQvFJW5FCVPCzK/xf24pe/aodQIYn1M X-Received: by 2002:a50:a4b1:: with SMTP id w46mr3063173edb.215.1551287223340; Wed, 27 Feb 2019 09:07:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287223; cv=none; d=google.com; s=arc-20160816; b=Dd7r54n4k2h8U2yaKrvroPcViTnPdyb3egnyAHc4mJDNHtiJuWnhVAcsrMZ2DKzSHD c9Eo1X45ZfHnpbjhB2ZwUCePP8os+mpxsG7h7ljhXgRBhL/c/6F2Oov+psbkWPWLZccK uXJEbkC1OpJlFyN+naJW44ZFgkhWlMSU3b4lsVk/RB1gDtSVetKaidN5hEZrXlukn9XK 3a9SJZHJWSXnoH84XF2eaCM1U50cgv485QODGKv0eo4gZr3S5XhohHpTOPg0vbYL0ard vnpJTrRgNOsyYPmXxMtttBDNIGETFArYynfuo5PLXkgWc8GU9ki9ma01IsnFObOeLumQ kDuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=o8V0Tzxsi6NTsG8lOFeqs8u+PtO84JGBEV7Wz4LTce4=; b=VcJIGdn5j6P1rUefbJWrDsbJAmHP0SUUKErBSEKcvIjyeyAImlbObrJuNm+HELGzT7 Ol8QB8mQxuo7peIWL8/amWRu2YIT+X1KkmKoFmBdX9bNhYD6/+XCNmVLy3HqG+WJvWev TFRN1HCRna7DZd2aIcyLVZRKj9s+3Gs4OOznAzkg7fKIFugkNRy1E/BZDmHnyt9QBF1N qzsJ/Ru76iwy0ygzjgWmJWEHrBpk/qzPU7/ErusNxyRrDhDGYtfyp9yBiddEaBpVFAxf BcVtUsTCNWLrVW2oNzmFAJDsUua7Xx2lXj9R7CNs4MzjBDB/PHNex/kvT+5urIO9wzqP 2kpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id z34si6723938ede.93.2019.02.27.09.07.02 for ; Wed, 27 Feb 2019 09:07:03 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 39D221684; Wed, 27 Feb 2019 09:07:02 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ABECA3F738; Wed, 27 Feb 2019 09:06:58 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org Subject: [PATCH v3 09/34] m68k: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:43 +0000 Message-Id: <20190227170608.27963-10-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For m68k, we don't support large pages, so add stubs returning 0 CC: Geert Uytterhoeven CC: linux-m68k@lists.linux-m68k.org Signed-off-by: Steven Price --- arch/m68k/include/asm/mcf_pgtable.h | 2 ++ arch/m68k/include/asm/motorola_pgtable.h | 2 ++ arch/m68k/include/asm/pgtable_no.h | 1 + arch/m68k/include/asm/sun3_pgtable.h | 2 ++ 4 files changed, 7 insertions(+) diff --git a/arch/m68k/include/asm/mcf_pgtable.h b/arch/m68k/include/asm/mcf_pgtable.h index 5d5502cb2b2d..63827d28a017 100644 --- a/arch/m68k/include/asm/mcf_pgtable.h +++ b/arch/m68k/include/asm/mcf_pgtable.h @@ -196,11 +196,13 @@ static inline int pmd_none2(pmd_t *pmd) { return !pmd_val(*pmd); } static inline int pmd_bad2(pmd_t *pmd) { return 0; } #define pmd_bad(pmd) pmd_bad2(&(pmd)) #define pmd_present(pmd) (!pmd_none2(&(pmd))) +#define pmd_large(pmd) (0) static inline void pmd_clear(pmd_t *pmdp) { pmd_val(*pmdp) = 0; } static inline int pgd_none(pgd_t pgd) { return 0; } static inline int pgd_bad(pgd_t pgd) { return 0; } static inline int pgd_present(pgd_t pgd) { return 1; } +static inline int pgd_large(pgd_t pgd) { return 0; } static inline void pgd_clear(pgd_t *pgdp) {} #define pte_ERROR(e) \ diff --git a/arch/m68k/include/asm/motorola_pgtable.h b/arch/m68k/include/asm/motorola_pgtable.h index 7f66a7bad7a5..a649eb8a91de 100644 --- a/arch/m68k/include/asm/motorola_pgtable.h +++ b/arch/m68k/include/asm/motorola_pgtable.h @@ -138,6 +138,7 @@ static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp) #define pmd_none(pmd) (!pmd_val(pmd)) #define pmd_bad(pmd) ((pmd_val(pmd) & _DESCTYPE_MASK) != _PAGE_TABLE) #define pmd_present(pmd) (pmd_val(pmd) & _PAGE_TABLE) +#define pmd_large(pmd) (0) #define pmd_clear(pmdp) ({ \ unsigned long *__ptr = pmdp->pmd; \ short __i = 16; \ @@ -150,6 +151,7 @@ static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp) #define pgd_none(pgd) (!pgd_val(pgd)) #define pgd_bad(pgd) ((pgd_val(pgd) & _DESCTYPE_MASK) != _PAGE_TABLE) #define pgd_present(pgd) (pgd_val(pgd) & _PAGE_TABLE) +#define pgd_large(pgd) (0) #define pgd_clear(pgdp) ({ pgd_val(*pgdp) = 0; }) #define pgd_page(pgd) (mem_map + ((unsigned long)(__va(pgd_val(pgd)) - PAGE_OFFSET) >> PAGE_SHIFT)) diff --git a/arch/m68k/include/asm/pgtable_no.h b/arch/m68k/include/asm/pgtable_no.h index fc3a96c77bd8..eeef17b2eae8 100644 --- a/arch/m68k/include/asm/pgtable_no.h +++ b/arch/m68k/include/asm/pgtable_no.h @@ -17,6 +17,7 @@ * Trivial page table functions. */ #define pgd_present(pgd) (1) +#define pgd_large(pgd) (0) #define pgd_none(pgd) (0) #define pgd_bad(pgd) (0) #define pgd_clear(pgdp) diff --git a/arch/m68k/include/asm/sun3_pgtable.h b/arch/m68k/include/asm/sun3_pgtable.h index c987d50866b4..eea72e3515db 100644 --- a/arch/m68k/include/asm/sun3_pgtable.h +++ b/arch/m68k/include/asm/sun3_pgtable.h @@ -143,6 +143,7 @@ static inline int pmd_bad2 (pmd_t *pmd) { return 0; } static inline int pmd_present2 (pmd_t *pmd) { return pmd_val (*pmd) & SUN3_PMD_VALID; } /* #define pmd_present(pmd) pmd_present2(&(pmd)) */ #define pmd_present(pmd) (!pmd_none2(&(pmd))) +#define pmd_large(pmd) (0) static inline void pmd_clear (pmd_t *pmdp) { pmd_val (*pmdp) = 0; } static inline int pgd_none (pgd_t pgd) { return 0; } @@ -150,6 +151,7 @@ static inline int pgd_bad (pgd_t pgd) { return 0; } static inline int pgd_present (pgd_t pgd) { return 1; } static inline void pgd_clear (pgd_t *pgdp) {} +static inline int pgd_large(pgd_t pgd) { return 0; } #define pte_ERROR(e) \ pr_err("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) From patchwork Wed Feb 27 17:05:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831933 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A710315AC for ; Wed, 27 Feb 2019 17:07:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 910AC2E305 for ; Wed, 27 Feb 2019 17:07:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 846FF2E31F; Wed, 27 Feb 2019 17:07:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9AFF2E305 for ; Wed, 27 Feb 2019 17:07:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF2EE8E000E; Wed, 27 Feb 2019 12:07:08 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BA5518E0001; Wed, 27 Feb 2019 12:07:08 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A44128E000E; Wed, 27 Feb 2019 12:07:08 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id 4F0B88E0001 for ; Wed, 27 Feb 2019 12:07:08 -0500 (EST) Received: by mail-ed1-f71.google.com with SMTP id x13so5022131edq.11 for ; Wed, 27 Feb 2019 09:07:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=8WwnUWaYGMHoutYzvtb527XsVGA/6K7onIq0f5cih6c=; b=JpccEGmz0GexxoGTD/Dok4Z+IQNlsR9telJua3ygesLENOMwa3ZmScPuOMnoH7j6Bh EdZJzQv1V31qLEZPOe7G46y7W2d8HME/uCOTWO3jDdOkUnswb+o1lKk8+gOwrc8xGi5e FDNsUUpHhbx9WZT3g89Hj8dqa2UKOiKzH50pYDADFi2UzCPKEj1Odfp7TXeh8D+wLyKA arTX9oXaAxkv9b/tBqwb3aNGCmIMRWscO9nD+PBl7K/UZZ9FHr+QCslv21ce/OUU5AFL 6CMFa9K/wt9hZkLJxTqvpeNyROkGCA90iWNBjc064EFw3lVjGd0GDzI10NLoZECGK8DI 2qxg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuY7QWym/72WjcUpkZjRHNHrNDNdhlqGq7qHB/wabsGgX0OIf9u+ vpw5PnUjulc0pVP9qwrJVGni17vEKpmjJjnKa7lY0biY3S3rzuT823c4wcV7SspSpqHa+EoovSD Y/Ssqy3R1yvpdCA9eyxjnfedOFBIUjzT/ROr+/5FxxbeTVwr3/knLlgAEaMhky5xweQ== X-Received: by 2002:a50:a4b1:: with SMTP id w46mr3063461edb.215.1551287227822; Wed, 27 Feb 2019 09:07:07 -0800 (PST) X-Google-Smtp-Source: AHgI3IZPEvt4qI0vg/VAwUlvTXm8vI8DLVI0PrBe+fGzMUkOr7WmRLHbkTVhzvVk+FzSDwfokZlp X-Received: by 2002:a50:a4b1:: with SMTP id w46mr3063393edb.215.1551287226862; Wed, 27 Feb 2019 09:07:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287226; cv=none; d=google.com; s=arc-20160816; b=as29YvEGLyDiMMc3b9lO7UgqgZEFT5Rbo/g6nHna/HPPwpv9XgbvKTADKo2wGXfqL5 Z7RjhyOOALMTGqrlMUI4kcWExu9399yv561pQgr8zLW9w0t09/8LpUxc3EaLyjdkASV0 A3/1LTjsuZzW0BL3WIZtEtKmf+pZWZN3hyvPG56q3xkmLkBUfd1WTT/QpnFlO2J56U9q LXwg6UYhPOI8wS4IZkGNl1IAVbS1+VMIW4bt2hLliSfkfOMLE9d5Y8D9QQ7jiyS+m8vo sVGgBistZU8V4gaJWXt+uzo5C6dmE8nCzdVuGbVhRIXBo3dspxa5/LMSGOkN6dzgMv/w a8KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=8WwnUWaYGMHoutYzvtb527XsVGA/6K7onIq0f5cih6c=; b=sr2xzMRxInSNPmI7+OXvs/8OYCam6CxYrcuVqAt7bD2CFM9jl1u+p7rLsZB8m7KH/g RKCH7TL3cTHDdwR+Lw4S2QpHHU3n8YlOOY/FS+d9w66tZwI8ZCQ9jh2e6t2IKPBd0OGt fM4kdOBxGh60LTIJnH+tJGTaq/TKooh91DWSKQW9X3e7xK4lbbduzsZJDluMSDyhMCDh d0NL7N4lgikej6XiPwcYN9w08ElSD2IDkiNC4zmpAx3D0meb/0aNQGlBN4rV8qVKwpiB RIL0IqalQWNe6l0saXQ9c7PvF/iY14IVp+CcYSP7pbd9bgSszC6k3YiqoRYwQb7ZanEC baPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id s45si260305edm.357.2019.02.27.09.07.06 for ; Wed, 27 Feb 2019 09:07:06 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D81C11688; Wed, 27 Feb 2019 09:07:05 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 794C43F738; Wed, 27 Feb 2019 09:07:02 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Michal Simek Subject: [PATCH v3 10/34] microblaze: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:44 +0000 Message-Id: <20190227170608.27963-11-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For microblaze, we don't support large pages, so add stubs returning 0. CC: Michal Simek Signed-off-by: Steven Price --- arch/microblaze/include/asm/pgtable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h index 142d3f004848..044ea7dbb4cc 100644 --- a/arch/microblaze/include/asm/pgtable.h +++ b/arch/microblaze/include/asm/pgtable.h @@ -303,6 +303,7 @@ extern unsigned long empty_zero_page[1024]; #define pmd_none(pmd) (!pmd_val(pmd)) #define pmd_bad(pmd) ((pmd_val(pmd) & _PMD_PRESENT) == 0) #define pmd_present(pmd) ((pmd_val(pmd) & _PMD_PRESENT) != 0) +#define pmd_large(pmd) (0) #define pmd_clear(pmdp) do { pmd_val(*(pmdp)) = 0; } while (0) #define pte_page(x) (mem_map + (unsigned long) \ @@ -323,6 +324,7 @@ extern unsigned long empty_zero_page[1024]; static inline int pgd_none(pgd_t pgd) { return 0; } static inline int pgd_bad(pgd_t pgd) { return 0; } static inline int pgd_present(pgd_t pgd) { return 1; } +static inline int pgd_large(pgd_t pgd) { return 0; } #define pgd_clear(xp) do { } while (0) #define pgd_page(pgd) \ ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) From patchwork Wed Feb 27 17:05:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831937 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9E6DD1390 for ; Wed, 27 Feb 2019 17:07:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 874802E305 for ; Wed, 27 Feb 2019 17:07:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79B9F2E31F; Wed, 27 Feb 2019 17:07:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD5D92E305 for ; Wed, 27 Feb 2019 17:07:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 16C048E000F; Wed, 27 Feb 2019 12:07:13 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 11B518E0001; Wed, 27 Feb 2019 12:07:13 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F27F98E000F; Wed, 27 Feb 2019 12:07:12 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 96EE18E0001 for ; Wed, 27 Feb 2019 12:07:12 -0500 (EST) Received: by mail-ed1-f72.google.com with SMTP id u12so7237843edo.5 for ; Wed, 27 Feb 2019 09:07:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ZR8Pi3jJ1KIw24YeuZCSXA+UGKblSCif1NtzpVDNSOM=; b=Itbg5V1bT4tVpEGR4PlCvqZDLoSEh+w/UaIYEE9r6HSSfAIqWFrFtPQ3cTnVUHyae3 7u1JXB1SdwgNqrbFwIAx6+5Oz8UHTMB9q/jJkhyYWOR6IevvAjmS0A2re812GEQSMosE z7pe8gonrHED8LZsIQ6PmVha8oyg+I1TNr1O0Bs1s+3gDNKp3LYgp0+Ie8wbq7klVkk1 3TB/m+ko8CrHxkCD1Nw1T15hJFv8B35/+6t6TemlF6n1Hj+be42e1C9PjMtRe6WBMRgs fovd8sJtvBXgUBGwUK18PL2cSP+GJczQtUazUikXZ04AnOFB7Q20qh+ylHK4LTgThOK5 AzDA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAubXZZ8gtKzX6gjfcgoSRyD/6RsNjlxscSD/F7WDkDIwHZYlqOxV alD0UBoWqXbaHLa4Ys9POKSdhDhaXuo5wU8IL8zkJgB62KkLEAhEMxwCvsxZQ8oMBtdduyDd0bQ 2iV51uGyrLBmmPOajGo1AaVBkPSksSJoWtO8UafQFaH+/SSM5rOfBuj88T7w0+CX3gA== X-Received: by 2002:a50:9e61:: with SMTP id z88mr3268324ede.100.1551287232127; Wed, 27 Feb 2019 09:07:12 -0800 (PST) X-Google-Smtp-Source: AHgI3IbWMxZ9VCX9Bqy3c8EPMyNPWrWMqMprp9uLorFASo3qwPuavuYVjXp5sAuglerr8KfGlIqU X-Received: by 2002:a50:9e61:: with SMTP id z88mr3268248ede.100.1551287231178; Wed, 27 Feb 2019 09:07:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287231; cv=none; d=google.com; s=arc-20160816; b=GF8kdY0HYTKCB8kwT179h4R2pko7cKPmxOuwl/2c38o6aWnJLtURGrJdAzMpVwhKAA +Q9m9Dei/E+nFSKJRawknlu21m6etKapkBK5jt4V2aCKEEql6uELjPgXkFpLZbMb+6Wu gvBbtopCMjIBZ607Zpv3C14XgyaR1TixnsDGwidpxFfRRLPv21jXUbarVebUcmSn11ZM H5VycVoOgIImvmow/vr8mTZDhHXK5kuqRgwJZzhuXdTes8hjGArDBQZADDP11A/L4mH9 BaGFBiFObBwvdrdGtvgieIliocxtrUlzsQejR3/B/TIkTMjeokfVwApjb7znJR5650Ml oTSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=ZR8Pi3jJ1KIw24YeuZCSXA+UGKblSCif1NtzpVDNSOM=; b=l9ewjp1UXSH6HyOj92s1EmhzieGQQKDgVTd4kvvhosnXgMn+0czbNUYLjufIAFbB5r DuGLhONPnGBlP98VmCbM1PnkIQgdiBy/BZn9qQhJ945MUavjwMhTkwOhsjcpwVibu5kb OIQxt+Y6lGHYN3OhydvXwZvGCdGuEHRO8Dafmz6mZSXdydiTgpTnrslo36zFq+Sc3q2G LiLzlHVyW2d2hjNtrFj5znmGbydPUrQf4J92zDrQle5H41WZzkC3psDX7rVQ/nwiQq8H ITaCjQnogFx8+/jTCOfpeVGHNgfM4NRD4t1pdG2p2lR45Qfn4Dgq2GJPDXioXGRmcrRQ RjUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id bq19si3264776ejb.45.2019.02.27.09.07.10 for ; Wed, 27 Feb 2019 09:07:11 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EC55B16A3; Wed, 27 Feb 2019 09:07:09 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 240003F738; Wed, 27 Feb 2019 09:07:06 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Ralf Baechle , Paul Burton , James Hogan , linux-mips@vger.kernel.org Subject: [PATCH v3 11/34] mips: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:45 +0000 Message-Id: <20190227170608.27963-12-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For mips, we don't support large pages on 32 bit so add stubs returning 0. For 64 bit look for _PAGE_HUGE flag being set. This means exposing the flag when !CONFIG_MIPS_HUGE_TLB_SUPPORT. CC: Ralf Baechle CC: Paul Burton CC: James Hogan CC: linux-mips@vger.kernel.org Signed-off-by: Steven Price --- arch/mips/include/asm/pgtable-32.h | 5 +++++ arch/mips/include/asm/pgtable-64.h | 15 +++++++++++++++ arch/mips/include/asm/pgtable-bits.h | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/arch/mips/include/asm/pgtable-32.h b/arch/mips/include/asm/pgtable-32.h index 74afe8c76bdd..58cab62d768b 100644 --- a/arch/mips/include/asm/pgtable-32.h +++ b/arch/mips/include/asm/pgtable-32.h @@ -104,6 +104,11 @@ static inline int pmd_present(pmd_t pmd) return pmd_val(pmd) != (unsigned long) invalid_pte_table; } +static inline int pmd_large(pmd_t pmd) +{ + return 0; +} + static inline void pmd_clear(pmd_t *pmdp) { pmd_val(*pmdp) = ((unsigned long) invalid_pte_table); diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h index 93a9dce31f25..981930e1f843 100644 --- a/arch/mips/include/asm/pgtable-64.h +++ b/arch/mips/include/asm/pgtable-64.h @@ -204,6 +204,11 @@ static inline int pgd_present(pgd_t pgd) return pgd_val(pgd) != (unsigned long)invalid_pud_table; } +static inline int pgd_large(pgd_t pgd) +{ + return 0; +} + static inline void pgd_clear(pgd_t *pgdp) { pgd_val(*pgdp) = (unsigned long)invalid_pud_table; @@ -273,6 +278,11 @@ static inline int pmd_present(pmd_t pmd) return pmd_val(pmd) != (unsigned long) invalid_pte_table; } +static inline int pmd_large(pmd_t pmd) +{ + return (pmd_val(pmd) & _PAGE_HUGE) != 0; +} + static inline void pmd_clear(pmd_t *pmdp) { pmd_val(*pmdp) = ((unsigned long) invalid_pte_table); @@ -297,6 +307,11 @@ static inline int pud_present(pud_t pud) return pud_val(pud) != (unsigned long) invalid_pmd_table; } +static inline int pud_large(pud_t pud) +{ + return (pud_val(pud) & _PAGE_HUGE) != 0; +} + static inline void pud_clear(pud_t *pudp) { pud_val(*pudp) = ((unsigned long) invalid_pmd_table); diff --git a/arch/mips/include/asm/pgtable-bits.h b/arch/mips/include/asm/pgtable-bits.h index f88a48cd68b2..5ab296dee8fa 100644 --- a/arch/mips/include/asm/pgtable-bits.h +++ b/arch/mips/include/asm/pgtable-bits.h @@ -132,7 +132,7 @@ enum pgtable_bits { #define _PAGE_WRITE (1 << _PAGE_WRITE_SHIFT) #define _PAGE_ACCESSED (1 << _PAGE_ACCESSED_SHIFT) #define _PAGE_MODIFIED (1 << _PAGE_MODIFIED_SHIFT) -#if defined(CONFIG_64BIT) && defined(CONFIG_MIPS_HUGE_TLB_SUPPORT) +#if defined(CONFIG_64BIT) # define _PAGE_HUGE (1 << _PAGE_HUGE_SHIFT) #endif From patchwork Wed Feb 27 17:05:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 783DE15AC for ; Wed, 27 Feb 2019 17:07:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 613352E305 for ; Wed, 27 Feb 2019 17:07:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 546832E31F; Wed, 27 Feb 2019 17:07:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA8812E305 for ; Wed, 27 Feb 2019 17:07:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1437D8E0010; Wed, 27 Feb 2019 12:07:17 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0F2DC8E0001; Wed, 27 Feb 2019 12:07:17 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F25C48E0010; Wed, 27 Feb 2019 12:07:16 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 957768E0001 for ; Wed, 27 Feb 2019 12:07:16 -0500 (EST) Received: by mail-ed1-f72.google.com with SMTP id u25so7228972edd.15 for ; Wed, 27 Feb 2019 09:07:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=vbZU3Jpl8GuYX6FyWhyD9GsHMstn/Gx+XRtazXG+JbY=; b=J2OpAxc5A8ksa10EK61PycxltU0JTcKwvM1pRI8A4HdNPFhu8ABtyKTM9XjgbyiQ4A R7ucZKzEiBtMTbCyshmwu1tFGMctu/SaUCPcAoJHs8VrGbbwkTKkmlUkFUhoz0KhwBmn UHSlpOySTKB7G+vWa5EmfBvfPTKJGG/x3Vh046fPQmzVk5p2x1iIncUXaXOEJja90XK7 M/lBg90SPG7Zsy3w+KWk7/wY5JfcAFgCU8AwN0vjEYq72QOAExg895y2PLgnpK6kluz5 Rzi7f3TC6Bh+qkEMyD8OcJzVEAoG1NAxCMzImajpjX/gW4WzbqywdQQF5//awhURM8lr UZFg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAubr9M6sOzxukjgfM1D0Z0CB+JdiN8oNWaCmhaF0f4EHFDjBtEuQ giJiV2MaNgYEdilMv9WBSFUSjypzEN4v8UarKFelo/mznpskGLzds8iZMgH1I3Qk2TmHCDDlXfe OYzHm4fAu6Y2M1mlRD9G4elB9V4xmd8rLg15vvIdXFed2Vf5Kdbaqkb9VJ5x+4aPL9w== X-Received: by 2002:a50:97d5:: with SMTP id f21mr3116316edb.293.1551287235959; Wed, 27 Feb 2019 09:07:15 -0800 (PST) X-Google-Smtp-Source: AHgI3IbVpDu5DIlyvkeavVC8HjxryTmwWPTRKwUEUYryb94kagt16vBK16lJrM2k00HX9L+iADMC X-Received: by 2002:a50:97d5:: with SMTP id f21mr3116231edb.293.1551287234708; Wed, 27 Feb 2019 09:07:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287234; cv=none; d=google.com; s=arc-20160816; b=R/FFE8AIviEaX2VT6NwkYO7TqmTrpSNCwbGqGH5BTIS9yL4SYjvQCXFBol7oD1yyY1 PSNuQLZVv3BvIz3MDaZY/2kAtV6DiNtQ3EFK3tCoBZlNsqhi7sBDnIIhOh2GpuRSrvRO 1dS437a6F/0nTN7bMR1eMQQLkzE9eCZAqoTBGAQxjqFXI3eMMszvuJurG5cP37EKjJd1 GaOrx+4qtKn3pPKXYipDpGtKYR9Y5GLe9yt5I7dQcokiIezDOprlBz2U0cD6QdKPz9a5 ONBBqtmC2BZXWuC+KoAqm7UdDO0KphovIUsfCN2uIh4F33CLPeBLz+XG05gUYkCYRq/8 wfwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=vbZU3Jpl8GuYX6FyWhyD9GsHMstn/Gx+XRtazXG+JbY=; b=S4k8IYx7pQMsQth2/A/PnScrb8klyQ4v3Sokq/6h/M6iHeKNsjZ8qZqqNuu5gjKj2z eJJn2aYHOGX/iZQyJnfSoRJFaSZd0ZEUPjtYFYg3piKMUqgJqHwc2sw6yPQeIOzeItYS TINE7Ziurl9CeRwZAAwS6pD7eucCHmA8HqggL3U9vYpWDqGhnmsOBDpJ9JTYNQVpwUFb 1B0uqoaQwFol1mT6GUpyhtReS7NUi2yQISKux4OmBLFv0edyGSKYq5tMNrZM/OCM+LNS VbDgJgoz7G20ggPY5zzGUNzW4VnMmevcSxgMgp3jYNPz0cv1CqXIAj609C23/NFYgvRP HtHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id e17si1612372ejr.1.2019.02.27.09.07.14 for ; Wed, 27 Feb 2019 09:07:14 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BD4F5174E; Wed, 27 Feb 2019 09:07:13 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 384C63F738; Wed, 27 Feb 2019 09:07:10 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Greentime Hu , Vincent Chen Subject: [PATCH v3 12/34] nds32: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:46 +0000 Message-Id: <20190227170608.27963-13-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For nds32, we don't support large pages, so add stubs returning 0. CC: Greentime Hu CC: Vincent Chen Signed-off-by: Steven Price --- arch/nds32/include/asm/pgtable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/nds32/include/asm/pgtable.h b/arch/nds32/include/asm/pgtable.h index 9f52db930c00..202ac93c0a6b 100644 --- a/arch/nds32/include/asm/pgtable.h +++ b/arch/nds32/include/asm/pgtable.h @@ -309,6 +309,7 @@ static inline pte_t pte_mkspecial(pte_t pte) #define pmd_none(pmd) (pmd_val(pmd)&0x1) #define pmd_present(pmd) (!pmd_none(pmd)) +#define pmd_large(pmd) (0) #define pmd_bad(pmd) pmd_none(pmd) #define copy_pmd(pmdpd,pmdps) set_pmd((pmdpd), *(pmdps)) @@ -349,6 +350,7 @@ static inline pmd_t __mk_pmd(pte_t * ptep, unsigned long prot) #define pgd_none(pgd) (0) #define pgd_bad(pgd) (0) #define pgd_present(pgd) (1) +#define pgd_large(pgd) (0) #define pgd_clear(pgdp) do { } while (0) #define page_pte_prot(page,prot) mk_pte(page, prot) From patchwork Wed Feb 27 17:05:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831943 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A9121390 for ; Wed, 27 Feb 2019 17:07:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7B452E305 for ; Wed, 27 Feb 2019 17:07:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBFC52E31F; Wed, 27 Feb 2019 17:07:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F0392E305 for ; Wed, 27 Feb 2019 17:07:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 674558E0011; Wed, 27 Feb 2019 12:07:20 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5D9358E0001; Wed, 27 Feb 2019 12:07:20 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4778B8E0011; Wed, 27 Feb 2019 12:07:20 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id E46918E0001 for ; Wed, 27 Feb 2019 12:07:19 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id u25so7229048edd.15 for ; Wed, 27 Feb 2019 09:07:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=8hX07yhBmDg+UJCmPXqdceXMzT4L50HzWM5i97rNZtY=; b=PatxfNIrUr+1/tFiS9nbKL91w8mBQuhgot0dqRsvXR5dFWCGtBL8tY4a3LB3szFOYJ Nq7tjbnzpK4GNKXAUFWdEaGg3A9pLmA7xVW4tx05CTycUF0z7SuZ7Pmp7X237RCpz1+W DCSOXgWyvwLNq8q8xKK19vqhsQhjB0dEYr/j+DjQqO6zX9+Au4mat7PWnpL1xjosn5WE kiaDEBUitDLulQVNbP1kTk6YnN4vTjmjveMmIRwKB1WHoaX92b58QdIPMys4djUL5wyL SRxSAHAwrGVEo/BlQoDb/PpOXGMvv7o2Hj299KdSsPcLdHAXANNei84Xktdc9W0pipTF 55qg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuZ97LN2jTCQZ3cts0UnWqshwVuByOTg88xGyay3MUcbiJjJqjlZ fvmRVC/PCK30ObYgawkEKP1Ab+Jg966qj5JFXTjXjirEQm4PWCosffUNAEJFzdyG2lkKm/sHB5+ pb4bVX2tfx4sQ2jZA0PFHq1nhAThSNGGuYB6HYSmx50I8tOadbU1TtiennF54/NIeOA== X-Received: by 2002:a50:b574:: with SMTP id z49mr3136984edd.283.1551287239452; Wed, 27 Feb 2019 09:07:19 -0800 (PST) X-Google-Smtp-Source: AHgI3IYK5IADUlSvEffssp5Q0q8t3pLvzl2z17gt5m9FvwW1jvTCA2hmBIREr4x2jejSM6aCqx+P X-Received: by 2002:a50:b574:: with SMTP id z49mr3136926edd.283.1551287238557; Wed, 27 Feb 2019 09:07:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287238; cv=none; d=google.com; s=arc-20160816; b=sjo/+EZ7ewEfNs4G1bQEFHcfKM5H5eeJqiYLBEUQzkvdmyoo49yhUby+SbJ8C4DJAl oXE+vmQ47HRd0oiBHE2xsaLTcdEdtUh/6hk+6SNKaqFuMMtdMXYXFeennB5tHRttY5Ro W+gcEgxgNtRbXDktt8YxLxOTK9CReWAXsIJsZEfGUrR/9T13ZU+vVrBkeyOi4Jn2GWk3 JFw7O7nOc1DxUC/qwhDi1IOBq/KLyOx36BHngXwiz5RHheCjjYwIKWxcnr2LcjfFIrWU lQAtiyNCBY1gzNguqCpcPQk2WC3pqoWbUc1jYka1Ok0tQnBr3J2Mfnb8YRx8OkuDWdJv UEKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=8hX07yhBmDg+UJCmPXqdceXMzT4L50HzWM5i97rNZtY=; b=aIOtqdNyBhbJxb/euwa+BdSr1opjeTjlkE6IpeSuEIKgNapOcnOqjMSHEg/u4FMIcY oDNbwAegxedNL2KKcIqSSbTTgxETRUpTpFPHdAcM5wUgQlUCJn4wJ9/oa89wZEHQ/rRF 37BdbN+9ksAmnBWxd3WyCxjnVl5hqekkdseEWPpt1y50EfUzE/U44e3pqtgZpxX2jKn0 fg7r2mcXU2AHspnWkqqiLM1bFtzDTqbHBib+ac/tWKnZH6XhE9YmnHOfrgyoXUi1F2gk nTkDGDwmTF6W9nw7aNI/QqjiD2ZVGOAO72gVPjAZ6MhRXuzkjvhcspgwEUdJKiVerifO IoLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id h43si2531142edb.278.2019.02.27.09.07.18 for ; Wed, 27 Feb 2019 09:07:18 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8AA0B1715; Wed, 27 Feb 2019 09:07:17 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0842D3F738; Wed, 27 Feb 2019 09:07:13 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Ley Foon Tan , nios2-dev@lists.rocketboards.org Subject: [PATCH v3 13/34] nios2: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:47 +0000 Message-Id: <20190227170608.27963-14-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For nios2, we don't support large pages, so add a stub returning 0. CC: Ley Foon Tan CC: nios2-dev@lists.rocketboards.org Signed-off-by: Steven Price --- arch/nios2/include/asm/pgtable.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/nios2/include/asm/pgtable.h b/arch/nios2/include/asm/pgtable.h index db4f7d179220..b6ee0c205279 100644 --- a/arch/nios2/include/asm/pgtable.h +++ b/arch/nios2/include/asm/pgtable.h @@ -190,6 +190,11 @@ static inline int pmd_present(pmd_t pmd) && (pmd_val(pmd) != 0UL); } +static inline int pmd_large(pmd_t pmd) +{ + return 0; +} + static inline void pmd_clear(pmd_t *pmdp) { pmd_val(*pmdp) = (unsigned long) invalid_pte_table; From patchwork Wed Feb 27 17:05:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831945 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6407815AC for ; Wed, 27 Feb 2019 17:07:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C2FF2E305 for ; Wed, 27 Feb 2019 17:07:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 407622E31F; Wed, 27 Feb 2019 17:07:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 771BC2E305 for ; Wed, 27 Feb 2019 17:07:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DEC7D8E0012; Wed, 27 Feb 2019 12:07:24 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D9D498E0001; Wed, 27 Feb 2019 12:07:24 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C8CE28E0012; Wed, 27 Feb 2019 12:07:24 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id 6BE1A8E0001 for ; Wed, 27 Feb 2019 12:07:24 -0500 (EST) Received: by mail-ed1-f71.google.com with SMTP id f2so7102327edm.18 for ; Wed, 27 Feb 2019 09:07:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=T6NiSwMMvhnoe2vgI+8wifL/HFKKnl7ekrNCMWErvF8=; b=BXbzmDrlY1MJu3px5AobWfm8nl9R787w9R5XqutvOuZnS2qMK6s55hpZq5hdp9Ipg4 CQ+jtGwKdXJ38Wq0QM9ez43OLQ5fFOCVoX1JBH7XKwdBtQHAV0YdGHYv3Zfm1ig99pmk 55d4+W0s6Jxo5vrPpGdVWEi2q/7cqweceOJuGOA332TFe0SDtviFPsP4FxzC39uVY8lf B7VdL1P6h8vOH7fjI2c56LmVRaNiWZxxrvnfUICR1wDhG1XYsemBaZMY1+dNMrEMglJ8 l9c1mOf7+wa9QLSa2vnQxKacHP0N1aA4kv/GIMK1tbox1i/7jrHqEBD5+9wUVEA/+wUw nJaQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAubMXuhZy7JB4S4AIq9+SmwYjUGIG/COv8Bxa4iAi/jWjtxX1GXs q8bxatNJNtKYqBM+NQnCgSrJTvxZ1tKhJPc6zWOyVogskmnVSTZwtn14fj1gsB664L7UxxuQM/h 2iyeFeUhgMgISwXPorMtc/+n1FPNTvTkr+pYi/iCwyMWe8j4Vc5pY+cN6EJ5izpUDUQ== X-Received: by 2002:a17:906:3952:: with SMTP id g18mr2229519eje.247.1551287243856; Wed, 27 Feb 2019 09:07:23 -0800 (PST) X-Google-Smtp-Source: AHgI3IY89YvPT5NNZtkeK5WkpENeNbrrdlgx015sMTrad+/5oxtc3ovJ9+Y/lXGzWzSODOgPuLVu X-Received: by 2002:a17:906:3952:: with SMTP id g18mr2229446eje.247.1551287242598; Wed, 27 Feb 2019 09:07:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287242; cv=none; d=google.com; s=arc-20160816; b=g5eVpiXM6ptFJwZ5YQ83fHW+Yz92OehZefzH/6AI9zh7WwPdjCuqylZjNRo1BAxGoy 6lhUE/d2P53cN0uakP6VpHroT45AGF3BKrmFb6qdA3zCtptiuEkH9Ob9KrCvFXBMgtnI vbKNoV8sVW0KVzjDTjtg6tK2b9aOCD7//IoIBU8rLcpx3lyfSjYmEi1b+4iMWl4Epdm8 0KPZL7wJtUFstDBrsfc69fCvBhQuNld3h83qoOipNxeZ23s89+DBfwJsPVQD9LQ8IVNs 97NBoa98ftRwErku8GZp17KDpzwMawSGZEWKLBO9vLtIXMo/aCjY35wXdUucnqsR2WBV 8xzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=T6NiSwMMvhnoe2vgI+8wifL/HFKKnl7ekrNCMWErvF8=; b=NglpmAwO4y+aYpTwsfCsSju9TjG4zc2jcJg1SnZeUZMyiXNCnFKK1Y6ntiBjrtaRdc pkZDyiETK55AvDBJS45H0SL09zFzMHfTzbACgymH21U85uEXWy+0Pmw3HeOlcktJWsxv 8pL3K8+S/nNrRRglc/FAIuRQ2NM0WmK9lhqQUQEuWYKCpYEX70dSF9avU7XYDq9GNaxp 5KaGd87+51XLC+YJ7N+QLYVgpMmltpzhVuG2GAzMtz5TvkrMr0G5NJT3njunV5yV1x+j reIbSL4n1W/zmQ9L67z5616DrMdvVDFa8EZdB8UbiyvMSbD0F4EoUH/ZPgdbf3gu7GSm co7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id b56si1818140edc.402.2019.02.27.09.07.22 for ; Wed, 27 Feb 2019 09:07:22 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9F2011684; Wed, 27 Feb 2019 09:07:21 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CAC793F738; Wed, 27 Feb 2019 09:07:17 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Jonas Bonn , Stefan Kristiansson , Stafford Horne , openrisc@lists.librecores.org Subject: [PATCH v3 14/34] openrisc: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:48 +0000 Message-Id: <20190227170608.27963-15-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For openrisc, we don't support large pages, so add a stub returning 0. CC: Jonas Bonn CC: Stefan Kristiansson CC: Stafford Horne CC: openrisc@lists.librecores.org Signed-off-by: Steven Price --- arch/openrisc/include/asm/pgtable.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/openrisc/include/asm/pgtable.h b/arch/openrisc/include/asm/pgtable.h index 21c71303012f..5a375104ef71 100644 --- a/arch/openrisc/include/asm/pgtable.h +++ b/arch/openrisc/include/asm/pgtable.h @@ -228,6 +228,7 @@ extern unsigned long empty_zero_page[2048]; #define pmd_none(x) (!pmd_val(x)) #define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK)) != _KERNPG_TABLE) #define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) +#define pmd_large(x) (0) #define pmd_clear(xp) do { pmd_val(*(xp)) = 0; } while (0) /* From patchwork Wed Feb 27 17:05:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831947 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 229C015AC for ; Wed, 27 Feb 2019 17:07:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B59F2E305 for ; Wed, 27 Feb 2019 17:07:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F23062E31F; Wed, 27 Feb 2019 17:07:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 619182E305 for ; Wed, 27 Feb 2019 17:07:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC8B08E0013; Wed, 27 Feb 2019 12:07:28 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D4F048E0001; Wed, 27 Feb 2019 12:07:28 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C404C8E0013; Wed, 27 Feb 2019 12:07:28 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id 663ED8E0001 for ; Wed, 27 Feb 2019 12:07:28 -0500 (EST) Received: by mail-ed1-f71.google.com with SMTP id j5so7174273edt.17 for ; Wed, 27 Feb 2019 09:07:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=cpDv3mBvbD8hNAclYHZlrnWhwlRtUYmq/kJWE5bqZAU=; b=lzTvF9xqZHFg1zRAIRkMPxun0kNFQN9y+9FdVwPCv+TOLaugLg4cue9z4svU0FgYtj Iiud3+PRxxAOI76cFISyKUjdMbd1EYfUAID8GsYpgg112vzv6olH+pDw+w1KCw03d5Al H5mGR/xfSSjQMExvTXzOtvKiwHQxYz07CobdIbl0o5hViQ9NVcT2KmPhOdsDqtg/d4k5 8zqJCqxS6OheinnyZPEdkQVrOEoOxaOxjNNd70+vUiC0mRM8YT0oaW1488+lcv+oPd0n Nnw+wyXGOkQcym/4BH1VlYl2iF2hr6ezvTn/iQXst5tybUqnRCFFBWlWfKxCZVhYjdFf toKw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuYh0loDrxwnTokBQEAaqM/dg8umgJkU14ykdBliPvQNALZkOuvx +KfvVgjjZTo3QveKAZ5higCwRvGkBLvTce8tFztQu9rjWzCUDsUOrlTkbGmbftXuzdRh3NxG2IX zRcAqLAks3xqChS+KdGtkKl/O8XMuhtO4YRUarGxSu5xDGsNutQEFpWIjpT6ECtUSCg== X-Received: by 2002:a50:87dc:: with SMTP id 28mr3116923edz.168.1551287247918; Wed, 27 Feb 2019 09:07:27 -0800 (PST) X-Google-Smtp-Source: AHgI3IbsrV5f/Puav7WGgkksBLsniEWetIgIebu5OlDmCAIO6ZMMGL/tTA9Fxa4Nr1dBiG7ZObqp X-Received: by 2002:a50:87dc:: with SMTP id 28mr3116833edz.168.1551287246455; Wed, 27 Feb 2019 09:07:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287246; cv=none; d=google.com; s=arc-20160816; b=y/wG0xcwN/BVEPRrBzR+j1ADBCOk3Z/YZf0VAffD6uwnDoOxxqlhTZwEfiYao2bmzw g+ofsBZHk4PrHx7k2SE6l4yPqtUKhLGXgghAmGz4cVRyp0cetB8YgVVDCQXdeKyqBFaW 0S5ZvT8nry6BAE4R2ij+zFBhCJHS0ye4awG6/lBruQTpAdTu78wg8iEUgMgSsb2mBGiW zKdC49xxY23cW8HZ4wlOW30PjyVZxxToiz8aUx0RM2Y4p3fn1oLznLAnrhP+cAZzE6s+ jZyjGWJgtmjW6pUkU5lT8rFcecvrr4cwuarkcOuWGjell99Px/+dc8WWbvn75vYMpmxm +F2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=cpDv3mBvbD8hNAclYHZlrnWhwlRtUYmq/kJWE5bqZAU=; b=XefyUf0I1ptzBG+SeH18rilJEwFvmvYbb+vD0Vr4b1pQVVLHBBsH6/d5v3g1MurbWT oQQu6GAtpZb89Vpb79xlZDdyvHNeHzOe7znLK7qZfvpQaEdX5F42oWMl1laCzQQyK4F4 IdK1cgju46Y3tV7gSMbDNa/na2SY13OlKP3vjAI4unvBft2XC73Kw/raLohEFT2Nz7M1 py8y8mmJjezGWnpD7keqOgGUrw2C3NysT4KsF72Fdni0Fnq8rsD5Am+LaG9PxyQdZGyB kM23/2js2OSPQzdeYiuPPC2+jvpUhGIoAKX47wvmnKEl4MMKd7DHSddIJ4T71ws8fS1G DLSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id n21si2345155eja.150.2019.02.27.09.07.26 for ; Wed, 27 Feb 2019 09:07:26 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8FFCD1688; Wed, 27 Feb 2019 09:07:25 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DEAE63F738; Wed, 27 Feb 2019 09:07:21 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , "James E.J. Bottomley" , Helge Deller , linux-parisc@vger.kernel.org Subject: [PATCH v3 15/34] parisc: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:49 +0000 Message-Id: <20190227170608.27963-16-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For parisc, we don't support large pages, so add stubs returning 0. CC: "James E.J. Bottomley" CC: Helge Deller CC: linux-parisc@vger.kernel.org Signed-off-by: Steven Price Acked-by: Helge Deller # parisc --- arch/parisc/include/asm/pgtable.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h index c7bb74e22436..1f38c85a9530 100644 --- a/arch/parisc/include/asm/pgtable.h +++ b/arch/parisc/include/asm/pgtable.h @@ -302,6 +302,7 @@ extern unsigned long *empty_zero_page; #endif #define pmd_bad(x) (!(pmd_flag(x) & PxD_FLAG_VALID)) #define pmd_present(x) (pmd_flag(x) & PxD_FLAG_PRESENT) +#define pmd_large(x) (0) static inline void pmd_clear(pmd_t *pmd) { #if CONFIG_PGTABLE_LEVELS == 3 if (pmd_flag(*pmd) & PxD_FLAG_ATTACHED) @@ -324,6 +325,7 @@ static inline void pmd_clear(pmd_t *pmd) { #define pgd_none(x) (!pgd_val(x)) #define pgd_bad(x) (!(pgd_flag(x) & PxD_FLAG_VALID)) #define pgd_present(x) (pgd_flag(x) & PxD_FLAG_PRESENT) +#define pgd_large(x) (0) static inline void pgd_clear(pgd_t *pgd) { #if CONFIG_PGTABLE_LEVELS == 3 if(pgd_flag(*pgd) & PxD_FLAG_ATTACHED) @@ -342,6 +344,7 @@ static inline void pgd_clear(pgd_t *pgd) { static inline int pgd_none(pgd_t pgd) { return 0; } static inline int pgd_bad(pgd_t pgd) { return 0; } static inline int pgd_present(pgd_t pgd) { return 1; } +static inline int pgd_large(pgd_t pgd) { return 0; } static inline void pgd_clear(pgd_t * pgdp) { } #endif From patchwork Wed Feb 27 17:05:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831951 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6940E15AC for ; Wed, 27 Feb 2019 17:07:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 530932E305 for ; Wed, 27 Feb 2019 17:07:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 470852E31F; Wed, 27 Feb 2019 17:07:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B3B92E305 for ; Wed, 27 Feb 2019 17:07:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0575D8E0014; Wed, 27 Feb 2019 12:07:33 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 00A1B8E0001; Wed, 27 Feb 2019 12:07:32 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E148D8E0014; Wed, 27 Feb 2019 12:07:32 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 83F9E8E0001 for ; Wed, 27 Feb 2019 12:07:32 -0500 (EST) Received: by mail-ed1-f72.google.com with SMTP id o27so7249613edc.14 for ; Wed, 27 Feb 2019 09:07:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=L7+4dfDNLeQ8Cyqd1Z54ELoUfhtBI7Oe/4rtJxjOb50=; b=dqK25XP9oavqD6wc2DH29RDVaVYzSipcha1C6TxD2aOzwDsiEJeVwFUsRFn2HfUVeW bWPvAR1hl+odRvpi8iFUeoFIAQUXSmjhBhgsiFIeeK6Get/kVxsGKCsPttYgb2UaZQM9 z2ZGwz6ZkgE2iU6CznasbDAXKj4coQIQTiuPHxzb8mcrl+Tptz6hatCj7NmgTZhQkfLE WqZzEobl2AD0lgSg2yU5MKLbGZWj6/U28/zLFhHborzfzjdxT5en1cx9svSObGaVHuJ5 /qlCodkB6KImNYOoqs4b2Rw8ApcYPBtlR8jnUCwtAVctrIP2U0dVwTq/bYa3UMm0ly2e shqg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAubE4P8IZ5hfxX/V+P5+4MHfdKw1W2QMEgmgNS9coALDKEDdi4gU 2w3+a3jM0btsXtZul6HlU9C7LI6YHJ1RN3PWGnKDUMF7kU2m6ZI67zP9n++HrxQYapuYX8BFXNG MsxkKotSefEWPMnTiNuAlVWTX11OCOloQHsoGooRVrDu7IVJIdpRbk/EboLPNe8a4TQ== X-Received: by 2002:a50:ed81:: with SMTP id h1mr3185051edr.145.1551287252026; Wed, 27 Feb 2019 09:07:32 -0800 (PST) X-Google-Smtp-Source: AHgI3IaxNWgfuXgJOJB8Jxn+WnUmUJYSI1Q2Rc7iTy1TvH1t/kSpWghTRQrYyuTQIG87xkjJHzs/ X-Received: by 2002:a50:ed81:: with SMTP id h1mr3184977edr.145.1551287250901; Wed, 27 Feb 2019 09:07:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287250; cv=none; d=google.com; s=arc-20160816; b=R343KazA07d3NZ9nUJu2Xn0QhZrTwMuw46SqLKhVWoe7legkrTtSHcpqTYbaB6t5QR sgNLPSAIK64dC4b9arbvBNqhl5f6hEzuC1ZxSBXLb1CD8ilmw00SgyUyLIbPErYKp/Uo Me5AYNmFaIGDVNZnhl+w5syr9Acnw0kYw2bg1XDz/mLTcP+n7kC3dZNgEpNOXYT4sOH2 emWXtDx7BVZHsED+n+AmPoWRZGtrpQwJgar3fqycMX66hSmlja5cLiFnprxy5IU8eu7V vjSUXQYtj67kSuKlnIa4gxKeb4ZaYPKtIBsDQUMX+11YsLe1ZPrunZAJwAAviiQ0U7Q1 p5nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=L7+4dfDNLeQ8Cyqd1Z54ELoUfhtBI7Oe/4rtJxjOb50=; b=D2nVdAc+XoM2UqXEEkk6Yap+pnuy7D8a2df9xPRFgiucMXjvmEBeoiQLnNHsz+CjBH NAjwxJM8httj+tsVQnRR4JXnA826sZrUMSF1gB+dx0W5JI251fA+psNG4Afq4gXNr+Vl FWTwxLAv35el8OdFGFhjhTAW4yv2E5sQz0TOXnOWrEBDEE/yoV6KftJUwJpEarLFNgfn IkILmSZukUzUuNk+rmG/C6fAU28XsughbcSpgWxRzn1Y+6sipFz4uMtpcTA/oe3Ps0i4 ot/eB2Eqpr2OT8sEYqZtq9T5sBiIkibJbQBADaWF22jIuUrqO+0pn5GvgeJ8bSFd/LRz RMpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id g11si6392472edf.313.2019.02.27.09.07.30 for ; Wed, 27 Feb 2019 09:07:30 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C98EB16A3; Wed, 27 Feb 2019 09:07:29 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D008C3F738; Wed, 27 Feb 2019 09:07:25 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org Subject: [PATCH v3 16/34] powerpc: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:50 +0000 Message-Id: <20190227170608.27963-17-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For powerpc pmd_large() was already implemented, so hoist it out of the CONFIG_TRANSPARENT_HUGEPAGE condition and implement the other levels. Also since we now have a pmd_large always implemented we can drop the pmd_is_leaf() function. For 32 bit simply implement stubs returning 0. CC: Benjamin Herrenschmidt CC: Paul Mackerras CC: Michael Ellerman CC: linuxppc-dev@lists.ozlabs.org CC: kvm-ppc@vger.kernel.org Signed-off-by: Steven Price --- arch/powerpc/include/asm/book3s/32/pgtable.h | 1 + arch/powerpc/include/asm/book3s/64/pgtable.h | 27 ++++++++++++------- arch/powerpc/include/asm/nohash/32/pgtable.h | 1 + .../include/asm/nohash/64/pgtable-4k.h | 1 + arch/powerpc/kvm/book3s_64_mmu_radix.c | 12 +++------ 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h b/arch/powerpc/include/asm/book3s/32/pgtable.h index 49d76adb9bc5..036052a792c8 100644 --- a/arch/powerpc/include/asm/book3s/32/pgtable.h +++ b/arch/powerpc/include/asm/book3s/32/pgtable.h @@ -202,6 +202,7 @@ extern unsigned long ioremap_bot; #define pmd_none(pmd) (!pmd_val(pmd)) #define pmd_bad(pmd) (pmd_val(pmd) & _PMD_BAD) #define pmd_present(pmd) (pmd_val(pmd) & _PMD_PRESENT_MASK) +#define pmd_large(pmd) (0) static inline void pmd_clear(pmd_t *pmdp) { *pmdp = __pmd(0); diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index c9bfe526ca9d..1705b1a201bd 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h @@ -907,6 +907,11 @@ static inline int pud_present(pud_t pud) return (pud_raw(pud) & cpu_to_be64(_PAGE_PRESENT)); } +static inline int pud_large(pud_t pud) +{ + return (pud_raw(pud) & cpu_to_be64(_PAGE_PTE)); +} + extern struct page *pud_page(pud_t pud); extern struct page *pmd_page(pmd_t pmd); static inline pte_t pud_pte(pud_t pud) @@ -954,6 +959,11 @@ static inline int pgd_present(pgd_t pgd) return (pgd_raw(pgd) & cpu_to_be64(_PAGE_PRESENT)); } +static inline int pgd_large(pgd_t pgd) +{ + return (pgd_raw(pgd) & cpu_to_be64(_PAGE_PTE)); +} + static inline pte_t pgd_pte(pgd_t pgd) { return __pte_raw(pgd_raw(pgd)); @@ -1107,6 +1117,14 @@ static inline bool pmd_access_permitted(pmd_t pmd, bool write) return pte_access_permitted(pmd_pte(pmd), write); } +/* + * returns true for pmd migration entries, THP, devmap, hugetlb + */ +static inline int pmd_large(pmd_t pmd) +{ + return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_PTE)); +} + #ifdef CONFIG_TRANSPARENT_HUGEPAGE extern pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot); extern pmd_t mk_pmd(struct page *page, pgprot_t pgprot); @@ -1133,15 +1151,6 @@ pmd_hugepage_update(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp, return hash__pmd_hugepage_update(mm, addr, pmdp, clr, set); } -/* - * returns true for pmd migration entries, THP, devmap, hugetlb - * But compile time dependent on THP config - */ -static inline int pmd_large(pmd_t pmd) -{ - return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_PTE)); -} - static inline pmd_t pmd_mknotpresent(pmd_t pmd) { return __pmd(pmd_val(pmd) & ~_PAGE_PRESENT); diff --git a/arch/powerpc/include/asm/nohash/32/pgtable.h b/arch/powerpc/include/asm/nohash/32/pgtable.h index bed433358260..ebd55449914b 100644 --- a/arch/powerpc/include/asm/nohash/32/pgtable.h +++ b/arch/powerpc/include/asm/nohash/32/pgtable.h @@ -190,6 +190,7 @@ static inline pte_t pte_mkexec(pte_t pte) #define pmd_none(pmd) (!pmd_val(pmd)) #define pmd_bad(pmd) (pmd_val(pmd) & _PMD_BAD) #define pmd_present(pmd) (pmd_val(pmd) & _PMD_PRESENT_MASK) +#define pmd_large(pmd) (0) static inline void pmd_clear(pmd_t *pmdp) { *pmdp = __pmd(0); diff --git a/arch/powerpc/include/asm/nohash/64/pgtable-4k.h b/arch/powerpc/include/asm/nohash/64/pgtable-4k.h index c40ec32b8194..9e6fa5646c9f 100644 --- a/arch/powerpc/include/asm/nohash/64/pgtable-4k.h +++ b/arch/powerpc/include/asm/nohash/64/pgtable-4k.h @@ -56,6 +56,7 @@ #define pgd_none(pgd) (!pgd_val(pgd)) #define pgd_bad(pgd) (pgd_val(pgd) == 0) #define pgd_present(pgd) (pgd_val(pgd) != 0) +#define pgd_large(pgd) (0) #define pgd_page_vaddr(pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS) #ifndef __ASSEMBLY__ diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c b/arch/powerpc/kvm/book3s_64_mmu_radix.c index 1b821c6efdef..040db20ac2ab 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_radix.c +++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c @@ -363,12 +363,6 @@ static void kvmppc_pte_free(pte_t *ptep) kmem_cache_free(kvm_pte_cache, ptep); } -/* Like pmd_huge() and pmd_large(), but works regardless of config options */ -static inline int pmd_is_leaf(pmd_t pmd) -{ - return !!(pmd_val(pmd) & _PAGE_PTE); -} - static pmd_t *kvmppc_pmd_alloc(void) { return kmem_cache_alloc(kvm_pmd_cache, GFP_KERNEL); @@ -455,7 +449,7 @@ static void kvmppc_unmap_free_pmd(struct kvm *kvm, pmd_t *pmd, bool full, for (im = 0; im < PTRS_PER_PMD; ++im, ++p) { if (!pmd_present(*p)) continue; - if (pmd_is_leaf(*p)) { + if (pmd_large(*p)) { if (full) { pmd_clear(p); } else { @@ -588,7 +582,7 @@ int kvmppc_create_pte(struct kvm *kvm, pgd_t *pgtable, pte_t pte, else if (level <= 1) new_pmd = kvmppc_pmd_alloc(); - if (level == 0 && !(pmd && pmd_present(*pmd) && !pmd_is_leaf(*pmd))) + if (level == 0 && !(pmd && pmd_present(*pmd) && !pmd_large(*pmd))) new_ptep = kvmppc_pte_alloc(); /* Check if we might have been invalidated; let the guest retry if so */ @@ -657,7 +651,7 @@ int kvmppc_create_pte(struct kvm *kvm, pgd_t *pgtable, pte_t pte, new_pmd = NULL; } pmd = pmd_offset(pud, gpa); - if (pmd_is_leaf(*pmd)) { + if (pmd_large(*pmd)) { unsigned long lgpa = gpa & PMD_MASK; /* Check if we raced and someone else has set the same thing */ From patchwork Wed Feb 27 17:05:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831957 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D196715AC for ; Wed, 27 Feb 2019 17:07:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC0722E305 for ; Wed, 27 Feb 2019 17:07:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AFD3E2E31F; Wed, 27 Feb 2019 17:07:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F9122E305 for ; Wed, 27 Feb 2019 17:07:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F4BF8E0015; Wed, 27 Feb 2019 12:07:36 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9A6A98E0001; Wed, 27 Feb 2019 12:07:36 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 86F2F8E0015; Wed, 27 Feb 2019 12:07:36 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id 283B88E0001 for ; Wed, 27 Feb 2019 12:07:36 -0500 (EST) Received: by mail-ed1-f71.google.com with SMTP id d31so7237997eda.1 for ; Wed, 27 Feb 2019 09:07:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=d7Ez4LEs1GxX+k7wJ+eVDpmUwku09yzSGsf2pAay+/c=; b=ts8fVILfWUjFzXfHHf5wco35zwkPLkpMAbnE2TFijY4EXSNJcp8YsSrSrOjvwqpqGi 5EJyKJEaArrgD87qlk6NPBU+uDdko5JqPCdL3vD5TqJgdEdsZ1SFAQ6JVmiX3N2rm8+B roREa/HhdiekeeJYnthJabgQwkh7SH7Lf/3MsOy497w8tmqEMuG5Q7a7n5DyNaIM2T2H s86lTepYhQY6xdSrcDXe5Y81UIkzQvMIpHrdDk2oV5l6Gnuyl1WX3AiN0YVRO4JdEkbP 9ubHzhz+6Q5e0yPYhTN4IjiPR1wsfJ+fzBxbkPpuFc1gvUnCi7mxkKhW0CYh9xni9ZTZ JDjQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuapiN3Q6EuWjNP231FbUKPMr+9U2vSoaJwf37Fe/ph6jtQLaDkq FI9sKdfsOTMR16DrDL08gzpxwqL28MuT2zDJy4fzIzQMGablUBL9O5saNDQDYLpPDiVODfEBkp6 WemywKjYyTECEeDPZIXPG5T+BKqF+WjxHm17lYFS3vg/fRHq695zY7K/FdwrrhR7q/Q== X-Received: by 2002:a17:906:5612:: with SMTP id f18mr2306254ejq.44.1551287255666; Wed, 27 Feb 2019 09:07:35 -0800 (PST) X-Google-Smtp-Source: AHgI3IZtXKBFcJS/Wjaz8yythsjd7f3NZYFrjARpW9k2CzhF6DGxRyPwyPx0ZbQyDphqDGN+X0qN X-Received: by 2002:a17:906:5612:: with SMTP id f18mr2306192ejq.44.1551287254685; Wed, 27 Feb 2019 09:07:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287254; cv=none; d=google.com; s=arc-20160816; b=Lb6a6ykqFiIBLAipaoHgiU/a0XbTvu0Vfz9b9fEflvTMnbcohqjlvQeVb8UClgz2af 8yYnOy7aG6cbZOXGTHYau5WnfQyd5tIHSnBupXFQsIi3uIa3rFeeXLa6zC6uD7fxM0Bj Jf1s7GjzSbovH7pOdyZcZIHixU0UPQbPBKGRzyultc7c+BhVEM6qScfAZFFbyll7SrjO utqI2ljMxDVglZS3pZl2np7gN6pVK/b4f50dePTUHKkR6pgfSdRbvcCVwJ9s9EQiguMa LAmw6W2f+7I8vcLsDoAxZPokCcpqmK2wN4ZqF3OzH67vcAnlH3ylnYRFS7oT+tGNtQmu ELvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=d7Ez4LEs1GxX+k7wJ+eVDpmUwku09yzSGsf2pAay+/c=; b=Nl1egvahvbm9Wxy1a4ikIE0lNMbNUsBsRhPVMQZUcMymJ3b0bvpd73uzRNnPC4Msd8 CwafjcL/V+Jrm7S9tJ/hfkHaQ19j3qJH7GaXUKQ7JmxWo9/51eSg+qJYiIDxLSdagnt9 uQ9ybLQnc+W8WnBBOGTmzYlxqysgm92nfhLV5Bw00mJ3yELKbJ2oUK9KqPvIOyfTQjZN GjcruB76wv/1y3aR6caCLC933by+M/QRmte4/wD6SK3/EjifSnXQ4GRvo4ye5Ea290VH ex8/dJkPUGmZoQrOZPyUYlbmPjAYDE3QhiCRH1KBoAkaJvMETRHQboq4kZwqR+FhoZQl g6lQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id i14si1737427ejh.321.2019.02.27.09.07.34 for ; Wed, 27 Feb 2019 09:07:34 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B989EA78; Wed, 27 Feb 2019 09:07:33 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 13FF23F738; Wed, 27 Feb 2019 09:07:29 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org Subject: [PATCH v3 17/34] riscv: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:51 +0000 Message-Id: <20190227170608.27963-18-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For riscv a page is large when it has a read, write or execute bit set on it. CC: Palmer Dabbelt CC: Albert Ou CC: linux-riscv@lists.infradead.org Signed-off-by: Steven Price --- arch/riscv/include/asm/pgtable-64.h | 6 ++++++ arch/riscv/include/asm/pgtable.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/arch/riscv/include/asm/pgtable-64.h b/arch/riscv/include/asm/pgtable-64.h index 7aa0ea9bd8bb..6763c44d338d 100644 --- a/arch/riscv/include/asm/pgtable-64.h +++ b/arch/riscv/include/asm/pgtable-64.h @@ -51,6 +51,12 @@ static inline int pud_bad(pud_t pud) return !pud_present(pud); } +static inline int pud_large(pud_t pud) +{ + return pud_present(pud) + && (pud_val(pud) & (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)); +} + static inline void set_pud(pud_t *pudp, pud_t pud) { *pudp = pud; diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 16301966d65b..17624d7e7e8b 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -111,6 +111,12 @@ static inline int pmd_bad(pmd_t pmd) return !pmd_present(pmd); } +static inline int pmd_large(pmd_t pmd) +{ + return pmd_present(pmd) + && (pmd_val(pmd) & (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)); +} + static inline void set_pmd(pmd_t *pmdp, pmd_t pmd) { *pmdp = pmd; From patchwork Wed Feb 27 17:05:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831955 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ACC191390 for ; Wed, 27 Feb 2019 17:07:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 956E22E306 for ; Wed, 27 Feb 2019 17:07:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88FD12E328; Wed, 27 Feb 2019 17:07:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E3F12E306 for ; Wed, 27 Feb 2019 17:07:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 982578E0004; Wed, 27 Feb 2019 12:07:40 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 908538E0001; Wed, 27 Feb 2019 12:07:40 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D3938E0004; Wed, 27 Feb 2019 12:07:40 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 238898E0001 for ; Wed, 27 Feb 2019 12:07:40 -0500 (EST) Received: by mail-ed1-f72.google.com with SMTP id k32so7092902edc.23 for ; Wed, 27 Feb 2019 09:07:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=J3FIuviiMVREZMZELIXYHVD1g1qTn0XuyTtmAQTk6Hc=; b=iUxIoUBL+0Mtg1puNn2720yX6IQ3pRIik6MsRhrN7Xh0gXza1ZFWpzhAnh/ftWvu7s IRrbQ/a6Q3+tRXbXZhDhnqOhH1t92r2mhYnoyv6NPZLSwHbQmrJGxHnid9clSUtY0L2U cVXl+mY5EH3MvHv5DVHMoaPufBOUsNJlSse8grhPaAWT1LAr2wycPGhRf5O0RccoqQyt 7+llO9nYcYDOW1NWEXDkI+ac294v0eAANa9nuIgJuW14o7ZvuyFnRZzMQKSS42YRK11w KD6f5dE9yPU6fpzooBp0Iep3PQ5rK8t98K5M0ugurQMB2LTN/+BavGP1L3QbErcaMmd5 oVzw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuatidrH7jDYYEf7DJ+An+W7RIL1q9ppOfePNXLD2itVhKmeVSc+ fnQJq1tb6vHIQPCnKBfwYUBGDbRrAHZdaau0ep8JS6RtfNMuqHKcmDtL46sL4rwSb/IpGiOjsit /zdC1LiUiV11IPUPqRw6Bu84YXT/EnCHg9Uba/4F2ltl/BKmTMWQtJFmpmXUXET2BfQ== X-Received: by 2002:a17:906:b209:: with SMTP id p9mr2290797ejz.39.1551287259660; Wed, 27 Feb 2019 09:07:39 -0800 (PST) X-Google-Smtp-Source: AHgI3IaIIKev7LhwaCA6eM431xXFcYkmoy3pMqL8q6sXUIXSykO2qsOkNejMku2fGcc6502TIXG2 X-Received: by 2002:a17:906:b209:: with SMTP id p9mr2290733ejz.39.1551287258693; Wed, 27 Feb 2019 09:07:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287258; cv=none; d=google.com; s=arc-20160816; b=S7v01RTAeXmCniY/dmwFJV8FmLdAZ9hkrisSy/yrzJHZwe4EIQCTSnHJSPGX3tgBbD QkKwHvHlliNzg8wiB9vnK8gpt1UP2wTj4YhlFj+XdSu+boIw9ZFqNwZ9GtmtAN0kWw/r y6yqRtgdAo3zLhdHXFxJ5ZvfJOeK1HBpttoGv9KmwYXc33Z6UQf2Pu0vg4nKPdkVo6YN 4NxFNRkquD/mReecSUdQ3gSQKGRIgHSSgnRDPYMLtSAmxtpnzWYLZE3RQJuc5al1oQxf g7LBRBcLhnSq1YQ1cQycMmKLEbA64fO8OM3do2IyfNj2TgHADzrnDVQUOUUxVjAvG5XZ BwTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=J3FIuviiMVREZMZELIXYHVD1g1qTn0XuyTtmAQTk6Hc=; b=KVWv0U4+CD+7imAnbSuJ684lS+5Gnrk6PO/t55k+cDm5Wok5Tu8H9pzkPTH1lt5KZf iDcb76Igf1NMOObm8zmmK5mQybx1t1BblqPmcfWshoPme9gVxVmrsWtJFNen90uwTQAc Cv6YLxqQ7A2IEyHNF9+veAmEWk7mfBNGCfx+g/WT/Vk7dOmni5bSVVFuCo6pzAFmYfAh LcldbFbA/KIJiuwSMWXgTBm5EhlJWJQcgJk5NlI8gDDI82MdVbB6GZ+8v3oG898VVRfZ j4uU832+OFoLo8EjWcLI0RlPV0/6eeBAFB9TfhXDtgnrFVplZyng7rD/USY0U2KqqDml U2ig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id a17si4440098ejy.247.2019.02.27.09.07.38 for ; Wed, 27 Feb 2019 09:07:38 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AE15D1684; Wed, 27 Feb 2019 09:07:37 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 056103F738; Wed, 27 Feb 2019 09:07:33 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Martin Schwidefsky , Heiko Carstens , linux-s390@vger.kernel.org Subject: [PATCH v3 18/34] s390: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:52 +0000 Message-Id: <20190227170608.27963-19-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For s390, we don't support large pages, so add a stub returning 0. CC: Martin Schwidefsky CC: Heiko Carstens CC: linux-s390@vger.kernel.org Signed-off-by: Steven Price --- arch/s390/include/asm/pgtable.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index 063732414dfb..9617f1fb69b4 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h @@ -605,6 +605,11 @@ static inline int pgd_present(pgd_t pgd) return (pgd_val(pgd) & _REGION_ENTRY_ORIGIN) != 0UL; } +static inline int pgd_large(pgd_t pgd) +{ + return 0; +} + static inline int pgd_none(pgd_t pgd) { if (pgd_folded(pgd)) @@ -645,6 +650,11 @@ static inline int p4d_present(p4d_t p4d) return (p4d_val(p4d) & _REGION_ENTRY_ORIGIN) != 0UL; } +static inline int p4d_large(p4d_t p4d) +{ + return 0; +} + static inline int p4d_none(p4d_t p4d) { if (p4d_folded(p4d)) From patchwork Wed Feb 27 17:05:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831961 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B1D3715AC for ; Wed, 27 Feb 2019 17:07:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E3B72E305 for ; Wed, 27 Feb 2019 17:07:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 927D62E31F; Wed, 27 Feb 2019 17:07:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24AA42E305 for ; Wed, 27 Feb 2019 17:07:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9A7C48E0016; Wed, 27 Feb 2019 12:07:44 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 956688E0001; Wed, 27 Feb 2019 12:07:44 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 846728E0016; Wed, 27 Feb 2019 12:07:44 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 28E1B8E0001 for ; Wed, 27 Feb 2019 12:07:44 -0500 (EST) Received: by mail-ed1-f72.google.com with SMTP id x13so5022884edq.11 for ; Wed, 27 Feb 2019 09:07:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=N4WRLTZt28lkUemP8bmvX63q6AU2uYVq26PdhSIkK84=; b=ZvB+UHT+qmolZim0X7naZ3UT5Rjf9hav/wylHxpe5IpqLPt+TaYXp2Op9joZsNjpNY UY5WZJIoX4uZ09XADU7ifQ8EHncGDyaHx2zLtNibQJA+fkpED/abdhugOPz84xupQfua sijEb5eaQgg0Z1E2BkfjAohZHiR9tzWiWRAKfRXWIbBHYomUfsZOcLRaPrdBLRlsAI6w gBfJH7PvkC/qK1Eg0IrYxOynlqXjPmvTRW+s8mJF1WLix/eyQLLjZqTKTxNk+6YQ7f88 Rmfl3dNO/FMC/CChhD68bs/DBCrm9riNRaU1mDWENrNx9ZCjH+/eHAD9XJsVLAF/wYWK R3Ew== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuZwTR/ovEpc7dfQkYCtlbSiswdq9uzPYoDpWrCeARcJ85L1/bBC g7B0UbP920jtwCSbriGC8JficCeXPfYX68m1H3kACAhVrDur5g0npanzGTJQaDM7cRE9EoOm0Xt RKmz0pJnlbzLCKw3URqGtQXecSYQ+riKcxJYBHa9tOPnF2l8sYNlVATYoIrYpaYgCdg== X-Received: by 2002:a50:b8a5:: with SMTP id l34mr3143769ede.196.1551287263689; Wed, 27 Feb 2019 09:07:43 -0800 (PST) X-Google-Smtp-Source: AHgI3IZRsbWjTWYkaEqxkNAe8YrUhaX6aYtPyvp/g3cKbpln7YN0L+PNyjsZZ0LMoE/flpUl63Rd X-Received: by 2002:a50:b8a5:: with SMTP id l34mr3143709ede.196.1551287262713; Wed, 27 Feb 2019 09:07:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287262; cv=none; d=google.com; s=arc-20160816; b=e4TRZExSSplfMeR/kpjwdFM8BuYFhwJZtK63RRaUwxhE/SYx8kSjDsCGG8Prxijchb J2FlYFCmFR+SLSGe3Se9wodqGIcLHhawTC/WgAdoNkSrHeEvOEzy8r8h/JBWm4dQ0U3L 977xPvFdFdDYhR6lK2cF3GipdfHCn0LVANRkEHptuLpGkCVV6U7DoMT1LubMLcZU0iI5 8LaKj/4+vTPUUVNSSNphNbsTyCpY/todq4m2VfSJHSXG491aczgySYpeS2o8qSZNUe/L BQVLUmxxoy139kdRw/M2OnY5VK+gBQI1owPcNom+RZ9GS5UeWcW01kbV/wnOYax6tlVn rHYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=N4WRLTZt28lkUemP8bmvX63q6AU2uYVq26PdhSIkK84=; b=oAK300+9iwTrQd/uqOFax2eEbPQBGr0Zt960RT2RoKaTMoWEpAh7gsazxScImnNykb DLg5vWQtC6UIN9/OE31EBeMu5Z6lGI1zj+pk6TXZVd3FD/7JEW9J4VWDlsj0QE2hEj2b AS946xox+1bCbJN8Xq6O3JdncV4GykZt0xELqJjwv7R5B6nbYdQf5wtvW5GgjcEf+V9D k4to5QnPb7+A20ktU+KaaOOSdhuJiq3xq0WwZ/Qwtthd0O+kWbzZlAzp7oRf80rXj/Cy 3ucW+h7a8QGzd7EypNe7Y9ZIpbpaiFOcNnWOScA1Mr1sjVLBrzGhKFeE/WqCJAOT2Zyh Wtuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id e11si2277200ede.46.2019.02.27.09.07.42 for ; Wed, 27 Feb 2019 09:07:42 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9E822174E; Wed, 27 Feb 2019 09:07:41 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ED5CD3F738; Wed, 27 Feb 2019 09:07:37 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Yoshinori Sato , Rich Felker , linux-sh@vger.kernel.org Subject: [PATCH v3 19/34] sh: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:53 +0000 Message-Id: <20190227170608.27963-20-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For sh, we don't support large pages, so add stubs returning 0. CC: Yoshinori Sato CC: Rich Felker CC: linux-sh@vger.kernel.org Signed-off-by: Steven Price --- arch/sh/include/asm/pgtable-3level.h | 1 + arch/sh/include/asm/pgtable_32.h | 1 + arch/sh/include/asm/pgtable_64.h | 1 + 3 files changed, 3 insertions(+) diff --git a/arch/sh/include/asm/pgtable-3level.h b/arch/sh/include/asm/pgtable-3level.h index 7d8587eb65ff..9d8b2b002582 100644 --- a/arch/sh/include/asm/pgtable-3level.h +++ b/arch/sh/include/asm/pgtable-3level.h @@ -48,6 +48,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address) #define pud_present(x) (pud_val(x)) #define pud_clear(xp) do { set_pud(xp, __pud(0)); } while (0) #define pud_bad(x) (pud_val(x) & ~PAGE_MASK) +#define pud_large(x) (0) /* * (puds are folded into pgds so this doesn't get actually called, diff --git a/arch/sh/include/asm/pgtable_32.h b/arch/sh/include/asm/pgtable_32.h index 29274f0e428e..61186aa11021 100644 --- a/arch/sh/include/asm/pgtable_32.h +++ b/arch/sh/include/asm/pgtable_32.h @@ -329,6 +329,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte) #define pmd_present(x) (pmd_val(x)) #define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) #define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK) +#define pmd_large(x) (0) #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) #define pte_page(x) pfn_to_page(pte_pfn(x)) diff --git a/arch/sh/include/asm/pgtable_64.h b/arch/sh/include/asm/pgtable_64.h index 1778bc5971e7..80fe9264babf 100644 --- a/arch/sh/include/asm/pgtable_64.h +++ b/arch/sh/include/asm/pgtable_64.h @@ -64,6 +64,7 @@ static __inline__ void set_pte(pte_t *pteptr, pte_t pteval) #define pmd_clear(pmd_entry_p) (set_pmd((pmd_entry_p), __pmd(_PMD_EMPTY))) #define pmd_none(pmd_entry) (pmd_val((pmd_entry)) == _PMD_EMPTY) #define pmd_bad(pmd_entry) ((pmd_val(pmd_entry) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) +#define pmd_large(pmd_entry) (0) #define pmd_page_vaddr(pmd_entry) \ ((unsigned long) __va(pmd_val(pmd_entry) & PAGE_MASK)) From patchwork Wed Feb 27 17:05:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831965 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E182A1880 for ; Wed, 27 Feb 2019 17:07:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAA9D2E305 for ; Wed, 27 Feb 2019 17:07:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BEC242E31F; Wed, 27 Feb 2019 17:07:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 095692E306 for ; Wed, 27 Feb 2019 17:07:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5FFFD8E0017; Wed, 27 Feb 2019 12:07:48 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5ADB88E0001; Wed, 27 Feb 2019 12:07:48 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4788E8E0017; Wed, 27 Feb 2019 12:07:48 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id DC5338E0001 for ; Wed, 27 Feb 2019 12:07:47 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id h16so7211728edq.16 for ; Wed, 27 Feb 2019 09:07:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=nxjOX6LayepjKtF9PaCGEhuHv91+mgqyka9gC1xojUs=; b=NlLRuUxqFIy82wYJOJZx0P2voAxG6pNj2bRB9c9WPh4Rp7ewXowXNvPp8IlCZ3yIBa 6ZOBSnzj2jrCpcVf4NgZkL4rWxIoWUaKc0hNUic36VyWAgUlUKG+qQpyVkNMn98Sr/CX PrgHH2IEiLAUs66IRMQKiL0ZptPmFgUonx5ArhfOGFUSMOM9LWGf+elvQWvUxNPNQW4i Gn7KX+5gYgRC3A3CTbJdbQfIr6lfmFAEZEWSjCjwDinikmZtC1kOvWVHzJwfNIy/Iecz hws0tr4ccNvFRa/+dI1D89ihQ+n6Ox7K3hpUEZgL0F01f6rkqYM8x96ENuyUqhEEk3/f wGJQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuaQln5mLHxgI/15BGwEF5zuBa6XVrZRDBloV4rP6ftkBx/BM0og EbWoj+8c6NYaFFRpcckoQPtQ1Zfx+Onfq/Nq901sEBZ2lElOm9mmO0sjIpUt5BxAH5JrEOTUO3q keIsAtMVWqBoDE5MjI+bWAj9rEGcTtD3nPW1CUY3OiUrHuRAawNRetY4Gs32nNeh63w== X-Received: by 2002:a17:906:4347:: with SMTP id z7mr2301074ejm.190.1551287267408; Wed, 27 Feb 2019 09:07:47 -0800 (PST) X-Google-Smtp-Source: AHgI3IaX/79sQE66n4F8zyJeAOLHMcFJr1KjiZ2VjJ3WcNRrRE7DvJPEu2tp3/R3FgRQHPjDj79l X-Received: by 2002:a17:906:4347:: with SMTP id z7mr2301010ejm.190.1551287266346; Wed, 27 Feb 2019 09:07:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287266; cv=none; d=google.com; s=arc-20160816; b=RP01+Ikw71/zA1sGYWE7HoRNEIYy3OmxQnjjo08/TxBocqttHxf/Woz9UnG8Zexs21 t75xTx39NcRJ10ByZGUXv080haMJ+pveJF5Zp7iJsKqIvv3mZWRlYnD1kYCkyWonh0Xy FLl/4WSaoBhP06Pgd/loWIJcRFpEvD2QEaSE5iFgr6uj8Mk3XhlM4kFBvy3FtpjSrPbm Ly5Lcpvai4F+4WijqUO9HVTYgBDpZUyCeG68REsuNhOuVJki5mKBu2vqLs4x9mQserxg 1D5y7DmNUcyhkCPLl3u1GJGCZ8a59fnif0bNiLGElixlP6ZgQbOShpqMhW+0WfwVTOb6 pKiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=nxjOX6LayepjKtF9PaCGEhuHv91+mgqyka9gC1xojUs=; b=iPG/l7w2Cr/SPVWMTxbaCUQF8+63wfbHh5+1Nl73552dfV9Ax0SWkBreTGn+9JRpcP 1968BlrplS/cJEdZXcqIbbNXwKCczilxdyvgRPhSrav/VizF6ihVESEqijW0Na++suQA TMOhC1n2xivcTwW3+3RE8hv7B4hZBb3kAJoPFUtsUPxUSqxAvC2VJyj7wysF6RPZOxH3 LGakXpxO9RLPLNgFqkpgk269Pc+NUQKDaR92tl4bVhJp/NyF9cdtqpbGOIjokYe6kfPz jVVF8oiVXQ2BFsSQpytvbq35KGsKQROg/q5xmVJmNO2Z6UcEGBDe5hxF4t3Lo7t08NZ0 uMtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id t38si4774738eda.121.2019.02.27.09.07.46 for ; Wed, 27 Feb 2019 09:07:46 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6C3B4A78; Wed, 27 Feb 2019 09:07:45 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DE2B83F738; Wed, 27 Feb 2019 09:07:41 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , "David S. Miller" , sparclinux@vger.kernel.org Subject: [PATCH v3 20/34] sparc: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:54 +0000 Message-Id: <20190227170608.27963-21-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For sparc, we don't support large pages, so add stubs returning 0. CC: "David S. Miller" CC: sparclinux@vger.kernel.org Signed-off-by: Steven Price Acked-by: David S. Miller --- arch/sparc/include/asm/pgtable_32.h | 10 ++++++++++ arch/sparc/include/asm/pgtable_64.h | 1 + 2 files changed, 11 insertions(+) diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h index 4eebed6c6781..dbc533e4c460 100644 --- a/arch/sparc/include/asm/pgtable_32.h +++ b/arch/sparc/include/asm/pgtable_32.h @@ -177,6 +177,11 @@ static inline int pmd_none(pmd_t pmd) return !pmd_val(pmd); } +static inline int pmd_large(pmd_t pmd) +{ + return 0; +} + static inline void pmd_clear(pmd_t *pmdp) { int i; @@ -199,6 +204,11 @@ static inline int pgd_present(pgd_t pgd) return ((pgd_val(pgd) & SRMMU_ET_MASK) == SRMMU_ET_PTD); } +static inline int pgd_large(pgd_t pgd) +{ + return 0; +} + static inline void pgd_clear(pgd_t *pgdp) { set_pte((pte_t *)pgdp, __pte(0)); diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h index 1393a8ac596b..c32b26bdea53 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h @@ -892,6 +892,7 @@ static inline unsigned long pud_page_vaddr(pud_t pud) #define pgd_page_vaddr(pgd) \ ((unsigned long) __va(pgd_val(pgd))) #define pgd_present(pgd) (pgd_val(pgd) != 0U) +#define pgd_large(pgd) (0) #define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0UL) static inline unsigned long pud_large(pud_t pud) From patchwork Wed Feb 27 17:05:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831963 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4177415AC for ; Wed, 27 Feb 2019 17:07:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B8E12E305 for ; Wed, 27 Feb 2019 17:07:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F9622E328; Wed, 27 Feb 2019 17:07:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 547572E305 for ; Wed, 27 Feb 2019 17:07:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 933718E0018; Wed, 27 Feb 2019 12:07:52 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8E3148E0001; Wed, 27 Feb 2019 12:07:52 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7F6A68E0018; Wed, 27 Feb 2019 12:07:52 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id 2670C8E0001 for ; Wed, 27 Feb 2019 12:07:52 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id h37so5546118eda.7 for ; Wed, 27 Feb 2019 09:07:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=89tEVK8Z5Z1WJ+pAu/rmRwRDTPZdRvQi0xHgmC99Gas=; b=GuKknRizsBpGZQAxvcP1b753pxwAvfCaDewqxty/zPoWl4te3U7xhdirjDWl92X7Bz 3OOlh62GkL7wC7ocx+EIE14FR3rWvkPgFw+QnT8+oQzI78h00qDhCASllSOcMKJl/r/h eP8qaOzsMkPTRfj5kxD2F6lu9nIb+UDCQrT1VKXJFXUkbP70WnaLlDyKBdj+uhaP8ybI zkMgREvI78i6ksqWlxCqWiPSLQvrzyHsiGJoxDUtpRb3F2HWgwKi9YLiPU5fm+y5tXoU /oPxpAphnrVwFn3UOidyL1TBtbymbOW8fgwnfmR3HUbLSWDPH2S6MKWDCjucmZcyA+LB z8Yw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuasedUbZeRYYVIxkL4I7xtF1SmBe6hlfXuIbTRuQfkdImdvsPkn Ecs5pKQE/JvDREmRyg/xaS0zjk4nRvOklbgRI21Bwu4RSadMDOe0XN7A8Bxt7fq/Xaz2Eb7ziwF UVdmhyvz9dzG/f4Nc22wxhL9kM06bth9S1C9VsfTaC94cSyGDM6Bh3HBM6dqrIU750Q== X-Received: by 2002:a50:aa83:: with SMTP id q3mr3138027edc.63.1551287271669; Wed, 27 Feb 2019 09:07:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ73FE0tp8rtpDqznYpSgCJx+g2mWgjvIwEya3HWej8FrqgCf70WoO6LAJ4IUI5fidmejbK X-Received: by 2002:a50:aa83:: with SMTP id q3mr3137955edc.63.1551287270388; Wed, 27 Feb 2019 09:07:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287270; cv=none; d=google.com; s=arc-20160816; b=g7M0ZOz+PrX9IQRIlv9KZ05/KlaGIem4rSR9HXojWdS7QuQnTyMo9Da7Dq1mTTbq7L U/tB5yPhvHlGi/09L8iiEyS3X1Y5hOz2pHdjEPW2e+COUSJdbqZHA5zP+dyUV03h9m3M pRC8Zf5GTym/6lSCadd+YQBs/6XynAXHB2J86nFAvb8hDs4VaAiYKr+aUySXtYh55SAh hQck204blxPw1ig3oGUmZNZV/HQhbRhs2COYvCmXABLmqCSxYzn9DmdYDWXGpDWMPkyv TUAeh28fXj74jfT9Cdg8Xyg+EHZ54KpBM80pEl0K4K5v4dVjoQCoTjrcOhqfyNlue+re Mc2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=89tEVK8Z5Z1WJ+pAu/rmRwRDTPZdRvQi0xHgmC99Gas=; b=J0eQr3XfmMXSMG4MKq4DyzpMZOJEatgIBWSOFw3fGJgOaDRneJezCi3RvQaj4sgBxy IX1Z+F0r8461Z3Zcb+tbb2nGNJIpI65lnbllPkeCPtJmigq6betsgRQ3V152iQhSQhTo y9YYRLBrdmbZD6bdXLVhZnxSGhPemkEWDkT9Hu7Oy0cxCNYOSZfro8OWdUSp0D4M+Dx8 4nDG1cts59zwJxgGCPc84hAqtkvipn9+ws4031KJHXi/8wvqk5kqdR3EvxQbNa/VuQKZ kpni8D9PcdUDCZYt7IJy00z1vVQLU7QRm+cA4PLn/hZGYm1gGdh1kLC0vkojrcnGmcYj kI2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id v6si6499448edm.178.2019.02.27.09.07.50 for ; Wed, 27 Feb 2019 09:07:50 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 810B91684; Wed, 27 Feb 2019 09:07:49 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ABB0C3F738; Wed, 27 Feb 2019 09:07:45 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Jeff Dike , Richard Weinberger , Anton Ivanov , linux-um@lists.infradead.org Subject: [PATCH v3 21/34] um: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:55 +0000 Message-Id: <20190227170608.27963-22-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For um, we don't support large pages, so add stubs returning 0. CC: Jeff Dike CC: Richard Weinberger CC: Anton Ivanov CC: linux-um@lists.infradead.org Signed-off-by: Steven Price --- arch/um/include/asm/pgtable-3level.h | 1 + arch/um/include/asm/pgtable.h | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/um/include/asm/pgtable-3level.h b/arch/um/include/asm/pgtable-3level.h index c4d876dfb9ac..2abf9aa5808e 100644 --- a/arch/um/include/asm/pgtable-3level.h +++ b/arch/um/include/asm/pgtable-3level.h @@ -57,6 +57,7 @@ #define pud_none(x) (!(pud_val(x) & ~_PAGE_NEWPAGE)) #define pud_bad(x) ((pud_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) #define pud_present(x) (pud_val(x) & _PAGE_PRESENT) +#define pud_large(x) (0) #define pud_populate(mm, pud, pmd) \ set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd))) diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h index 9c04562310b3..d5fa4e118dcc 100644 --- a/arch/um/include/asm/pgtable.h +++ b/arch/um/include/asm/pgtable.h @@ -100,6 +100,7 @@ extern unsigned long end_iomem; #define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) #define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) +#define pmd_large(x) (0) #define pmd_clear(xp) do { pmd_val(*(xp)) = _PAGE_NEWPAGE; } while (0) #define pmd_newpage(x) (pmd_val(x) & _PAGE_NEWPAGE) From patchwork Wed Feb 27 17:05:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831967 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4C1511390 for ; Wed, 27 Feb 2019 17:07:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34C052E305 for ; Wed, 27 Feb 2019 17:07:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 290932E31F; Wed, 27 Feb 2019 17:07:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 592632E305 for ; Wed, 27 Feb 2019 17:07:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1915E8E0019; Wed, 27 Feb 2019 12:07:56 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 102B38E0001; Wed, 27 Feb 2019 12:07:56 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EB1748E0019; Wed, 27 Feb 2019 12:07:55 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id 877568E0001 for ; Wed, 27 Feb 2019 12:07:55 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id f2so7102977edm.18 for ; Wed, 27 Feb 2019 09:07:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=RVhGpLl0wO3KpwIPlXPvU+KYzfgn13jA2Mau1bulkRQ=; b=qb5oI9Mg1ZvYOvZDLb4KADWWDdKYgXPc7tjvoIV7mOSCHfnUToG9JVYDSHEXzY20E/ B6OcMOLsDhkbMCLkHcR628XcK2yeIFsiyuUdag2ned5kdkJyCsKJcvgwswxPZA7LHWJb FGXbt2d76Hp4HzBzuziaEq9iJ2U9M+n7ADsqzPnn/c3uodp2Zc1b2V06mJ39rdn6wdv1 9Sxweq5LALFnAvPK+sFYLVEVGc4TSdYhriVy1145AZpplIFRwWVuhvl312uddQ7FIQlC HIHR1A9xiJqbqQxN9NoEerHa/dIM4dwKlSsmac+i6Qj/0Dz9D8YtWOPoB7AH0eusVYAA SzNg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuacVSndQ3jfrPhR+MTTQ/WB+LQEWmaCDWCElB6yZxkJHFWoOK9C cs2XDRDifEFzJNbAX/USw2gtNDzpFQIoyJYu686vYt4uXq+k6xY857p2WP6CvLPySvXKw5VOWdo YqQEGmNozY/iinqvAUJ4ADRVLEQpaKssY/WRF6kLPaE47SUvhLW21qnNCC5U2C1y8LA== X-Received: by 2002:a17:906:3d69:: with SMTP id r9mr2306856ejf.92.1551287275024; Wed, 27 Feb 2019 09:07:55 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibu14cwnkgY1DgW434sqcEYHwD1PVjpP6zXH4tmr65aTCrLEsZRRXN5vvaaqzDw/Id9whPW X-Received: by 2002:a17:906:3d69:: with SMTP id r9mr2306795ejf.92.1551287274029; Wed, 27 Feb 2019 09:07:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287274; cv=none; d=google.com; s=arc-20160816; b=FtJFwqV/qVbOZbpSeYCSckXCvP4kIcKvF/bEQHrH63acDU6Dsg8/N2R9NVr5XYL8O/ wsW6vNovzsuU3YCE1OWM85aY5U3TqgZd03PYUksrTI61vMHBz3ud3PIgef+ddQuY4P8n P6f4PBL6cy+1sfkZbha+TS/sWHpCDg6flpRmSO9crAJ1G3GxyI2y0vt50KrwBmNmYVVh n0dW6nXYsSWUPPrsMVBN6gJOv+0gCtCWy/dhXJr6P3Jq9WcoIi4ZimSlFHAGgrv1Wuva dWB8Q7CbblQekRIRBttGfHjEJstoMFs2Hn+p10ho14prcdWKy6cr8EivmqFxxrY+FBK3 ViAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=RVhGpLl0wO3KpwIPlXPvU+KYzfgn13jA2Mau1bulkRQ=; b=Hl3N/wRLTQFNdYRIRzKDrD5RIfh4Ix72mJ1bLECPH4vMD9a43dl5bPukQr77oFjFoE fLEXxQsjnHE3GVTT+iIx7ROJXO0Lazqzq4ZebrsbMdueMGKqcC3351M/vnvoG3meE0NY e2pbqmuqAn+gnOyk3i2Q4fD/tOBJ16RnofwBy5KdorjQjzIGTwwgcnJ6O7rfvVbOnFKz ZC4OtixVsyVRi39NTTmfe1TKIz/gvH0CTQUUO1MrP/ynBP0BqfiWytMAdktyBkVcuA+G jG8X9CDFiWgA4+HXci9B1TOMmffMUvGIyVJbq27SUOnXkZw52X2j2Mp5UQUW3Q/Lprtn 2PWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id s35si1396825edm.405.2019.02.27.09.07.53 for ; Wed, 27 Feb 2019 09:07:54 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2B1321715; Wed, 27 Feb 2019 09:07:53 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C0CE73F738; Wed, 27 Feb 2019 09:07:49 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Guan Xuetao Subject: [PATCH v3 22/34] unicore32: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:56 +0000 Message-Id: <20190227170608.27963-23-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For unicore32, we don't support large pages, so add a stub returning 0. CC: Guan Xuetao Signed-off-by: Steven Price --- arch/unicore32/include/asm/pgtable.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/unicore32/include/asm/pgtable.h b/arch/unicore32/include/asm/pgtable.h index a4f2bef37e70..b45429df8b99 100644 --- a/arch/unicore32/include/asm/pgtable.h +++ b/arch/unicore32/include/asm/pgtable.h @@ -209,6 +209,7 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; } #define pmd_bad(pmd) (((pmd_val(pmd) & \ (PMD_PRESENT | PMD_TYPE_MASK)) \ != (PMD_PRESENT | PMD_TYPE_TABLE))) +#define pmd_large(pmd) (0) #define set_pmd(pmdpd, pmdval) \ do { \ From patchwork Wed Feb 27 17:05:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831969 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EFE621390 for ; Wed, 27 Feb 2019 17:08:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D78892E306 for ; Wed, 27 Feb 2019 17:08:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C68C12E305; Wed, 27 Feb 2019 17:08:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F80B2E305 for ; Wed, 27 Feb 2019 17:08:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 00B9A8E001A; Wed, 27 Feb 2019 12:08:00 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id ED9C68E0001; Wed, 27 Feb 2019 12:07:59 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D9DB98E001A; Wed, 27 Feb 2019 12:07:59 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id 7B1AE8E0001 for ; Wed, 27 Feb 2019 12:07:59 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id h16so7211992edq.16 for ; Wed, 27 Feb 2019 09:07:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=x+mImCKjHMivjMCtyHQ8sHzcBk8CcZE99nWra+GnYCo=; b=pF+dLW1MtiSNgSjQJ+Go8iIWZATFMEuVtJWlR5FxGXXx61a2QLQzUKC2FR0VuO/P3y ooRODo0ahH+q417lA4Yk16Tpx54PPdpWeLIWeUxdVz+HMG3oV/E6XP0w9Zz4DHt8mIn1 mG4Uxo+Dcx11SEtyZnqp65z9HgKkYjgG5k3yYDgzRcC6+4G3u3G31Fr3VUkh6w5RNCx3 jxgDzlkMPQh9yDXTKp6HkPCt7lH7knYnv3iLiWCryPYivA7f30tz3orNNbaPahLFAVJH q5FWDX5XprzSFTZTPTPp6sFonHzO/MkUFFeuX+Vyu8tyNeYrEVZu6Ba3Co9Z6hLNHgLJ Z+YQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuYMEZcGYh2F8ZlhGueZBVYtxgA0SONbvjkG0NEYXwzvHVRfn8hD tswZ8741JPcwDtmizMPLSSEZCOUKHUOf19FA1jl7OwkSkZxtQXLdQ30XM0L18yZ6aDgbPjSxOz/ 34G0avSinhXx7yJDEs7aoX6O1l8id8o/xKS+eyZ4c/mmJzLu4yPiiT40vD5Epk4NnLw== X-Received: by 2002:a05:6402:6d7:: with SMTP id n23mr3170371edy.233.1551287278985; Wed, 27 Feb 2019 09:07:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IavP+mxnwfhAYmqjsRPF9yTabQRcIEaKt+oyjH6j1n21cgu5STjkg0gle6Is9WAKpFI+HYJ X-Received: by 2002:a05:6402:6d7:: with SMTP id n23mr3170315edy.233.1551287278040; Wed, 27 Feb 2019 09:07:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287278; cv=none; d=google.com; s=arc-20160816; b=QC/7TGBdv+ma0rdw2SJbQgydYxmzemwr6Hmcg6tqcOTIB/DxzSJ7TTYCY5M/lo5wL8 YpopFB/C9E1ioVaAU6qAGSjMmh3cjUH/APikIpFoeSz5YY4HSDivJpgFvfQ4ZJ8Xg/6l J+CP4GYmH5yzb8FP6IjqeA6b9dKCtnkuNYzlU4p+jqCL3SeQuuDHyhCM7KVw+XJSUkW5 XrKhSigJgMGfDCczvV3ncvISeY5XEC9nUo6msFJVu22oYjZfmyOk+thQG3aZjWHjq9QK BTmC7dn4yT8rjyCCrjPsQg4KtrIx+m79tP7h5ptVx6pYSB98NX0krVrViKk0Sqskdzpz 1WFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=x+mImCKjHMivjMCtyHQ8sHzcBk8CcZE99nWra+GnYCo=; b=as3IMsCvtwK55viWIHU3WHT/y+Fr6angBjdjeczZAN1OsQwpwjsOJYQkR34C4vf8Rn TyaNZHiZ2NPbfUi2O4qSzj8YBKzByWbKSJ/aUR4OxdRtEfI7FPotfVRrX+uPYOOylScu HuPN48XIHbk3OYRWjNPjBAQYibB16/DaVEj6SbPlJZXF8TqxG5/7Li7WjdV5ijbp53Ck M8YvV4tlieDEQjVcyAsinA9RBpuClVfSq33DbjgZSamy3LhMMYp7YKGt4yMNaiv4oakZ M9a4VwKozg6/gXO16Zets6qLFDPX9A/17nWiwTJfkOOsZBfjphfG0KwY6brkr2+PnfUw ap5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id k56si622336edb.378.2019.02.27.09.07.57 for ; Wed, 27 Feb 2019 09:07:58 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1C63A19BF; Wed, 27 Feb 2019 09:07:57 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6AFCE3F738; Wed, 27 Feb 2019 09:07:53 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" , Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org Subject: [PATCH v3 23/34] xtensa: mm: Add p?d_large() definitions Date: Wed, 27 Feb 2019 17:05:57 +0000 Message-Id: <20190227170608.27963-24-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 is provided by the p?d_large() functions/macros. For xtensa, we don't support large pages, so add a stub returning 0. CC: Chris Zankel CC: Max Filippov CC: linux-xtensa@linux-xtensa.org Signed-off-by: Steven Price Acked-by: Max Filippov --- arch/xtensa/include/asm/pgtable.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h index 29cfe421cf41..60c3e86b9782 100644 --- a/arch/xtensa/include/asm/pgtable.h +++ b/arch/xtensa/include/asm/pgtable.h @@ -266,6 +266,7 @@ static inline void pgtable_cache_init(void) { } #define pmd_none(pmd) (!pmd_val(pmd)) #define pmd_present(pmd) (pmd_val(pmd) & PAGE_MASK) #define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK) +#define pmd_large(pmd) (0) #define pmd_clear(pmdp) do { set_pmd(pmdp, __pmd(0)); } while (0) static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITABLE; } From patchwork Wed Feb 27 17:05:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831975 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 049281390 for ; Wed, 27 Feb 2019 17:08:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1DA52E305 for ; Wed, 27 Feb 2019 17:08:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D61D72E31F; Wed, 27 Feb 2019 17:08:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3652E2E305 for ; Wed, 27 Feb 2019 17:08:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 032628E001B; Wed, 27 Feb 2019 12:08:04 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id EFE818E0001; Wed, 27 Feb 2019 12:08:03 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC47C8E001B; Wed, 27 Feb 2019 12:08:03 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id 7A9748E0001 for ; Wed, 27 Feb 2019 12:08:03 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id y26so2500575edb.4 for ; Wed, 27 Feb 2019 09:08:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Q3LahD/eKhxJHoEJe0Td4Cv/PyOGamrBgg4jdWEHeDw=; b=YxRm6TX73kawqjSiOss6vnjhOjz7eAcpJGjrP4Y7+EG/rwsPUzCZrjr1SPY37cFYVA t2oYdJUWmNwttwBBlNLu+i2u0RRsClQ2vR/CWQJts1SVxmfHOc+xvH/Ce7TiCXVMvIOW lTbbhyRGZ54U4VyjQXHavs67UEv0RRWjGdQ4cehHScX/xBf1I0tjjO6S71i88K5v9AWI dkX6As1MtX7vwQghew7AaYRckJd/FHhCltdIwatv97tOe2te9gWtNBAu17YrINr/f/Ka T2acjwdDdMg4KZc2XOwUao9LXEHLtXHnuAAtlyQTAY0cFes/hTd2qEHAFL4bNzFIqVmL AMAg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuY5kJkZVUdYEqJCmq+zYcvV3CZ3HDgpm5dgcsnbgwevGzwXcqpK iDIpik85r2sEk2ekI7ZDUdwVA6PU1g8YVNjsxNaJgvt/DOIbvpoqwvmXs8T0EGr3B8n1hhyxxXB L0ioR4LNHnPGBqMX4eSkpA9HWuHOY6tI6DUU7LOM1GYEF3Sq+KN2VPi5DJ+w0kajeSw== X-Received: by 2002:a50:ac6d:: with SMTP id w42mr3231418edc.122.1551287282976; Wed, 27 Feb 2019 09:08:02 -0800 (PST) X-Google-Smtp-Source: AHgI3IaUwokAr+M5KYUoOYXNl1020b8a630kLaoeKcWwCyBZ+mjRG8yAfWIg2KrOCdxqQak2SpUC X-Received: by 2002:a50:ac6d:: with SMTP id w42mr3231339edc.122.1551287281666; Wed, 27 Feb 2019 09:08:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287281; cv=none; d=google.com; s=arc-20160816; b=alysk4PuKTZtsVAWbhBTluZ3q9u6dHuCHneODjfzJooC7WevGe4TNY2Iy5o+fzPQWo sSR8jmyJhPotXNlqw9IB3azEHZg/uCW1nvddoSSVGmKJEoEP8XrWGph8NDh5XOXyxqI8 cWhHrKby3gMR5CF90IjVtKY3perKiiN7ng39dYH0/60hQTZj0Bm8TnKcWNEJoCY42X3B +5STJcbsTlLp0RCyw2mRhTqOvlD8d7fsc9gsq91cWloaxKlYg5MWoRunNFCx+MeLAAiT 7DqBrDGbWWpJ5DTo0oWT+7w7c+BS2V6mLYe+AdNBJZBkMisZw6ToEBGVnlJuXIodlEq7 czwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=Q3LahD/eKhxJHoEJe0Td4Cv/PyOGamrBgg4jdWEHeDw=; b=0+SR6dGEviAtavKQWYAayBnU7Sd07ijy9Wq6ZFIY78VCPkZrD8amv+pzVnNj/+ACE+ KgBkj6xXGsr2BE73uCmMtLgZ9u649Kz1/DHgNWV9bCCzopTD6MZoZh4ZEOkdIqfNc86r J4ZxLb+Nl89SJ6YGKRYWGiDYxlRxtNZDja/kEQ+fj2B9Rrl/VqEuDRpUFg5jhz+yc4U/ imntC832hmiELSc/cWyeeHhK5o3SjnKrsQGk0EllIAUbil2FefNGlC/j8+NdbLoDCtIv 02d50qrJMBnRwkGH+i2UMcCAqzKidHSAhMyVFitjNxiSRYZG34sRUZ0rZ9Bc9vraiiwq ++ww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id gj14si1364182ejb.183.2019.02.27.09.08.01 for ; Wed, 27 Feb 2019 09:08:01 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 972BEA78; Wed, 27 Feb 2019 09:08:00 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5C0463F738; Wed, 27 Feb 2019 09:07:57 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" Subject: [PATCH v3 24/34] mm: Add generic p?d_large() macros Date: Wed, 27 Feb 2019 17:05:58 +0000 Message-Id: <20190227170608.27963-25-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Exposing the pud/pgd levels of the page tables to walk_page_range() means we may come across the exotic large mappings that come with large areas of contiguous memory (such as the kernel's linear map). Where levels are folded we need to provide the appropriate stub implementation of p?d_large(). For x86 move the existing definitions of p?d_large() so that they are only defined when the corresponding levels are not folded. Signed-off-by: Steven Price --- arch/x86/include/asm/pgtable.h | 21 ++++++++------------- include/asm-generic/4level-fixup.h | 1 + include/asm-generic/5level-fixup.h | 1 + include/asm-generic/pgtable-nop4d-hack.h | 1 + include/asm-generic/pgtable-nop4d.h | 1 + include/asm-generic/pgtable-nopmd.h | 1 + include/asm-generic/pgtable-nopud.h | 1 + 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 2779ace16d23..1b854c64cc7d 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -222,12 +222,6 @@ static inline unsigned long pgd_pfn(pgd_t pgd) return (pgd_val(pgd) & PTE_PFN_MASK) >> PAGE_SHIFT; } -static inline int p4d_large(p4d_t p4d) -{ - /* No 512 GiB pages yet */ - return 0; -} - #define pte_page(pte) pfn_to_page(pte_pfn(pte)) static inline int pmd_large(pmd_t pte) @@ -867,11 +861,6 @@ static inline int pud_bad(pud_t pud) { return (pud_flags(pud) & ~(_KERNPG_TABLE | _PAGE_USER)) != 0; } -#else -static inline int pud_large(pud_t pud) -{ - return 0; -} #endif /* CONFIG_PGTABLE_LEVELS > 2 */ static inline unsigned long pud_index(unsigned long address) @@ -890,6 +879,12 @@ static inline int p4d_present(p4d_t p4d) return p4d_flags(p4d) & _PAGE_PRESENT; } +static inline int p4d_large(p4d_t p4d) +{ + /* No 512 GiB pages yet */ + return 0; +} + static inline unsigned long p4d_page_vaddr(p4d_t p4d) { return (unsigned long)__va(p4d_val(p4d) & p4d_pfn_mask(p4d)); @@ -931,6 +926,8 @@ static inline int pgd_present(pgd_t pgd) return pgd_flags(pgd) & _PAGE_PRESENT; } +static inline int pgd_large(pgd_t pgd) { return 0; } + static inline unsigned long pgd_page_vaddr(pgd_t pgd) { return (unsigned long)__va((unsigned long)pgd_val(pgd) & PTE_PFN_MASK); @@ -1213,8 +1210,6 @@ static inline bool pgdp_maps_userspace(void *__ptr) return (((ptr & ~PAGE_MASK) / sizeof(pgd_t)) < PGD_KERNEL_START); } -static inline int pgd_large(pgd_t pgd) { return 0; } - #ifdef CONFIG_PAGE_TABLE_ISOLATION /* * All top-level PAGE_TABLE_ISOLATION page tables are order-1 pages diff --git a/include/asm-generic/4level-fixup.h b/include/asm-generic/4level-fixup.h index e3667c9a33a5..3cc65a4dd093 100644 --- a/include/asm-generic/4level-fixup.h +++ b/include/asm-generic/4level-fixup.h @@ -20,6 +20,7 @@ #define pud_none(pud) 0 #define pud_bad(pud) 0 #define pud_present(pud) 1 +#define pud_large(pud) 0 #define pud_ERROR(pud) do { } while (0) #define pud_clear(pud) pgd_clear(pud) #define pud_val(pud) pgd_val(pud) diff --git a/include/asm-generic/5level-fixup.h b/include/asm-generic/5level-fixup.h index bb6cb347018c..c4377db09a4f 100644 --- a/include/asm-generic/5level-fixup.h +++ b/include/asm-generic/5level-fixup.h @@ -22,6 +22,7 @@ #define p4d_none(p4d) 0 #define p4d_bad(p4d) 0 #define p4d_present(p4d) 1 +#define p4d_large(p4d) 0 #define p4d_ERROR(p4d) do { } while (0) #define p4d_clear(p4d) pgd_clear(p4d) #define p4d_val(p4d) pgd_val(p4d) diff --git a/include/asm-generic/pgtable-nop4d-hack.h b/include/asm-generic/pgtable-nop4d-hack.h index 829bdb0d6327..d3967560d123 100644 --- a/include/asm-generic/pgtable-nop4d-hack.h +++ b/include/asm-generic/pgtable-nop4d-hack.h @@ -27,6 +27,7 @@ typedef struct { pgd_t pgd; } pud_t; static inline int pgd_none(pgd_t pgd) { return 0; } static inline int pgd_bad(pgd_t pgd) { return 0; } static inline int pgd_present(pgd_t pgd) { return 1; } +static inline int pgd_large(pgd_t pgd) { return 0; } static inline void pgd_clear(pgd_t *pgd) { } #define pud_ERROR(pud) (pgd_ERROR((pud).pgd)) diff --git a/include/asm-generic/pgtable-nop4d.h b/include/asm-generic/pgtable-nop4d.h index aebab905e6cd..5d5dde24a8ca 100644 --- a/include/asm-generic/pgtable-nop4d.h +++ b/include/asm-generic/pgtable-nop4d.h @@ -22,6 +22,7 @@ typedef struct { pgd_t pgd; } p4d_t; static inline int pgd_none(pgd_t pgd) { return 0; } static inline int pgd_bad(pgd_t pgd) { return 0; } static inline int pgd_present(pgd_t pgd) { return 1; } +static inline int pgd_large(pgd_t pgd) { return 0; } static inline void pgd_clear(pgd_t *pgd) { } #define p4d_ERROR(p4d) (pgd_ERROR((p4d).pgd)) diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h index b85b8271a73d..beeb8f375d4d 100644 --- a/include/asm-generic/pgtable-nopmd.h +++ b/include/asm-generic/pgtable-nopmd.h @@ -30,6 +30,7 @@ typedef struct { pud_t pud; } pmd_t; static inline int pud_none(pud_t pud) { return 0; } static inline int pud_bad(pud_t pud) { return 0; } static inline int pud_present(pud_t pud) { return 1; } +static inline int pud_large(pud_t pud) { return 0; } static inline void pud_clear(pud_t *pud) { } #define pmd_ERROR(pmd) (pud_ERROR((pmd).pud)) diff --git a/include/asm-generic/pgtable-nopud.h b/include/asm-generic/pgtable-nopud.h index c77a1d301155..b3ba496965d3 100644 --- a/include/asm-generic/pgtable-nopud.h +++ b/include/asm-generic/pgtable-nopud.h @@ -31,6 +31,7 @@ typedef struct { p4d_t p4d; } pud_t; static inline int p4d_none(p4d_t p4d) { return 0; } static inline int p4d_bad(p4d_t p4d) { return 0; } static inline int p4d_present(p4d_t p4d) { return 1; } +static inline int p4d_large(p4d_t p4d) { return 0; } static inline void p4d_clear(p4d_t *p4d) { } #define pud_ERROR(pud) (p4d_ERROR((pud).p4d)) From patchwork Wed Feb 27 17:05:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831971 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 80CF315AC for ; Wed, 27 Feb 2019 17:08:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68C7A2E306 for ; Wed, 27 Feb 2019 17:08:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C8C42E328; Wed, 27 Feb 2019 17:08:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D08B42E306 for ; Wed, 27 Feb 2019 17:08:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 89C878E001C; Wed, 27 Feb 2019 12:08:07 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7CF958E0001; Wed, 27 Feb 2019 12:08:07 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 69FE88E001C; Wed, 27 Feb 2019 12:08:07 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 028208E0001 for ; Wed, 27 Feb 2019 12:08:07 -0500 (EST) Received: by mail-ed1-f72.google.com with SMTP id j5so7175066edt.17 for ; Wed, 27 Feb 2019 09:08:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=HrdRugGr2uKHHo/TiR13vk3LQ/wnulW6YNAfJqdWS6g=; b=N2UIVE0jk8GjvQYXybyHQN6/8+Lt7FF5iG/j99JcP9ge9DJp4f84Kt4rEkDIae+WRZ OglUqCbl+dV49EwNxCf2L9GSzA/RDZHa4XGRL1O/8hw+Mv8hROksTdPsz+T9gKM1P9N6 jnb3Y5KCoHrYK1VR8dJkyshxFRO0gENg8+cxbe/zCijFFtvx9+lj2wUPe7lTXSVhxVxj iN3RviTEALnhpYsqxRwPgjEhBoVBJcEIhK+2Mb6WDAuhS9MH2ufbl6h6P2bXwZ43JQ3R 7NAcuw8keq2MgTiMoqUxCjNwzuo6FyQZNh3v/rNzNzagkogI093utKm79l6M7ELYMnbj oS6A== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAubeWeQkraaR/jziX2Uie/lkF1CUUd0s4moeo38qAE1lKGmjAcC/ KziCfPL7l50sFmaDcsSzClAMUL72SSfm25WvQ+7ofYIB2G20T/iVCWpMwN89CJPv5eNDWWlXCsv RXOz3N17OkFH4VVVZHZGe10dThoP56cVMBoxSXkaSJFKeOS2HPBtDwkn+3HQoFYrdGQ== X-Received: by 2002:aa7:dac5:: with SMTP id x5mr3174858eds.56.1551287286517; Wed, 27 Feb 2019 09:08:06 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ4n3frB4cd0168sDL1/eY8dbS3km7IC3Pm89TvKSUDRR0o4b6ieuIFsUAPuz7izjSyohwU X-Received: by 2002:aa7:dac5:: with SMTP id x5mr3174774eds.56.1551287285178; Wed, 27 Feb 2019 09:08:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287285; cv=none; d=google.com; s=arc-20160816; b=pBjH+dizrBn8hnSLFvwM28kwKvH5kX5gdDuVjaKebQvUkmZ7EVpxFO1OYxeRS0PwxX bMkh6o+QHG4yptyXLP4RD202ZF3HdK7jnSPgi/wBpRkD8krZ1Pwjp/98v2G+e5w8O2CP 9PC4OzdR3taE8/D4jxU+TOYNa2yU1z8xRfW/gMJ5ZHP0I5Alzapt0moU5NBiHx3AZIjB B+S85HAuLrz2lyNYRS7riPGdJ80FJRaUbOrCBy0ExrECUPQNHRjGq09/FL9O07xr0e1I e5NsyVV0BBpY0wr8MzrdBW5MBhja6SBMUarBbW4si5JuV7jXpuwWd89b5d0HdQ91tNVx L//Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=HrdRugGr2uKHHo/TiR13vk3LQ/wnulW6YNAfJqdWS6g=; b=WJ8Xa42OqZQh3O6NW34EU6W+WQ9Dl4ktqaR2FIT6pZO47KMSS/xV2O/1yiGELFwJEH JyFAKFXuQx4UQMo7PHwjnqOEj3d7wb8QQTJmzuhlRGD1npx8UDCZ2KV1gH1d2SYkh5EW XsowKwU7qMFWYdR1FqaHvcU7RTZgMj4EPAgk/xj0S1CDL2weyDCmA8Q8pYu6gzMVR4v2 NFpSZKTLKVSXTld6/jGDKBbSPsavXAcO+zzo+Nu+WzoAF7EUhkl64/HEJEJbE6qxwLXz bvvHG5fRxgKvFAB/eaxrr5RF5pRDi5EAc0c0nS54+EWVL1rxj7swKd4vmyYQ8FrfDbdX U3Lw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id f20si594198edd.56.2019.02.27.09.08.04 for ; Wed, 27 Feb 2019 09:08:05 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1D8E31715; Wed, 27 Feb 2019 09:08:04 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D6C343F738; Wed, 27 Feb 2019 09:08:00 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" Subject: [PATCH v3 25/34] mm: pagewalk: Add p4d_entry() and pgd_entry() Date: Wed, 27 Feb 2019 17:05:59 +0000 Message-Id: <20190227170608.27963-26-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP pgd_entry() and pud_entry() were removed by commit 0b1fbfe50006c410 ("mm/pagewalk: remove pgd_entry() and pud_entry()") because there were no users. We're about to add users so reintroduce them, along with p4d_entry() as we now have 5 levels of tables. Note that commit a00cc7d9dd93d66a ("mm, x86: add support for PUD-sized transparent hugepages") already re-added pud_entry() but with different semantics to the other callbacks. Since there have never been upstream users of this, revert the semantics back to match the other callbacks. This means pud_entry() is called for all entries, not just transparent huge pages. Signed-off-by: Steven Price --- include/linux/mm.h | 9 ++++++--- mm/pagewalk.c | 27 ++++++++++++++++----------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 80bb6408fe73..1a4b1615d012 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1412,10 +1412,9 @@ void unmap_vmas(struct mmu_gather *tlb, struct vm_area_struct *start_vma, /** * mm_walk - callbacks for walk_page_range + * @pgd_entry: if set, called for each non-empty PGD (top-level) entry + * @p4d_entry: if set, called for each non-empty P4D (1st-level) entry * @pud_entry: if set, called for each non-empty PUD (2nd-level) entry - * this handler should only handle pud_trans_huge() puds. - * the pmd_entry or pte_entry callbacks will be used for - * regular PUDs. * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry * this handler is required to be able to handle * pmd_trans_huge() pmds. They may simply choose to @@ -1435,6 +1434,10 @@ void unmap_vmas(struct mmu_gather *tlb, struct vm_area_struct *start_vma, * (see the comment on walk_page_range() for more details) */ struct mm_walk { + int (*pgd_entry)(pgd_t *pgd, unsigned long addr, + unsigned long next, struct mm_walk *walk); + int (*p4d_entry)(p4d_t *p4d, unsigned long addr, + unsigned long next, struct mm_walk *walk); int (*pud_entry)(pud_t *pud, unsigned long addr, unsigned long next, struct mm_walk *walk); int (*pmd_entry)(pmd_t *pmd, unsigned long addr, diff --git a/mm/pagewalk.c b/mm/pagewalk.c index c3084ff2569d..98373a9f88b8 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -90,15 +90,9 @@ static int walk_pud_range(p4d_t *p4d, unsigned long addr, unsigned long end, } if (walk->pud_entry) { - spinlock_t *ptl = pud_trans_huge_lock(pud, walk->vma); - - if (ptl) { - err = walk->pud_entry(pud, addr, next, walk); - spin_unlock(ptl); - if (err) - break; - continue; - } + err = walk->pud_entry(pud, addr, next, walk); + if (err) + break; } split_huge_pud(walk->vma, pud, addr); @@ -131,7 +125,12 @@ static int walk_p4d_range(pgd_t *pgd, unsigned long addr, unsigned long end, break; continue; } - if (walk->pmd_entry || walk->pte_entry) + if (walk->p4d_entry) { + err = walk->p4d_entry(p4d, addr, next, walk); + if (err) + break; + } + if (walk->pud_entry || walk->pmd_entry || walk->pte_entry) err = walk_pud_range(p4d, addr, next, walk); if (err) break; @@ -157,7 +156,13 @@ static int walk_pgd_range(unsigned long addr, unsigned long end, break; continue; } - if (walk->pmd_entry || walk->pte_entry) + if (walk->pgd_entry) { + err = walk->pgd_entry(pgd, addr, next, walk); + if (err) + break; + } + if (walk->p4d_entry || walk->pud_entry || walk->pmd_entry || + walk->pte_entry) err = walk_p4d_range(pgd, addr, next, walk); if (err) break; From patchwork Wed Feb 27 17:06:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B427715AC for ; Wed, 27 Feb 2019 17:08:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D4002E306 for ; Wed, 27 Feb 2019 17:08:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 917B02E328; Wed, 27 Feb 2019 17:08:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2752A2E306 for ; Wed, 27 Feb 2019 17:08:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 70EB58E001D; Wed, 27 Feb 2019 12:08:10 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6BEDA8E0001; Wed, 27 Feb 2019 12:08:10 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5876E8E001D; Wed, 27 Feb 2019 12:08:10 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id F38148E0001 for ; Wed, 27 Feb 2019 12:08:09 -0500 (EST) Received: by mail-ed1-f71.google.com with SMTP id i22so7224300eds.20 for ; Wed, 27 Feb 2019 09:08:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=NXbLxkVEjkUC98nDqbwMu9XwBnfr8Fy+W9xUz87hsi8=; b=ZSbXrLHDP63ELwuM8yaZH7NwGfaGt/Ny//QdjAnPUMZ5yq1vQSwv/UBixbSEhYglkw AFolupFomjEB9JRkj++opQ8U56FR3OJKsLhSnHfTh8G2FycTXcQHYuWBTUWjxWrGG0DB d4jPTlJkVW4bY/I/sI1KdqvSnJ9QoYLOevUHCesFB6/X0Vy3OoYYIn67A2bOIe8b4Cg2 NvWRZYxKDEHd+ILvzwcncs10AFj6/LaGzmarVlIsjLvh4F9NliwH8GR80WI4RSdGf6i2 OiHOp7dgi0bgBiK9MMMjcDroRogOgVA8cKx6O+d6pmKYWRzlZzSs5EGw0iUzoN50SLyS ybzg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAube9SNd6t/AbevwEjTZ5Ja6skqSxebCBJwS4oh+mCZXyRxXNlO3 1PY7AS0PSXQecFu6sM6iCRct/ZgCu2+cRQfqrkO0gGdTu53BFWT54v2vfAZsjs65kkT31jQZZo6 XmovtVrWuwPNRvM1Npc6G7BKK5QVCKrOTOh581QnpQ0DfZTz8p3Y4MsfbCS7RRc4FQQ== X-Received: by 2002:a50:89bc:: with SMTP id g57mr3064730edg.89.1551287289499; Wed, 27 Feb 2019 09:08:09 -0800 (PST) X-Google-Smtp-Source: AHgI3Iasr/11+Uuq8o8/MuoN/ti5klNYw6F1myrbe4+ES3gBmQM1iIUDOwVbFayd106ZPkweNyH4 X-Received: by 2002:a50:89bc:: with SMTP id g57mr3064669edg.89.1551287288483; Wed, 27 Feb 2019 09:08:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287288; cv=none; d=google.com; s=arc-20160816; b=Vw1JYIOpxbfOCgGUVrLhAJX1rsWkk5bmMmmPKTMf4/lFTnTzmHKLh3e+6/TNrDdkCT TS6Ib1CnFjVWgukYdBsVaFl0fTw5Jhr5q6RYx86d4DHk8Vsoa5X/PByfEStFVKSQdOhb 0fJ+v9BX+qz0hi+k+hoPwJZBZTmN+synIiG+aFTLoF31+g5M5XcIQhdYlHlZexLQxd0B Ge57xWPy7/SHuaEO/qyNo7gTp3tW+Db7GolcWQKLScefR5HhdTlaoTkCI27ChzdnlqQs +RuaqoT8SZvUyShe0XdmP6w5+Z1jd/DZ63yPSqzTF0aKpjHUmEwNnsKmyxXV8FtUckqs d78g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=NXbLxkVEjkUC98nDqbwMu9XwBnfr8Fy+W9xUz87hsi8=; b=vgAzj1kFgoskds/pkYJb1wq3vPybn9S0WMJ/9oSNXvYnRId4tVXOsNbua7BQYTND1j eo5un/xczmWnU+CJxeLWoaR8tByny+B58UEOqja/gO8ssMGpDXxviPu+dT/4Sbi2lhOc vmjlN7Gb2o5VUR7VGQSq7aiKX90lJJFoP6btrgQt7jqpfgvzpDPqXjO3i+FeIqqzhFZw W8+ZUe/qO56hFcwUgi53VC163Bsuk5/sZnBqdHjNSHcNN/ug+wLivB5qn9xjks0Fan6A YHW34BSldCbu+tUQQZSilxAQY5Z4U+ILJ0FbYLVWqtq43EsNOfHNinJ/DkL6fKCajtM4 v7JA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id r15si5665733eji.31.2019.02.27.09.08.08 for ; Wed, 27 Feb 2019 09:08:08 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 98305174E; Wed, 27 Feb 2019 09:08:07 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5D15D3F738; Wed, 27 Feb 2019 09:08:04 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" Subject: [PATCH v3 26/34] mm: pagewalk: Allow walking without vma Date: Wed, 27 Feb 2019 17:06:00 +0000 Message-Id: <20190227170608.27963-27-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Since 48684a65b4e3: "mm: pagewalk: fix misbehavior of walk_page_range for vma(VM_PFNMAP)", page_table_walk() will report any kernel area as a hole, because it lacks a vma. This means each arch has re-implemented page table walking when needed, for example in the per-arch ptdump walker. Remove the requirement to have a vma except when trying to split huge pages. Signed-off-by: Steven Price --- mm/pagewalk.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 98373a9f88b8..dac0c848b458 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -36,7 +36,7 @@ static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end, do { again: next = pmd_addr_end(addr, end); - if (pmd_none(*pmd) || !walk->vma) { + if (pmd_none(*pmd)) { if (walk->pte_hole) err = walk->pte_hole(addr, next, walk); if (err) @@ -59,9 +59,14 @@ static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end, if (!walk->pte_entry) continue; - split_huge_pmd(walk->vma, pmd, addr); - if (pmd_trans_unstable(pmd)) - goto again; + if (walk->vma) { + split_huge_pmd(walk->vma, pmd, addr); + if (pmd_trans_unstable(pmd)) + goto again; + } else if (pmd_large(*pmd)) { + continue; + } + err = walk_pte_range(pmd, addr, next, walk); if (err) break; @@ -81,7 +86,7 @@ static int walk_pud_range(p4d_t *p4d, unsigned long addr, unsigned long end, do { again: next = pud_addr_end(addr, end); - if (pud_none(*pud) || !walk->vma) { + if (pud_none(*pud)) { if (walk->pte_hole) err = walk->pte_hole(addr, next, walk); if (err) @@ -95,9 +100,13 @@ static int walk_pud_range(p4d_t *p4d, unsigned long addr, unsigned long end, break; } - split_huge_pud(walk->vma, pud, addr); - if (pud_none(*pud)) - goto again; + if (walk->vma) { + split_huge_pud(walk->vma, pud, addr); + if (pud_none(*pud)) + goto again; + } else if (pud_large(*pud)) { + continue; + } if (walk->pmd_entry || walk->pte_entry) err = walk_pmd_range(pud, addr, next, walk); From patchwork Wed Feb 27 17:06:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831977 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BBD6815AC for ; Wed, 27 Feb 2019 17:08:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3D412E305 for ; Wed, 27 Feb 2019 17:08:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 975612E31F; Wed, 27 Feb 2019 17:08:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D47212E305 for ; Wed, 27 Feb 2019 17:08:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 980048E001E; Wed, 27 Feb 2019 12:08:14 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 930E78E0001; Wed, 27 Feb 2019 12:08:14 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D3718E001E; Wed, 27 Feb 2019 12:08:14 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id 1DEE88E0001 for ; Wed, 27 Feb 2019 12:08:14 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id o27so7250462edc.14 for ; Wed, 27 Feb 2019 09:08:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=zJK9tQmzH2wt8ZgtuBGoRD5SE3Dtp+m3gB1hPWai3es=; b=l6Dc50pb2pjBjY5SZb7C0blWN6lYT43dMUcEFbahC8QdB26FqxzVm3be+EPgZTEvH6 IpuQVBBD5Q6+QAAwuKFF5HHFYDw7bAVi9OwQYw4q7NhZvveZuMProAKTjEc2nDcfNpkm g2doQlo0DGq/vPsWtY0rZS8HPyx/DuL3TBoS9dm+oM+gsYLgatHI2Fva9p1rXozoTAoq kuBddVVQIdHkdaFgtAvQfy7OBbBsYgPrw6LUJgZib09HrT4Dk754l41zjY5CeydyrtV/ /jmmf3CdsM/HZhJP8LsnpZVeLrFFR78T4hiZ9LJEZ4PPd5sHbgqa8bvxegsTpWTGVqki Pd9Q== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuY3KqHbKIFLhjq6VeawBokesYMU8O6V+whqnh7QIGBfMTEwJYBl Cc3AF92dKaBjD+BegH/y4/H5vhgucZDZ2+wsuDoqBHo6sPo4YoTnsY/Y6ggV3oDZdyj1/jF/+eb w3oKvUOnQeq/LuneY6ho0FI/k1EwgXNjd3FvRstaTEKtttlw2gmK0Z9WkxCggAaTiEA== X-Received: by 2002:a50:d8ce:: with SMTP id y14mr3151508edj.101.1551287293594; Wed, 27 Feb 2019 09:08:13 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibo1ZP4W7oQpat5tGuWPV3bJdcgISbi/+a5GEUs3OgzUJ6YJq1ZqYsrkUWl1VmPpJoyfFUO X-Received: by 2002:a50:d8ce:: with SMTP id y14mr3151425edj.101.1551287292164; Wed, 27 Feb 2019 09:08:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287292; cv=none; d=google.com; s=arc-20160816; b=iT+xdz04L7Ba44tUvOe1DXhbYJc6QLNIQyDfd6PLHSvbhnrzkA6h7xoLsNhwXfzVyA r9l37LZHOJ95HPc/nqRaNNjKroz20mBLcxicA0q5jMlMCdSamu5Xd+F0wthz2KVw9cC3 OeB+Rp+U+jDWX15UoJfukmwRGsedlu2lW5NeD7/nBwOUjM8Xfm8St5mFZ35HmzBHP/lp DJTZl8CM108+0tHvSBNs07CPx9vSqXt/ysoE42Ft765Ie/eWC3QOf1quTdtIZa12TM3R Fp/fACbK9wWwtm+EXiHGyBMRCG5C+4FBq68OVaMMiS3YVcMK/JBvhOntWUtd3RYgdCb/ RPkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=zJK9tQmzH2wt8ZgtuBGoRD5SE3Dtp+m3gB1hPWai3es=; b=B7WEcZq7OE3499tCj1mncCuPZgd0S7TuEoL8AMSTfSEGfU1mTcmJ74vD+EuqewxQw4 hFOVrquOSiWxCmRUk1YBqJ0dZQQMFNL0Cv4DQBMkZiD9DeMWYsO8/h+yMPpm9GGT1c/3 J1GbVFQOgnCunKDamaV3LYjcijuJCQdMpOgEoyzARN2SRjGBjFQQh2MNHnKyQuamxqEa +9S4bdl2rTygJouT8Q5xEa7Y1LXd4NANXP4VOmygjMhIF2kfvzQORatRCvOMvkyYtF33 ukXDIQbrBYGtnEQF1vbb++R5Y1+cOR1Vs725dbJBo+llAGrn3u8lNb4qQfVhBybBqUrp kIeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id bq9si621576ejb.212.2019.02.27.09.08.11 for ; Wed, 27 Feb 2019 09:08:12 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1E223A78; Wed, 27 Feb 2019 09:08:11 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D78CF3F738; Wed, 27 Feb 2019 09:08:07 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" Subject: [PATCH v3 27/34] mm: pagewalk: Add 'depth' parameter to pte_hole Date: Wed, 27 Feb 2019 17:06:01 +0000 Message-Id: <20190227170608.27963-28-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP The pte_hole() callback is called at multiple levels of the page tables. Code dumping the kernel page tables needs to know what at what depth the missing entry is. Add this is an extra parameter to pte_hole(). When the depth isn't know (e.g. processing a vma) then -1 is passed. The depth that is reported is the actual level where the entry is missing (ignoring any folding that is in place), i.e. any levels where PTRS_PER_P?D is set to 1 are ignored. Note that depth starts at 0 for a PGD so that PUD/PMD/PTE retain their natural numbers as levels 2/3/4. Signed-off-by: Steven Price Signed-off-by: Steven Price --- fs/proc/task_mmu.c | 4 ++-- include/linux/mm.h | 6 ++++-- mm/hmm.c | 2 +- mm/migrate.c | 1 + mm/mincore.c | 1 + mm/pagewalk.c | 31 +++++++++++++++++++++++++------ 6 files changed, 34 insertions(+), 11 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index f0ec9edab2f3..91131cd4e9e0 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -474,7 +474,7 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page, #ifdef CONFIG_SHMEM static int smaps_pte_hole(unsigned long addr, unsigned long end, - struct mm_walk *walk) + __always_unused int depth, struct mm_walk *walk) { struct mem_size_stats *mss = walk->private; @@ -1203,7 +1203,7 @@ static int add_to_pagemap(unsigned long addr, pagemap_entry_t *pme, } static int pagemap_pte_hole(unsigned long start, unsigned long end, - struct mm_walk *walk) + __always_unused int depth, struct mm_walk *walk) { struct pagemapread *pm = walk->private; unsigned long addr = start; diff --git a/include/linux/mm.h b/include/linux/mm.h index 1a4b1615d012..4ae3634a9118 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1420,7 +1420,9 @@ void unmap_vmas(struct mmu_gather *tlb, struct vm_area_struct *start_vma, * pmd_trans_huge() pmds. They may simply choose to * split_huge_page() instead of handling it explicitly. * @pte_entry: if set, called for each non-empty PTE (4th-level) entry - * @pte_hole: if set, called for each hole at all levels + * @pte_hole: if set, called for each hole at all levels, + * depth is -1 if not known, 0:PGD, 1:P4D, 2:PUD, 3:PMD, 4:PTE + * any depths where PTRS_PER_P?D is equal to 1 are skipped * @hugetlb_entry: if set, called for each hugetlb entry * @test_walk: caller specific callback function to determine whether * we walk over the current vma or not. Returning 0 @@ -1445,7 +1447,7 @@ struct mm_walk { int (*pte_entry)(pte_t *pte, unsigned long addr, unsigned long next, struct mm_walk *walk); int (*pte_hole)(unsigned long addr, unsigned long next, - struct mm_walk *walk); + int depth, struct mm_walk *walk); int (*hugetlb_entry)(pte_t *pte, unsigned long hmask, unsigned long addr, unsigned long next, struct mm_walk *walk); diff --git a/mm/hmm.c b/mm/hmm.c index a04e4b810610..e3e6b8fda437 100644 --- a/mm/hmm.c +++ b/mm/hmm.c @@ -440,7 +440,7 @@ static void hmm_range_need_fault(const struct hmm_vma_walk *hmm_vma_walk, } static int hmm_vma_walk_hole(unsigned long addr, unsigned long end, - struct mm_walk *walk) + __always_unused int depth, struct mm_walk *walk) { struct hmm_vma_walk *hmm_vma_walk = walk->private; struct hmm_range *range = hmm_vma_walk->range; diff --git a/mm/migrate.c b/mm/migrate.c index d4fd680be3b0..8b62a9fecb5c 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2121,6 +2121,7 @@ struct migrate_vma { static int migrate_vma_collect_hole(unsigned long start, unsigned long end, + __always_unused int depth, struct mm_walk *walk) { struct migrate_vma *migrate = walk->private; diff --git a/mm/mincore.c b/mm/mincore.c index 218099b5ed31..c4edbc688241 100644 --- a/mm/mincore.c +++ b/mm/mincore.c @@ -104,6 +104,7 @@ static int __mincore_unmapped_range(unsigned long addr, unsigned long end, } static int mincore_unmapped_range(unsigned long addr, unsigned long end, + __always_unused int depth, struct mm_walk *walk) { walk->private += __mincore_unmapped_range(addr, end, diff --git a/mm/pagewalk.c b/mm/pagewalk.c index dac0c848b458..57946bcd810c 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -4,6 +4,22 @@ #include #include +/* + * We want to know the real level where a entry is located ignoring any + * folding of levels which may be happening. For example if p4d is folded then + * a missing entry found at level 1 (p4d) is actually at level 0 (pgd). + */ +static int real_depth(int depth) +{ + if (depth == 3 && PTRS_PER_PMD == 1) + depth = 2; + if (depth == 2 && PTRS_PER_PUD == 1) + depth = 1; + if (depth == 1 && PTRS_PER_P4D == 1) + depth = 0; + return depth; +} + static int walk_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, struct mm_walk *walk) { @@ -31,6 +47,7 @@ static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end, pmd_t *pmd; unsigned long next; int err = 0; + int depth = real_depth(3); pmd = pmd_offset(pud, addr); do { @@ -38,7 +55,7 @@ static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end, next = pmd_addr_end(addr, end); if (pmd_none(*pmd)) { if (walk->pte_hole) - err = walk->pte_hole(addr, next, walk); + err = walk->pte_hole(addr, next, depth, walk); if (err) break; continue; @@ -81,6 +98,7 @@ static int walk_pud_range(p4d_t *p4d, unsigned long addr, unsigned long end, pud_t *pud; unsigned long next; int err = 0; + int depth = real_depth(2); pud = pud_offset(p4d, addr); do { @@ -88,7 +106,7 @@ static int walk_pud_range(p4d_t *p4d, unsigned long addr, unsigned long end, next = pud_addr_end(addr, end); if (pud_none(*pud)) { if (walk->pte_hole) - err = walk->pte_hole(addr, next, walk); + err = walk->pte_hole(addr, next, depth, walk); if (err) break; continue; @@ -123,13 +141,14 @@ static int walk_p4d_range(pgd_t *pgd, unsigned long addr, unsigned long end, p4d_t *p4d; unsigned long next; int err = 0; + int depth = real_depth(1); p4d = p4d_offset(pgd, addr); do { next = p4d_addr_end(addr, end); if (p4d_none_or_clear_bad(p4d)) { if (walk->pte_hole) - err = walk->pte_hole(addr, next, walk); + err = walk->pte_hole(addr, next, depth, walk); if (err) break; continue; @@ -160,7 +179,7 @@ static int walk_pgd_range(unsigned long addr, unsigned long end, next = pgd_addr_end(addr, end); if (pgd_none_or_clear_bad(pgd)) { if (walk->pte_hole) - err = walk->pte_hole(addr, next, walk); + err = walk->pte_hole(addr, next, 0, walk); if (err) break; continue; @@ -206,7 +225,7 @@ static int walk_hugetlb_range(unsigned long addr, unsigned long end, if (pte) err = walk->hugetlb_entry(pte, hmask, addr, next, walk); else if (walk->pte_hole) - err = walk->pte_hole(addr, next, walk); + err = walk->pte_hole(addr, next, -1, walk); if (err) break; @@ -249,7 +268,7 @@ static int walk_page_test(unsigned long start, unsigned long end, if (vma->vm_flags & VM_PFNMAP) { int err = 1; if (walk->pte_hole) - err = walk->pte_hole(start, end, walk); + err = walk->pte_hole(start, end, -1, walk); return err ? err : 1; } return 0; From patchwork Wed Feb 27 17:06:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831979 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D3BDA15AC for ; Wed, 27 Feb 2019 17:08:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBF972E305 for ; Wed, 27 Feb 2019 17:08:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF8DA2E31F; Wed, 27 Feb 2019 17:08:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3522D2E305 for ; Wed, 27 Feb 2019 17:08:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ABA1D8E001F; Wed, 27 Feb 2019 12:08:17 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A6BD08E0001; Wed, 27 Feb 2019 12:08:17 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E1628E001F; Wed, 27 Feb 2019 12:08:17 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id 3339E8E0001 for ; Wed, 27 Feb 2019 12:08:17 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id k21so4251752eds.19 for ; Wed, 27 Feb 2019 09:08:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=5+qDYU4THjLPvNOaZc1aA0s7EjXEEdRbPiGSrygYMH0=; b=Ev5gdc9zzYlHovXWhvEDvyhPZrP0H9CljdK12cGMjGycus4HlCYKJAhtgUkmz+9d+Q 1iINmf9FQXKcrUCbup/b7SQqen+kkCeljaw2+qY0bbU7fJbU4zT8s/M42UhtaJSQbHNC P6NHyb8OFbEoq+nmCOVoQONs9tju1qczra2E4X5IPEC/Z9mbOJanz34Wn3VjIeRldB/Q zwcGZuD6SnTytO8TkYbFyRERc9QBkn5fEM214McZcr5Qis2QnfWt4jAG5HXBTDydr0xS G9QOz1wmg3L0y9eJ40+uwFF9kkaiVwVWT/xzqZcabvFqm3CWB8PB2f/o/T1FmSdWkbwV 8rkg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuaUpEBSsKGQ5tPlRQl7FkdFdibHXkezdPjeMLAo8Vo+OX6YDwHq A88NVAW5kcOyOc/WutpfXiseHyVqoENh2eTC6fXofRYnUAh2gsXVP9iRmwa3PjNn/X+jFojY3+t hd4D3J7pC/w5c7/lHolU3AfewIaA5dfFAWE9kgi89DYpiIflbUsx4uWCgqX876mCHNg== X-Received: by 2002:a50:cac8:: with SMTP id f8mr3196686edi.212.1551287296709; Wed, 27 Feb 2019 09:08:16 -0800 (PST) X-Google-Smtp-Source: AHgI3IYeVIgW1b0Jg/w4dIhqe+PO0PfAoGUTBIfQW9siBNdXNeINVCRrBjH34RUopzN1DH3ObxZt X-Received: by 2002:a50:cac8:: with SMTP id f8mr3196625edi.212.1551287295682; Wed, 27 Feb 2019 09:08:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287295; cv=none; d=google.com; s=arc-20160816; b=h3fiorNhmojkegE7+qEh6HbUITvw2ErflZnA8t1oNXUBf0KTzfwBDdXAajDBt61Q6M y4x45bcSFkQoS0k47RuYmS9hiy2ymfKnA7nKVBZobDxsW3Hh53c/f/4598shsXTfZ/Ng mxXxAscHIdmPobbt7p1uK0/QWNLJPbUFy9TTd7L0me3kbR1fB6uwqm4zdaEJbFm8ptPJ det+03cQD3Rxi4qxz8ccBjphTfU/xROuo/rdhPM/XKnPsARyH1einFwpiWHNBl5FnBqY gtri7tQ+QjDfxAqFElZs2puG+VInjxvygmgT8Lffv2fOG2O2QB4iKt7b9ue4VlvjUHFw y9QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=5+qDYU4THjLPvNOaZc1aA0s7EjXEEdRbPiGSrygYMH0=; b=Qp0wqWfHCdvP8F0FUFP7dStxnX7eYSvcTZ754sNCOYcophgETWuajE+2mbmVGBh0zU ETz5J3xt182rM6/uylNONzPGntoF0lYCO0bXTC2/Mg3tv+7ii63GdefeTfhVdsxQgru2 7HvXCbJBQVYJmhcbBckrydMzFLE5Z8oZSIQpuhdOv6imLfZN2nkwlKTUPiqkV8ll/XLi YwxfOtyb1k7wRkvUXm+5+eShlQs/+ZgrvXXNwkOnNUiKmDdrrlIWqk+ExYgpxza84g9T TFnjyUoDa21OZ17hAh9JLcDDn9xVPapQAhyeh/GCt60aPrjFyNSYgkLEdfUBG4gGZdvc RPpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id o5-v6si2896540ejd.156.2019.02.27.09.08.15 for ; Wed, 27 Feb 2019 09:08:15 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 980A81715; Wed, 27 Feb 2019 09:08:14 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5D5B83F738; Wed, 27 Feb 2019 09:08:11 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" Subject: [PATCH v3 28/34] mm: pagewalk: Add test_p?d callbacks Date: Wed, 27 Feb 2019 17:06:02 +0000 Message-Id: <20190227170608.27963-29-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP It is useful to be able to skip parts of the page table tree even when walking without VMAs. Add test_p?d callbacks similar to test_walk but which are called just before a table at that level is walked. If the callback returns non-zero then the entire table is skipped. Signed-off-by: Steven Price --- include/linux/mm.h | 11 +++++++++++ mm/pagewalk.c | 24 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index 4ae3634a9118..581f31c6b6d9 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1429,6 +1429,11 @@ void unmap_vmas(struct mmu_gather *tlb, struct vm_area_struct *start_vma, * value means "do page table walk over the current vma," * and a negative one means "abort current page table walk * right now." 1 means "skip the current vma." + * @test_pmd: similar to test_walk(), but called for every pmd. + * @test_pud: similar to test_walk(), but called for every pud. + * @test_p4d: similar to test_walk(), but called for every p4d. + * Returning 0 means walk this part of the page tables, + * returning 1 means to skip this range. * @mm: mm_struct representing the target process of page table walk * @vma: vma currently walked (NULL if walking outside vmas) * @private: private data for callbacks' usage @@ -1453,6 +1458,12 @@ struct mm_walk { struct mm_walk *walk); int (*test_walk)(unsigned long addr, unsigned long next, struct mm_walk *walk); + int (*test_pmd)(unsigned long addr, unsigned long next, + pmd_t *pmd_start, struct mm_walk *walk); + int (*test_pud)(unsigned long addr, unsigned long next, + pud_t *pud_start, struct mm_walk *walk); + int (*test_p4d)(unsigned long addr, unsigned long next, + p4d_t *p4d_start, struct mm_walk *walk); struct mm_struct *mm; struct vm_area_struct *vma; void *private; diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 57946bcd810c..ff2fc8490435 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -49,6 +49,14 @@ static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end, int err = 0; int depth = real_depth(3); + if (walk->test_pmd) { + err = walk->test_pmd(addr, end, pmd_offset(pud, 0), walk); + if (err < 0) + return err; + if (err > 0) + return 0; + } + pmd = pmd_offset(pud, addr); do { again: @@ -100,6 +108,14 @@ static int walk_pud_range(p4d_t *p4d, unsigned long addr, unsigned long end, int err = 0; int depth = real_depth(2); + if (walk->test_pud) { + err = walk->test_pud(addr, end, pud_offset(p4d, 0), walk); + if (err < 0) + return err; + if (err > 0) + return 0; + } + pud = pud_offset(p4d, addr); do { again: @@ -143,6 +159,14 @@ static int walk_p4d_range(pgd_t *pgd, unsigned long addr, unsigned long end, int err = 0; int depth = real_depth(1); + if (walk->test_p4d) { + err = walk->test_p4d(addr, end, p4d_offset(pgd, 0), walk); + if (err < 0) + return err; + if (err > 0) + return 0; + } + p4d = p4d_offset(pgd, addr); do { next = p4d_addr_end(addr, end); From patchwork Wed Feb 27 17:06:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831983 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 583991390 for ; Wed, 27 Feb 2019 17:08:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FFB62E305 for ; Wed, 27 Feb 2019 17:08:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33CC82E31F; Wed, 27 Feb 2019 17:08:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F5822E305 for ; Wed, 27 Feb 2019 17:08:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 49F258E0020; Wed, 27 Feb 2019 12:08:21 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 44FF68E0001; Wed, 27 Feb 2019 12:08:21 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 279AF8E0020; Wed, 27 Feb 2019 12:08:21 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id C23D58E0001 for ; Wed, 27 Feb 2019 12:08:20 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id d16so7168423edv.22 for ; Wed, 27 Feb 2019 09:08:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=+F2lxaeFDvQ8eJHjFbD9vB/FESYGJ6cBcX+b4/bW6NY=; b=mRwimeeTuO2AV42wy6iRySqtCUeWxl2L/poBO/MDh5VrmWvGL/f/vozLFplN30o81L M7j7srik2eoNU5DoiRDtiPSPzgUUazXvO4+ZbljNQq/VH7ExXnOZ2nIs6w/Gp3298pqM MMg2qnc/q0cFhKwa6HjQZLx3QgueJ2ficdksZkKhfQcBSV7JJh/BRdpVxSvBGdlmbDSQ 4FjE33Qy82kA5wAeS+Q5s3DzHDE4iqByP+ECvA6EhrPjU3biJ/hsysszpJDdVDK78D+r oAOgCkDREQ8S6hom2u8veMknFfnQvAZ9sWdC17xfHUNKSfMlFxeGlFEkY6nXraAdlQ6W 8/ZQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAubKCPp0+4W/Mz7vFvGVy9JlVuEX2wskoQ5YpcFIyTaIydPa+9Fp XapXQrUyP6ks2NafB4+j4vE9ci1vunZE+kxkUI04hD1ae7MOdRuo+L588XU4/K0LrF1Z45gfkB3 tj1hVcQjDCziJb5eA5KT9bdY6rcdX+QRNP+TWFxDmUjs6l6mJg8dTCnAhlpNrWJB3GQ== X-Received: by 2002:a17:906:7b03:: with SMTP id e3mr2293408ejo.21.1551287300230; Wed, 27 Feb 2019 09:08:20 -0800 (PST) X-Google-Smtp-Source: AHgI3IZChEDf0ZfGbh7VdtgaWwRJrUne9Ns2n+x/75LEGo2oMO7n6wXMKA1p+aX2/81Zd2oTJ1+M X-Received: by 2002:a17:906:7b03:: with SMTP id e3mr2293346ejo.21.1551287299211; Wed, 27 Feb 2019 09:08:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287299; cv=none; d=google.com; s=arc-20160816; b=01Eqieemwqskd8s0YW1gXpXmA0bObNiA2wiYK38X8IBq27JRqa2QXW+s5YiWj5iqID fIYLHFX5YujCEIxcdsTdqVepwlvO6Vx/D2+Flu+DizRMSyrKdkPLfu4YOf6/3iLzl0ah NMyxF8rQTYiwWFuyiEVY1BcgzPyUp32fu4GNiz82uenuH9ARk7Up0IA3Q9ARTPImNj6U gFILvg1MrK9TojICbBU7BrTpeNmnDEEvGYw0w7WEMxmG2QTxF/b5CYdT/yyV3iMu7JDB FYJDAxzIerc5hqAahdk5SpHw7flvg7yyv+2EVB67UC7JKwI59DLtD8jioXzuVQ20Eh8R zkwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=+F2lxaeFDvQ8eJHjFbD9vB/FESYGJ6cBcX+b4/bW6NY=; b=xbdu/24CIiTvGp00+ElG/zjfvkwbg7P+A3OsRBcywnC0RrFIZ2Gyj/1Qy1hltui9w+ 6DlyiQnOetIb5bdRinKTdrcepOGzWWhoaEQ/4OeawlIkfuJl1TpZVTdwyp+we7jGH2AO oMgGz8mWFuxonPq5E/UtztwC7knINLsPq0tR6uIWKAIbPZlGudZBZmIuCAJrmpCKetZw /H6v/JTv9MErMjQuiRQHXB9h+XdjtwKvROrxWt6XlifaIWo7lrSFYjqO8ZBnmTNgt8Ip BcRYvjD102gDqmPdK9GMtaDdVTLynOwlEfPO9ilKq1qGWA3jrZb4Z11bvuZyawJWiaKe FnEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id y2si168628ejw.302.2019.02.27.09.08.18 for ; Wed, 27 Feb 2019 09:08:19 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1E9FE19BF; Wed, 27 Feb 2019 09:08:18 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D7C103F738; Wed, 27 Feb 2019 09:08:14 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" Subject: [PATCH v3 29/34] arm64: mm: Convert mm/dump.c to use walk_page_range() Date: Wed, 27 Feb 2019 17:06:03 +0000 Message-Id: <20190227170608.27963-30-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Now walk_page_range() can walk kernel page tables, we can switch the arm64 ptdump code over to using it, simplifying the code. Signed-off-by: Steven Price --- arch/arm64/mm/dump.c | 108 +++++++++++++++++++++---------------------- 1 file changed, 53 insertions(+), 55 deletions(-) diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c index 99bb8facb5cb..ee0bc1441dd0 100644 --- a/arch/arm64/mm/dump.c +++ b/arch/arm64/mm/dump.c @@ -286,73 +286,71 @@ static void note_page(struct pg_state *st, unsigned long addr, unsigned level, } -static void walk_pte(struct pg_state *st, pmd_t *pmdp, unsigned long start, - unsigned long end) +static int pud_entry(pud_t *pud, unsigned long addr, + unsigned long next, struct mm_walk *walk) { - unsigned long addr = start; - pte_t *ptep = pte_offset_kernel(pmdp, start); + struct pg_state *st = walk->private; + pud_t val = READ_ONCE(*pud); - do { - note_page(st, addr, 4, READ_ONCE(pte_val(*ptep))); - } while (ptep++, addr += PAGE_SIZE, addr != end); + if (pud_table(val)) + return 0; + + note_page(st, addr, 2, pud_val(val)); + + return 0; } -static void walk_pmd(struct pg_state *st, pud_t *pudp, unsigned long start, - unsigned long end) +static int pmd_entry(pmd_t *pmd, unsigned long addr, + unsigned long next, struct mm_walk *walk) { - unsigned long next, addr = start; - pmd_t *pmdp = pmd_offset(pudp, start); - - do { - pmd_t pmd = READ_ONCE(*pmdp); - next = pmd_addr_end(addr, end); - - if (pmd_none(pmd) || pmd_sect(pmd)) { - note_page(st, addr, 3, pmd_val(pmd)); - } else { - BUG_ON(pmd_bad(pmd)); - walk_pte(st, pmdp, addr, next); - } - } while (pmdp++, addr = next, addr != end); + struct pg_state *st = walk->private; + pmd_t val = READ_ONCE(*pmd); + + if (pmd_table(val)) + return 0; + + note_page(st, addr, 3, pmd_val(val)); + + return 0; } -static void walk_pud(struct pg_state *st, pgd_t *pgdp, unsigned long start, - unsigned long end) +static int pte_entry(pte_t *pte, unsigned long addr, + unsigned long next, struct mm_walk *walk) { - unsigned long next, addr = start; - pud_t *pudp = pud_offset(pgdp, start); - - do { - pud_t pud = READ_ONCE(*pudp); - next = pud_addr_end(addr, end); - - if (pud_none(pud) || pud_sect(pud)) { - note_page(st, addr, 2, pud_val(pud)); - } else { - BUG_ON(pud_bad(pud)); - walk_pmd(st, pudp, addr, next); - } - } while (pudp++, addr = next, addr != end); + struct pg_state *st = walk->private; + pte_t val = READ_ONCE(*pte); + + note_page(st, addr, 4, pte_val(val)); + + return 0; +} + +static int pte_hole(unsigned long addr, unsigned long next, int depth, + struct mm_walk *walk) +{ + struct pg_state *st = walk->private; + + note_page(st, addr, depth+1, 0); + + return 0; } static void walk_pgd(struct pg_state *st, struct mm_struct *mm, - unsigned long start) + unsigned long start) { - unsigned long end = (start < TASK_SIZE_64) ? TASK_SIZE_64 : 0; - unsigned long next, addr = start; - pgd_t *pgdp = pgd_offset(mm, start); - - do { - pgd_t pgd = READ_ONCE(*pgdp); - next = pgd_addr_end(addr, end); - - if (pgd_none(pgd)) { - note_page(st, addr, 1, pgd_val(pgd)); - } else { - BUG_ON(pgd_bad(pgd)); - walk_pud(st, pgdp, addr, next); - } - } while (pgdp++, addr = next, addr != end); + struct mm_walk walk = { + .mm = mm, + .private = st, + .pud_entry = pud_entry, + .pmd_entry = pmd_entry, + .pte_entry = pte_entry, + .pte_hole = pte_hole + }; + down_read(&mm->mmap_sem); + walk_page_range(start, start | (((unsigned long)PTRS_PER_PGD << + PGDIR_SHIFT) - 1), + &walk); + up_read(&mm->mmap_sem); } void ptdump_walk_pgd(struct seq_file *m, struct ptdump_info *info) From patchwork Wed Feb 27 17:06:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831985 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3CBB515AC for ; Wed, 27 Feb 2019 17:08:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 242192E305 for ; Wed, 27 Feb 2019 17:08:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 171012E31F; Wed, 27 Feb 2019 17:08:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 508112E305 for ; Wed, 27 Feb 2019 17:08:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 402638E0021; Wed, 27 Feb 2019 12:08:25 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 38C298E0001; Wed, 27 Feb 2019 12:08:25 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 22CF08E0021; Wed, 27 Feb 2019 12:08:25 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id BFBD18E0001 for ; Wed, 27 Feb 2019 12:08:24 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id y26so2500958edb.4 for ; Wed, 27 Feb 2019 09:08:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ZnrJE1cHSA8bRO6HM3R6W9HO+vZLkp1Il576abGPC40=; b=CufYcSLN1WUiZ8Dy7wO8FgBGcoieF7oojhPpA4YJFnLsYSrjcOoMWRd+gGV7Z73MYx eXGvgN9xBkpEUTbBtIlrlduTOd/famzjSkssaw+VvQZEgemtJbVGEJ4oVcA5s6KVGBTz gr3xER0NIG3ZdTyO4zxq5BUGXFcUZOBy9KITWF7svewWhB3DQkpFgbzk2IBU9KGlppsv I98gHH3860CkfTZC+OaWn2GZ0ybGQBvNLINr8cV+qNAgtmx3RgayuIWstaNtsNIoBnLz 6Rg29NvxrRPfHlIEwIhoDMwOEwhh38xYW/Mr682ehRW8Te3tZ/VLEY44PC1zY8RvzCoB nqbA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuZNV+5FQCDy1k+GdpcYH34gCYEINoSR0SF7ZHXRwBqg1N2aiHRX bYDqzJFDc3IgQF06ZeSA2DLja3FF8PNm8MIP2drYKGjcQmgPizoB2Bb1ldzElewSKUgsDnljPb5 QItDaaRZUeOXRV13zDi+sUcugmR3DqoJYtYLZ5ViDKTy86CWWw7ZGHf0ItSAydB/uDQ== X-Received: by 2002:a50:a53d:: with SMTP id y58mr3102175edb.282.1551287304135; Wed, 27 Feb 2019 09:08:24 -0800 (PST) X-Google-Smtp-Source: AHgI3IYPC3zGlH4mfMyHy/5rfGZraQEq/3oRL3+oxIZisxhL2b4ULOzZ1C4gijmryWFJr6f8xdih X-Received: by 2002:a50:a53d:: with SMTP id y58mr3102093edb.282.1551287302867; Wed, 27 Feb 2019 09:08:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287302; cv=none; d=google.com; s=arc-20160816; b=OsyOPzKYbPylShhWCDLmU/qcctpR/xW7le0h0zpLB8D2Jq6RZa5a38MQYtZISEJpUQ gTsBS9T+4/0Ndkkm7qYcedWdC93iwEIBoHLhWzmB+PR8G6GTAlREzbPQL00p1Ro1b6Q0 MMxlNR2nA0PARA8vgHcvJ1cS7QWZt8g9yMOjQLmPIxcciLyo+02wtCJVu0j3C3yxWYpU P5BlJZyC45gAwa/Mn6IUXHwT98eEYs7CTr6CTn90La8JfzYeqXd6LFuUvxeJaO7Yqgfa LK3w8Q8RpmdRXdD6CIrlc3jcSynI9IYfYYWEHbHEZGTPbLaKFD9T1OQTgS+Ey/G28oq6 bpHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=ZnrJE1cHSA8bRO6HM3R6W9HO+vZLkp1Il576abGPC40=; b=DDcxeWnu5h74ZwruKO18OTRGloyakyBoKzOY2MU52H9fhCDMm3ko6kBye4wTxEj6/N LnJhBnEsqKdHwhhjXOpW39sTXHYH15Q9h/1X+okIfA0PB3oWAnsQhEBdK2M8JFSvd87I /sW25yYLpDE0JWxDPic/aIB8aHUVrCyrmYcMUWz9Zu6H/UisrYMkMAdSuBeMxZxFiLaH ftrwjzd81F5aZLKWFtXrHNMMFOznzV0jlhSBRI1xxlO41TSqP04hGK64sYXhiGqdflSt JLQCsGPc8QlTCJ+0nzKfVtomgDwEl3uGeh2kqoplL3u4X2z7x//caaXTQazQ7Nal1eCl qeFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id y15si3336539edj.12.2019.02.27.09.08.22 for ; Wed, 27 Feb 2019 09:08:22 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BCC5DA78; Wed, 27 Feb 2019 09:08:21 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5E3A13F738; Wed, 27 Feb 2019 09:08:18 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" Subject: [PATCH v3 30/34] x86/mm: Point to struct seq_file from struct pg_state Date: Wed, 27 Feb 2019 17:06:04 +0000 Message-Id: <20190227170608.27963-31-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP mm/dump_pagetables.c passes both struct seq_file and struct pg_state down the chain of walk_*_level() functions to be passed to note_page(). Instead place the struct seq_file in struct pg_state and access it from struct pg_state (which is private to this file) in note_page(). Signed-off-by: Steven Price --- arch/x86/mm/dump_pagetables.c | 69 ++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c index e3cdc85ce5b6..ecbaf30a6a2f 100644 --- a/arch/x86/mm/dump_pagetables.c +++ b/arch/x86/mm/dump_pagetables.c @@ -40,6 +40,7 @@ struct pg_state { bool to_dmesg; bool check_wx; unsigned long wx_pages; + struct seq_file *seq; }; struct addr_marker { @@ -268,11 +269,12 @@ static void note_wx(struct pg_state *st) * of PTE entries; the next one is different so we need to * print what we collected so far. */ -static void note_page(struct seq_file *m, struct pg_state *st, - pgprot_t new_prot, pgprotval_t new_eff, int level) +static void note_page(struct pg_state *st, pgprot_t new_prot, + pgprotval_t new_eff, int level) { pgprotval_t prot, cur, eff; static const char units[] = "BKMGTPE"; + struct seq_file *m = st->seq; /* * If we have a "break" in the series, we need to flush the state that @@ -357,8 +359,8 @@ static inline pgprotval_t effective_prot(pgprotval_t prot1, pgprotval_t prot2) ((prot1 | prot2) & _PAGE_NX); } -static void walk_pte_level(struct seq_file *m, struct pg_state *st, pmd_t addr, - pgprotval_t eff_in, unsigned long P) +static void walk_pte_level(struct pg_state *st, pmd_t addr, pgprotval_t eff_in, + unsigned long P) { int i; pte_t *pte; @@ -369,7 +371,7 @@ static void walk_pte_level(struct seq_file *m, struct pg_state *st, pmd_t addr, pte = pte_offset_map(&addr, st->current_address); prot = pte_flags(*pte); eff = effective_prot(eff_in, prot); - note_page(m, st, __pgprot(prot), eff, 5); + note_page(st, __pgprot(prot), eff, 5); pte_unmap(pte); } } @@ -382,22 +384,20 @@ static void walk_pte_level(struct seq_file *m, struct pg_state *st, pmd_t addr, * us dozens of seconds (minutes for 5-level config) while checking for * W+X mapping or reading kernel_page_tables debugfs file. */ -static inline bool kasan_page_table(struct seq_file *m, struct pg_state *st, - void *pt) +static inline bool kasan_page_table(struct pg_state *st, void *pt) { if (__pa(pt) == __pa(kasan_early_shadow_pmd) || (pgtable_l5_enabled() && __pa(pt) == __pa(kasan_early_shadow_p4d)) || __pa(pt) == __pa(kasan_early_shadow_pud)) { pgprotval_t prot = pte_flags(kasan_early_shadow_pte[0]); - note_page(m, st, __pgprot(prot), 0, 5); + note_page(st, __pgprot(prot), 0, 5); return true; } return false; } #else -static inline bool kasan_page_table(struct seq_file *m, struct pg_state *st, - void *pt) +static inline bool kasan_page_table(struct pg_state *st, void *pt) { return false; } @@ -405,7 +405,7 @@ static inline bool kasan_page_table(struct seq_file *m, struct pg_state *st, #if PTRS_PER_PMD > 1 -static void walk_pmd_level(struct seq_file *m, struct pg_state *st, pud_t addr, +static void walk_pmd_level(struct pg_state *st, pud_t addr, pgprotval_t eff_in, unsigned long P) { int i; @@ -419,27 +419,27 @@ static void walk_pmd_level(struct seq_file *m, struct pg_state *st, pud_t addr, prot = pmd_flags(*start); eff = effective_prot(eff_in, prot); if (pmd_large(*start) || !pmd_present(*start)) { - note_page(m, st, __pgprot(prot), eff, 4); - } else if (!kasan_page_table(m, st, pmd_start)) { - walk_pte_level(m, st, *start, eff, + note_page(st, __pgprot(prot), eff, 4); + } else if (!kasan_page_table(st, pmd_start)) { + walk_pte_level(st, *start, eff, P + i * PMD_LEVEL_MULT); } } else - note_page(m, st, __pgprot(0), 0, 4); + note_page(st, __pgprot(0), 0, 4); start++; } } #else -#define walk_pmd_level(m,s,a,e,p) walk_pte_level(m,s,__pmd(pud_val(a)),e,p) +#define walk_pmd_level(s,a,e,p) walk_pte_level(s,__pmd(pud_val(a)),e,p) #define pud_large(a) pmd_large(__pmd(pud_val(a))) #define pud_none(a) pmd_none(__pmd(pud_val(a))) #endif #if PTRS_PER_PUD > 1 -static void walk_pud_level(struct seq_file *m, struct pg_state *st, p4d_t addr, - pgprotval_t eff_in, unsigned long P) +static void walk_pud_level(struct pg_state *st, p4d_t addr, pgprotval_t eff_in, + unsigned long P) { int i; pud_t *start, *pud_start; @@ -454,13 +454,13 @@ static void walk_pud_level(struct seq_file *m, struct pg_state *st, p4d_t addr, prot = pud_flags(*start); eff = effective_prot(eff_in, prot); if (pud_large(*start) || !pud_present(*start)) { - note_page(m, st, __pgprot(prot), eff, 3); - } else if (!kasan_page_table(m, st, pud_start)) { - walk_pmd_level(m, st, *start, eff, + note_page(st, __pgprot(prot), eff, 3); + } else if (!kasan_page_table(st, pud_start)) { + walk_pmd_level(st, *start, eff, P + i * PUD_LEVEL_MULT); } } else - note_page(m, st, __pgprot(0), 0, 3); + note_page(st, __pgprot(0), 0, 3); prev_pud = start; start++; @@ -468,20 +468,20 @@ static void walk_pud_level(struct seq_file *m, struct pg_state *st, p4d_t addr, } #else -#define walk_pud_level(m,s,a,e,p) walk_pmd_level(m,s,__pud(p4d_val(a)),e,p) +#define walk_pud_level(s,a,e,p) walk_pmd_level(s,__pud(p4d_val(a)),e,p) #define p4d_large(a) pud_large(__pud(p4d_val(a))) #define p4d_none(a) pud_none(__pud(p4d_val(a))) #endif -static void walk_p4d_level(struct seq_file *m, struct pg_state *st, pgd_t addr, - pgprotval_t eff_in, unsigned long P) +static void walk_p4d_level(struct pg_state *st, pgd_t addr, pgprotval_t eff_in, + unsigned long P) { int i; p4d_t *start, *p4d_start; pgprotval_t prot, eff; if (PTRS_PER_P4D == 1) - return walk_pud_level(m, st, __p4d(pgd_val(addr)), eff_in, P); + return walk_pud_level(st, __p4d(pgd_val(addr)), eff_in, P); p4d_start = start = (p4d_t *)pgd_page_vaddr(addr); @@ -491,13 +491,13 @@ static void walk_p4d_level(struct seq_file *m, struct pg_state *st, pgd_t addr, prot = p4d_flags(*start); eff = effective_prot(eff_in, prot); if (p4d_large(*start) || !p4d_present(*start)) { - note_page(m, st, __pgprot(prot), eff, 2); - } else if (!kasan_page_table(m, st, p4d_start)) { - walk_pud_level(m, st, *start, eff, + note_page(st, __pgprot(prot), eff, 2); + } else if (!kasan_page_table(st, p4d_start)) { + walk_pud_level(st, *start, eff, P + i * P4D_LEVEL_MULT); } } else - note_page(m, st, __pgprot(0), 0, 2); + note_page(st, __pgprot(0), 0, 2); start++; } @@ -534,6 +534,7 @@ static void ptdump_walk_pgd_level_core(struct seq_file *m, pgd_t *pgd, } st.check_wx = checkwx; + st.seq = m; if (checkwx) st.wx_pages = 0; @@ -547,13 +548,13 @@ static void ptdump_walk_pgd_level_core(struct seq_file *m, pgd_t *pgd, eff = prot; #endif if (pgd_large(*start) || !pgd_present(*start)) { - note_page(m, &st, __pgprot(prot), eff, 1); + note_page(&st, __pgprot(prot), eff, 1); } else { - walk_p4d_level(m, &st, *start, eff, + walk_p4d_level(&st, *start, eff, i * PGD_LEVEL_MULT); } } else - note_page(m, &st, __pgprot(0), 0, 1); + note_page(&st, __pgprot(0), 0, 1); cond_resched(); start++; @@ -561,7 +562,7 @@ static void ptdump_walk_pgd_level_core(struct seq_file *m, pgd_t *pgd, /* Flush out the last page */ st.current_address = normalize_addr(PTRS_PER_PGD*PGD_LEVEL_MULT); - note_page(m, &st, __pgprot(0), 0, 0); + note_page(&st, __pgprot(0), 0, 0); if (!checkwx) return; if (st.wx_pages) From patchwork Wed Feb 27 17:06:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831989 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AF5E01390 for ; Wed, 27 Feb 2019 17:08:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9839E2E305 for ; Wed, 27 Feb 2019 17:08:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C2262E341; Wed, 27 Feb 2019 17:08:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E2422E305 for ; Wed, 27 Feb 2019 17:08:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7ABB38E0022; Wed, 27 Feb 2019 12:08:28 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 736438E0001; Wed, 27 Feb 2019 12:08:28 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 587898E0022; Wed, 27 Feb 2019 12:08:28 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id F0FA08E0001 for ; Wed, 27 Feb 2019 12:08:27 -0500 (EST) Received: by mail-ed1-f71.google.com with SMTP id f11so5788989edd.2 for ; Wed, 27 Feb 2019 09:08:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=sR0SZrw+YPSbYFiP2a4kSO4+FoSeAg5NladWs9lGEmQ=; b=UigB6eIV3DHeOWTPY8sEP+by7Q7M5cb5t5CgjB2SctmnslPWe6MaKAa0U4K6Ca2ils DPEPYwO6kWAuQ3jPRirAYZPhFN6i3gQtmGKbRUTSm24k8XwIEuPzg1y9gOsu1yj2IgPT Sb1gDAfOVfNcXC3OQb5ecVk1Foq2G41HVpwC3kh7RLvKLKfFpVGwyuQ3sDaLolg0mktU /4glgouB5GK9/1NrQd5owbv1dEcv59WNJaxFMDHRFOlrrJytWJxlkEGOo9Ucwtvb7AdP V3j9dDVZqK0zvqaoli7aaFZrq0paoxNGAeKoezKWjkzVD0gFfzajh/DUOsEZgG7/4wEF BUSQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuYV3waLkBhOLdI4EQmkm9LNP8g4M1bp+uyc3R2vVx6vFKBUmD+b 9RvY0Gj36Yk/zf9/5SJxt2d3KMWJktonCO2am2RAma/0e9nL3un9hbHjgnA/wUtA2a5z0tjJsBM W5okgoxrL6m4tm8Gx53D0jUjDGpg7TUPB93JgbpkwnJHa0k10YyPCFJOM0hewG/XCOQ== X-Received: by 2002:a17:906:190f:: with SMTP id a15mr2249667eje.231.1551287307475; Wed, 27 Feb 2019 09:08:27 -0800 (PST) X-Google-Smtp-Source: AHgI3IZyVs2hJ6IMyDT2R/Ef23zc9P4tOJbCIEJLvZ98Gp45xAwWjfhymABhBm5DbM1G5WwiXuTb X-Received: by 2002:a17:906:190f:: with SMTP id a15mr2249599eje.231.1551287306332; Wed, 27 Feb 2019 09:08:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287306; cv=none; d=google.com; s=arc-20160816; b=t3k6jJmiJxu5hnwpfMXA4LrXEpa5z69QmuKTup0oIpMgirFT16CrlGUmGInpgJFJTI TdNJxrDp2w6gxsL/RDlE8c1fMsDfFpJt4+OwitVxU54eprRaL8TeGcrQxTbEaxdIk56Y hrIBdhT2Kr6UuZFTx069EzhLlJKHoZZoUdha3C9+AI4qyy+yJcFMZkcWPPisvlXt27In 9ocJjtRigUzcgoYgp0lRdtmZOQhcM57Sz3VzLYSmiaWqpcz2nKLo+XA8AbOY6Ohp+XsX M3bUseCRrY4qnWnlKy0dgKzwGToJurBZ7o11mY8W6pRY3FZ64sMTZpk6Cc0m/Gj/F4gV COtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=sR0SZrw+YPSbYFiP2a4kSO4+FoSeAg5NladWs9lGEmQ=; b=pkx3GLl4N9TF2/kR6bIBItgn61oJtNIfTko0rzR1PT0s9s4fHbUJoPeg9zsaCBREov HMiwh9WDq/axHiHwsFY4ABsYbdzm24Q4DR1v95ZlUB7kBmXBe0Gmjwsqx1sKLaEdat03 as3yu4Q5rWGKkR/qbnEp3efpispsJoCXjUfJfeh+jfZkvD0eDL6bJSFdt9XXvZC54np5 aaXxisWHQDnUjOjteiNJ3L4ORcolP6/TvhYP27JVI/5auPtJ70QSADnypPvB+JV8W6ql vMljfi1ItjPk9A8zSsRcg8WrJQxeYLUh35tAJRfYjibW40osNBvcCpAn8unTcnVhiVJj 9uPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id k56si797987eda.180.2019.02.27.09.08.25 for ; Wed, 27 Feb 2019 09:08:26 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 42BE51715; Wed, 27 Feb 2019 09:08:25 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 07FAC3F738; Wed, 27 Feb 2019 09:08:21 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" Subject: [PATCH v3 31/34] x86/mm+efi: Convert ptdump_walk_pgd_level() to take a mm_struct Date: Wed, 27 Feb 2019 17:06:05 +0000 Message-Id: <20190227170608.27963-32-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP To enable x86 to use the generic walk_page_range() function, the callers of ptdump_walk_pgd_level() need to pass an mm_struct rather than the raw pgd_t pointer. Luckily since commit 7e904a91bf60 ("efi: Use efi_mm in x86 as well as ARM") we now have an mm_struct for EFI on x86. Signed-off-by: Steven Price --- arch/x86/include/asm/pgtable.h | 2 +- arch/x86/mm/dump_pagetables.c | 4 ++-- arch/x86/platform/efi/efi_32.c | 2 +- arch/x86/platform/efi/efi_64.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 1b854c64cc7d..def035fa230e 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -27,7 +27,7 @@ extern pgd_t early_top_pgt[PTRS_PER_PGD]; int __init __early_make_pgtable(unsigned long address, pmdval_t pmd); -void ptdump_walk_pgd_level(struct seq_file *m, pgd_t *pgd); +void ptdump_walk_pgd_level(struct seq_file *m, struct mm_struct *mm); void ptdump_walk_pgd_level_debugfs(struct seq_file *m, pgd_t *pgd, bool user); void ptdump_walk_pgd_level_checkwx(void); void ptdump_walk_user_pgd_level_checkwx(void); diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c index ecbaf30a6a2f..3a8cf6699976 100644 --- a/arch/x86/mm/dump_pagetables.c +++ b/arch/x86/mm/dump_pagetables.c @@ -572,9 +572,9 @@ static void ptdump_walk_pgd_level_core(struct seq_file *m, pgd_t *pgd, pr_info("x86/mm: Checked W+X mappings: passed, no W+X pages found.\n"); } -void ptdump_walk_pgd_level(struct seq_file *m, pgd_t *pgd) +void ptdump_walk_pgd_level(struct seq_file *m, struct mm_struct *mm) { - ptdump_walk_pgd_level_core(m, pgd, false, true); + ptdump_walk_pgd_level_core(m, mm->pgd, false, true); } void ptdump_walk_pgd_level_debugfs(struct seq_file *m, pgd_t *pgd, bool user) diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c index 9959657127f4..9175ceaa6e72 100644 --- a/arch/x86/platform/efi/efi_32.c +++ b/arch/x86/platform/efi/efi_32.c @@ -49,7 +49,7 @@ void efi_sync_low_kernel_mappings(void) {} void __init efi_dump_pagetable(void) { #ifdef CONFIG_EFI_PGT_DUMP - ptdump_walk_pgd_level(NULL, swapper_pg_dir); + ptdump_walk_pgd_level(NULL, init_mm); #endif } diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index cf0347f61b21..a2e0f9800190 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c @@ -611,9 +611,9 @@ void __init efi_dump_pagetable(void) { #ifdef CONFIG_EFI_PGT_DUMP if (efi_enabled(EFI_OLD_MEMMAP)) - ptdump_walk_pgd_level(NULL, swapper_pg_dir); + ptdump_walk_pgd_level(NULL, init_mm); else - ptdump_walk_pgd_level(NULL, efi_mm.pgd); + ptdump_walk_pgd_level(NULL, efi_mm); #endif } From patchwork Wed Feb 27 17:06:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831991 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 94E1615AC for ; Wed, 27 Feb 2019 17:08:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7DC392E305 for ; Wed, 27 Feb 2019 17:08:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71DAA2E31F; Wed, 27 Feb 2019 17:08:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB0FF2E305 for ; Wed, 27 Feb 2019 17:08:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D9DD58E0023; Wed, 27 Feb 2019 12:08:31 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D760C8E0001; Wed, 27 Feb 2019 12:08:31 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C65E38E0023; Wed, 27 Feb 2019 12:08:31 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id 6B9E88E0001 for ; Wed, 27 Feb 2019 12:08:31 -0500 (EST) Received: by mail-ed1-f69.google.com with SMTP id j5so7175523edt.17 for ; Wed, 27 Feb 2019 09:08:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=OsM61sR7KtxeUBiEjMTBAbQYMmMZy1tlMKtG+lRZsQM=; b=eAOXngFWE3fNPotLDsNh0jkucl58Ez8K6+24P0zgJ+2Lj3C99J0T0LXItN9Vhh9zDz m1sJvhwXpHIn/UNKNjmLfME/+deg1BmiHQ+Z3kUd7J+g5YaEjTaa07uH97em7TWGXq93 DpMl8Szlh/hP9KyZ3beTNqm2roZSkU3R/A691N5NrjhPxZA4tS0I7bc/ehnslxKTOQBz /4XX7vhwAxo1JVyzafN63aieNsbgo6mSGQszwl416U3kebAP+BdHWKrp0V52JkqlRuO7 CRB18UwgUbtvKH6vBtqNoY49xKrEGL5/zC0jPdiftzQz0qFMFgp35QKeJL22KtCfrd45 Pojw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuYPgIrxKRt8mHG1wZc1HmYS2v0jSBIpXziUxr2wpONMfFaQE0gE pZ4kHD/qP+HEFXokwTeyAsR+7sPkigFjx7gjTCMyESSY5ecRwfEpVXmvK7QMWhJ51wwb67JQSs9 X1uifzaSg4Es82uK2/uSkKg9Obdw8dz3zRM0Ct74G6SQyp76PHGAWtRXvlRo7ogWj0Q== X-Received: by 2002:a50:b819:: with SMTP id j25mr3143063ede.77.1551287310911; Wed, 27 Feb 2019 09:08:30 -0800 (PST) X-Google-Smtp-Source: AHgI3IYl1rfZmgYz7ionBgKdJbXKpswOW+TylWOuu16AMlTpyvsoFL3GcvrI5sn23Ml7N31qtZuE X-Received: by 2002:a50:b819:: with SMTP id j25mr3142998ede.77.1551287309807; Wed, 27 Feb 2019 09:08:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287309; cv=none; d=google.com; s=arc-20160816; b=IVrSo/fBI6i1F5mxLjHoLEPD0UEUorC8SCTln3bx37p/fRKMU1qKrkPagoZtGYAMl5 G3a34FQf1PS39YQYVRM/Bkyt/JXAMrVLt+dg89QqTxjpcZZra9Kwbrs02wQvmnPZrQQZ 467UzSCKoxI2IFhBAn3OevNULi60l6a3UZL7LisBCZUHWE5QaKOK4neaVwEfJRTfUVgz 1pr3bcK7yUlkuYky+arSyNvt8hZ5Evr/wybndmqWO0hLOl49BwxOQJFGzJ2nyiQ81lCO hTy6N15G85b2UbZYXhmZoKY1S0VglOJcLtf79+ml3/TQL4Xz7CxHKp+dc8wop4KHWeyt +ypQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=OsM61sR7KtxeUBiEjMTBAbQYMmMZy1tlMKtG+lRZsQM=; b=dRMrcx8MQq96M8TeWbxaSpYdjHK3SBoVyccNgB09mcdivFSZprxcq52o3HBPUsL25S CHKR4W8zB9f01ZHAbO0IoPR0yUD/81fWlmlyeGlckNpSWWJmslK26HbYoEGeYkYpR6le svv14lNdhGD8STC9FohOENc05JiHqTC8v/3r9GApAsuSGp7qFwZ2bYpEdQOHFOh2kyBC 2hm5jaS+Ge5eldXhRbylumFK7AbcMn8XUD8V/8HW8JEbNIKcmr1J1Su48wXrs3lghdDx mx2IK9znLiUM5RDDbsJhjVwJdZBBVXMVuXXjHgYR/bv46DT7jD64eP8Ju3uLyRIsrZ5t 6Z1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id s40si22714eda.158.2019.02.27.09.08.29 for ; Wed, 27 Feb 2019 09:08:29 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BD0021A25; Wed, 27 Feb 2019 09:08:28 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 81F613F738; Wed, 27 Feb 2019 09:08:25 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" Subject: [PATCH v3 32/34] x86/mm: Convert ptdump_walk_pgd_level_debugfs() to take an mm_struct Date: Wed, 27 Feb 2019 17:06:06 +0000 Message-Id: <20190227170608.27963-33-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP To enable x86 to use the generic walk_page_range() function, the callers of ptdump_walk_pgd_level_debugfs() need to pass in the mm_struct. This means that ptdump_walk_pgd_level_core() is now always passed a valid pgd, so drop the support for pgd==NULL. Signed-off-by: Steven Price --- arch/x86/include/asm/pgtable.h | 3 ++- arch/x86/mm/debug_pagetables.c | 8 ++++---- arch/x86/mm/dump_pagetables.c | 14 ++++++-------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index def035fa230e..d6d919a20aac 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -28,7 +28,8 @@ extern pgd_t early_top_pgt[PTRS_PER_PGD]; int __init __early_make_pgtable(unsigned long address, pmdval_t pmd); void ptdump_walk_pgd_level(struct seq_file *m, struct mm_struct *mm); -void ptdump_walk_pgd_level_debugfs(struct seq_file *m, pgd_t *pgd, bool user); +void ptdump_walk_pgd_level_debugfs(struct seq_file *m, struct mm_struct *mm, + bool user); void ptdump_walk_pgd_level_checkwx(void); void ptdump_walk_user_pgd_level_checkwx(void); diff --git a/arch/x86/mm/debug_pagetables.c b/arch/x86/mm/debug_pagetables.c index cd84f067e41d..824131052574 100644 --- a/arch/x86/mm/debug_pagetables.c +++ b/arch/x86/mm/debug_pagetables.c @@ -6,7 +6,7 @@ static int ptdump_show(struct seq_file *m, void *v) { - ptdump_walk_pgd_level_debugfs(m, NULL, false); + ptdump_walk_pgd_level_debugfs(m, &init_mm, false); return 0; } @@ -16,7 +16,7 @@ static int ptdump_curknl_show(struct seq_file *m, void *v) { if (current->mm->pgd) { down_read(¤t->mm->mmap_sem); - ptdump_walk_pgd_level_debugfs(m, current->mm->pgd, false); + ptdump_walk_pgd_level_debugfs(m, current->mm, false); up_read(¤t->mm->mmap_sem); } return 0; @@ -31,7 +31,7 @@ static int ptdump_curusr_show(struct seq_file *m, void *v) { if (current->mm->pgd) { down_read(¤t->mm->mmap_sem); - ptdump_walk_pgd_level_debugfs(m, current->mm->pgd, true); + ptdump_walk_pgd_level_debugfs(m, current->mm, true); up_read(¤t->mm->mmap_sem); } return 0; @@ -46,7 +46,7 @@ static struct dentry *pe_efi; static int ptdump_efi_show(struct seq_file *m, void *v) { if (efi_mm.pgd) - ptdump_walk_pgd_level_debugfs(m, efi_mm.pgd, false); + ptdump_walk_pgd_level_debugfs(m, &efi_mm, false); return 0; } diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c index 3a8cf6699976..fb4b9212cae5 100644 --- a/arch/x86/mm/dump_pagetables.c +++ b/arch/x86/mm/dump_pagetables.c @@ -523,16 +523,12 @@ static inline bool is_hypervisor_range(int idx) static void ptdump_walk_pgd_level_core(struct seq_file *m, pgd_t *pgd, bool checkwx, bool dmesg) { - pgd_t *start = INIT_PGD; + pgd_t *start = pgd; pgprotval_t prot, eff; int i; struct pg_state st = {}; - if (pgd) { - start = pgd; - st.to_dmesg = dmesg; - } - + st.to_dmesg = dmesg; st.check_wx = checkwx; st.seq = m; if (checkwx) @@ -577,8 +573,10 @@ void ptdump_walk_pgd_level(struct seq_file *m, struct mm_struct *mm) ptdump_walk_pgd_level_core(m, mm->pgd, false, true); } -void ptdump_walk_pgd_level_debugfs(struct seq_file *m, pgd_t *pgd, bool user) +void ptdump_walk_pgd_level_debugfs(struct seq_file *m, struct mm_struct *mm, + bool user) { + pgd_t *pgd = mm->pgd; #ifdef CONFIG_PAGE_TABLE_ISOLATION if (user && static_cpu_has(X86_FEATURE_PTI)) pgd = kernel_to_user_pgdp(pgd); @@ -604,7 +602,7 @@ void ptdump_walk_user_pgd_level_checkwx(void) void ptdump_walk_pgd_level_checkwx(void) { - ptdump_walk_pgd_level_core(NULL, NULL, true, false); + ptdump_walk_pgd_level_core(NULL, INIT_PGD, true, false); } static int __init pt_dump_init(void) From patchwork Wed Feb 27 17:06:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831993 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CAA4315AC for ; Wed, 27 Feb 2019 17:08:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B27352E305 for ; Wed, 27 Feb 2019 17:08:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A42E72E31F; Wed, 27 Feb 2019 17:08:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2310D2E305 for ; Wed, 27 Feb 2019 17:08:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 64B018E0024; Wed, 27 Feb 2019 12:08:35 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 601108E0001; Wed, 27 Feb 2019 12:08:35 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4510B8E0024; Wed, 27 Feb 2019 12:08:35 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id DDD0F8E0001 for ; Wed, 27 Feb 2019 12:08:34 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id f2so7103699edm.18 for ; Wed, 27 Feb 2019 09:08:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ifS9dvr6iRq4OG1WYTg+vUcyWqkssZWOaBwfUmU1Gxs=; b=NwrpTkK+rqIhW9aSrnwBXuOQcUByjyQaaVNbblGigXHfTji+UtwEd7jyaP8RrDnsla moSgjrdoxFoJ8Zld2x7EtezHwfA95HpSm6KGtSbMy/zbkOHT0hb4dPyKf27Nbx4myHR0 iMpkkeHU8ICxebrTFSmcvRYpzbj2ZLDXxEJyTf6M3YOzYXabThZYO1bbBywwZw3jPaMn 93q5GXrmGc9obEY29sNGd/FiSQMhF9kmI6dllGH2Ad0UYrabfy7LhyVdFicABZnBNIg5 SfR7euuYrlap2BHSyRoD6/OtU60UtdurhXjM6UV+tsb55o/upbqoc6Ajb6JCk/j3eL8W XWLA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAua3Qv6fIP0x0QnFtBgPQbv2jlohnnT8CX5u3Blo/mU793ki45FA KB9t4zkHnbfXqiF9+bzCYNRgEcSa+Bbnpvr6solW1rBh09FpXMxW/5TNu3YQmDKp/3Of0n3Nw0h MHvcVXqNbLa7XYWKk6/rkwZ2bOQw2PmKkhzHPZ9Ed388KrBe8xe6/WW7Y4p4VRsrdag== X-Received: by 2002:a50:8916:: with SMTP id e22mr3207578ede.242.1551287314394; Wed, 27 Feb 2019 09:08:34 -0800 (PST) X-Google-Smtp-Source: AHgI3IZkje2r03+lE0lrNPYLsmnAWOCVx+oJGv7YqWxDZujWmfBoLgygw9P4JBlghw8HVt96E0QV X-Received: by 2002:a50:8916:: with SMTP id e22mr3207519ede.242.1551287313347; Wed, 27 Feb 2019 09:08:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287313; cv=none; d=google.com; s=arc-20160816; b=w9axnNB4ilknWRtzSRHnNbfab2kbV2oFL8+xfguJfEE59luzvTvp00YohpvU7LDsGt 0PYMKkOsJe5K7GZOT9xOl99qRCZGxDj6C5dSYAbo+gJRoVR5qmLr9UntHCFnjL7VyNuj Ouftiu50fuHFB8tMyvqo5Cv23e++UoBddf1NeJbcebJ5HrCbs1hz25RhfdtadL9MyVCI WLALJ1I1OlRpu2GRXkWQ7RYG8s2XufXn1+U4A6EPVDYukehfROjcZYjhYiE2N4jWjRHi 2iGIE3EN0xk2WYdp87mTXHfiAPpgZk8UCOkPjYMiV/v6kneELpqYAemoYXXaXR+ZfDXU gw9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=ifS9dvr6iRq4OG1WYTg+vUcyWqkssZWOaBwfUmU1Gxs=; b=yweqO0DFxmI+bEFbudKPCFCIme/YGEa2azNSxInYE+D2TULi6vCaL0Z69n2d1pHyxV tCW+WzBDPDuDUhN+qECN3uK16VV2ouudoZiDznsx9yt+51L15xaIE9NB03/MQHRbP1WH DGnAOwn3K8945n2l6F0RiPQFuCyYXMAqMtNRSxj3zuUCzf4vtTuO4JMfCIO1dO/GT/6b R3mIeCcmgkbTQWdLnTNtzLQ2vzGTm303d4PmmgcDXQxg3/ILMivoZxoaehI3RQAPVxpY bRblOVOCND96fCMI4pOet8SzO9wQM0Xa9Rd7j3Pda+cdGPUE0fbyV0lEVVc7H9xgWN+r HuxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id y2si168860ejw.302.2019.02.27.09.08.32 for ; Wed, 27 Feb 2019 09:08:33 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 43FFEA78; Wed, 27 Feb 2019 09:08:32 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 089B63F738; Wed, 27 Feb 2019 09:08:28 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" Subject: [PATCH v3 33/34] x86/mm: Convert ptdump_walk_pgd_level_core() to take an mm_struct Date: Wed, 27 Feb 2019 17:06:07 +0000 Message-Id: <20190227170608.27963-34-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP An mm_struct is needed to enable x86 to use of the generic walk_page_range() function. In the case of walking the user page tables (when CONFIG_PAGE_TABLE_ISOLATION is enabled), it is necessary to create a fake_mm structure because there isn't an mm_struct with a pointer to the pgd of the user page tables. This fake_mm structure is initialised with the minimum necessary for the generic page walk code. Signed-off-by: Steven Price --- arch/x86/mm/dump_pagetables.c | 36 ++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c index fb4b9212cae5..40a8b0da2170 100644 --- a/arch/x86/mm/dump_pagetables.c +++ b/arch/x86/mm/dump_pagetables.c @@ -111,8 +111,6 @@ static struct addr_marker address_markers[] = { [END_OF_SPACE_NR] = { -1, NULL } }; -#define INIT_PGD ((pgd_t *) &init_top_pgt) - #else /* CONFIG_X86_64 */ enum address_markers_idx { @@ -147,8 +145,6 @@ static struct addr_marker address_markers[] = { [END_OF_SPACE_NR] = { -1, NULL } }; -#define INIT_PGD (swapper_pg_dir) - #endif /* !CONFIG_X86_64 */ /* Multipliers for offsets within the PTEs */ @@ -520,10 +516,10 @@ static inline bool is_hypervisor_range(int idx) #endif } -static void ptdump_walk_pgd_level_core(struct seq_file *m, pgd_t *pgd, +static void ptdump_walk_pgd_level_core(struct seq_file *m, struct mm_struct *mm, bool checkwx, bool dmesg) { - pgd_t *start = pgd; + pgd_t *start = mm->pgd; pgprotval_t prot, eff; int i; struct pg_state st = {}; @@ -570,39 +566,49 @@ static void ptdump_walk_pgd_level_core(struct seq_file *m, pgd_t *pgd, void ptdump_walk_pgd_level(struct seq_file *m, struct mm_struct *mm) { - ptdump_walk_pgd_level_core(m, mm->pgd, false, true); + ptdump_walk_pgd_level_core(m, mm, false, true); } +#ifdef CONFIG_PAGE_TABLE_ISOLATION +static void ptdump_walk_pgd_level_user_core(struct seq_file *m, + struct mm_struct *mm, + bool checkwx, bool dmesg) +{ + struct mm_struct fake_mm = { + .pgd = kernel_to_user_pgdp(mm->pgd) + }; + init_rwsem(&fake_mm.mmap_sem); + ptdump_walk_pgd_level_core(m, &fake_mm, checkwx, dmesg); +} +#endif + void ptdump_walk_pgd_level_debugfs(struct seq_file *m, struct mm_struct *mm, bool user) { - pgd_t *pgd = mm->pgd; #ifdef CONFIG_PAGE_TABLE_ISOLATION if (user && static_cpu_has(X86_FEATURE_PTI)) - pgd = kernel_to_user_pgdp(pgd); + ptdump_walk_pgd_level_user_core(m, mm, false, false); + else #endif - ptdump_walk_pgd_level_core(m, pgd, false, false); + ptdump_walk_pgd_level_core(m, mm, false, false); } EXPORT_SYMBOL_GPL(ptdump_walk_pgd_level_debugfs); void ptdump_walk_user_pgd_level_checkwx(void) { #ifdef CONFIG_PAGE_TABLE_ISOLATION - pgd_t *pgd = INIT_PGD; - if (!(__supported_pte_mask & _PAGE_NX) || !static_cpu_has(X86_FEATURE_PTI)) return; pr_info("x86/mm: Checking user space page tables\n"); - pgd = kernel_to_user_pgdp(pgd); - ptdump_walk_pgd_level_core(NULL, pgd, true, false); + ptdump_walk_pgd_level_user_core(NULL, &init_mm, true, false); #endif } void ptdump_walk_pgd_level_checkwx(void) { - ptdump_walk_pgd_level_core(NULL, INIT_PGD, true, false); + ptdump_walk_pgd_level_core(NULL, &init_mm, true, false); } static int __init pt_dump_init(void) From patchwork Wed Feb 27 17:06:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Price X-Patchwork-Id: 10831997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F1D101880 for ; Wed, 27 Feb 2019 17:08:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D891C2E305 for ; Wed, 27 Feb 2019 17:08:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC6C22E31F; Wed, 27 Feb 2019 17:08:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7B662E305 for ; Wed, 27 Feb 2019 17:08:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3DBEB8E0005; Wed, 27 Feb 2019 12:08:39 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 38AB48E0001; Wed, 27 Feb 2019 12:08:39 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 203D18E0005; Wed, 27 Feb 2019 12:08:39 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id B90738E0001 for ; Wed, 27 Feb 2019 12:08:38 -0500 (EST) Received: by mail-ed1-f72.google.com with SMTP id i22so7224829eds.20 for ; Wed, 27 Feb 2019 09:08:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=7zRf+PErY3OfSw8vvNQmBFXyOY+/7g+ZkyX+8QL9LAI=; b=dsXnzlZYklIoUmmxSqGJfWlLwFmabAqDgHo8jyY+T+IICM8zMoxGl2Pk8i3X5n7vsq ZoS5wH6S0by4TsEwoOiOyRJXgxsGQaWi7GyRTDKrdbOrPiCUggWShF9iC1askfl9/9rT MZmMQMIdk3HhOCati8KM5/Kdyj1/z0Bz8WaJJavuulir2ND1lWFGbQipi6cPVIJBd/J7 pka3Gl2w62VA0YWPfYkKGi3ftbBxIaXnNIKiM7EIfvOynXF+hDLlHymFCgoHgFDd9kM3 Pqllkq5CIBDXMhGez1HsaTJFg81V8+oTyPGZfCEEHDX3DsQqx/+MnXaNSiOlojIl4mxV 2OtA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com X-Gm-Message-State: AHQUAuZD64G7NYA2mEsIayJ86ewrpcSL0/ycfCifcqiOgjk2wh9XP719 NGrhXz21SDM0/gCfC6h2KS9Qu9buxX4ywGwt3OUbqzSJgOV6QjvgicXpFJvuFzXGSifl0m3Md6P k4M1ToUpY/mB/mFUmLSFEtzGsabcRnOgA07nvwt1owJkdK191zPHmyHgrteHJ3P4CfA== X-Received: by 2002:a17:906:f53:: with SMTP id h19mr2293142ejj.188.1551287318227; Wed, 27 Feb 2019 09:08:38 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibno3JJoZ7iJBQxA+IEw2nYMpUY0lrgIREm5mRV0PihTiat8U3Dje8N8XISr/cV7BtXRtaT X-Received: by 2002:a17:906:f53:: with SMTP id h19mr2293068ejj.188.1551287316862; Wed, 27 Feb 2019 09:08:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551287316; cv=none; d=google.com; s=arc-20160816; b=edlacTydNVhXOqcWVyLw5RgndvzM7ynx5tFcKqJbUV0+1h/4hveNryTiYkDeSGIY3/ oeT3GXQF2Caxss1dYqHWhitqBAhYiKB9xIw02oC9iaXw23rWAeLyQB3+GMoOirGgLfQJ VFRRPE21NgxwkDMJoWwap/LeK+o/joNpdSNafX4S+lEagCrUGIQYMztQqTmyRx7zpC0o JGSxXl9anI2vPqSxxwPcmPza24H6FlY6mntlv1ZqbHPamZ/SiFUlb+CQwPnPrSOCJbLg mYyF3tjuucwFduEcGpK19vry0EFKywAlhljglRS6iAGKU6zm58K3toBm507AOnAnIdkh 2VGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=7zRf+PErY3OfSw8vvNQmBFXyOY+/7g+ZkyX+8QL9LAI=; b=1Heg2W1R/Tx1ZjF8mmZEE6Za1uiQejo+gmd8b+kqCWRk1GySv/87s66SFhtwq4bhrq +ioT6j+VztlHAOWorVNvuSDJj4t/iv57H4jJP3esjeA3yZGfGrhmOv2QW/uJeYAh57Zv G7jHt6uApqjXBZcFWuRl1Fyu7E7jOyMv4Uk5ymqLS8PVDf1ZsVU7Zmt+Rx0w0mKlAaY4 +FZkXa1mKEGGZwA8t/TqKdd2BGsur443vnctZGCSOeDB2ykN6ntnMgey1+1+hoiSKYmw bYt/8xJo+w6myVm91G19vJQ6LtVnrYrXShgNgKXg2gzqbT/TD2UaMhh2vSJvICdZ2goi HXaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id t38si4775705eda.121.2019.02.27.09.08.36 for ; Wed, 27 Feb 2019 09:08:36 -0800 (PST) Received-SPF: pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steven.price@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steven.price@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BF11A1715; Wed, 27 Feb 2019 09:08:35 -0800 (PST) Received: from e112269-lin.arm.com (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 838A53F738; Wed, 27 Feb 2019 09:08:32 -0800 (PST) From: Steven Price To: linux-mm@kvack.org Cc: Steven Price , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Dave Hansen , Ingo Molnar , James Morse , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Peter Zijlstra , Thomas Gleixner , Will Deacon , x86@kernel.org, "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , "Liang, Kan" Subject: [PATCH v3 34/34] x86: mm: Convert dump_pagetables to use walk_page_range Date: Wed, 27 Feb 2019 17:06:08 +0000 Message-Id: <20190227170608.27963-35-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227170608.27963-1-steven.price@arm.com> References: <20190227170608.27963-1-steven.price@arm.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Make use of the new functionality in walk_page_range to remove the arch page walking code and use the generic code to walk the page tables. The effective permissions are passed down the chain using new fields in struct pg_state. The KASAN optimisation is implemented by including test_p?d callbacks which can decide to skip an entire tree of entries Signed-off-by: Steven Price --- arch/x86/mm/dump_pagetables.c | 279 ++++++++++++++++++---------------- 1 file changed, 146 insertions(+), 133 deletions(-) diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c index 40a8b0da2170..64d1619493a4 100644 --- a/arch/x86/mm/dump_pagetables.c +++ b/arch/x86/mm/dump_pagetables.c @@ -33,6 +33,10 @@ struct pg_state { int level; pgprot_t current_prot; pgprotval_t effective_prot; + pgprotval_t effective_prot_pgd; + pgprotval_t effective_prot_p4d; + pgprotval_t effective_prot_pud; + pgprotval_t effective_prot_pmd; unsigned long start_address; unsigned long current_address; const struct addr_marker *marker; @@ -355,22 +359,21 @@ static inline pgprotval_t effective_prot(pgprotval_t prot1, pgprotval_t prot2) ((prot1 | prot2) & _PAGE_NX); } -static void walk_pte_level(struct pg_state *st, pmd_t addr, pgprotval_t eff_in, - unsigned long P) +static int ptdump_pte_entry(pte_t *pte, unsigned long addr, + unsigned long next, struct mm_walk *walk) { - int i; - pte_t *pte; - pgprotval_t prot, eff; - - for (i = 0; i < PTRS_PER_PTE; i++) { - st->current_address = normalize_addr(P + i * PTE_LEVEL_MULT); - pte = pte_offset_map(&addr, st->current_address); - prot = pte_flags(*pte); - eff = effective_prot(eff_in, prot); - note_page(st, __pgprot(prot), eff, 5); - pte_unmap(pte); - } + struct pg_state *st = walk->private; + pgprotval_t eff, prot; + + st->current_address = normalize_addr(addr); + + prot = pte_flags(*pte); + eff = effective_prot(st->effective_prot_pmd, prot); + note_page(st, __pgprot(prot), eff, 5); + + return 0; } + #ifdef CONFIG_KASAN /* @@ -399,130 +402,152 @@ static inline bool kasan_page_table(struct pg_state *st, void *pt) } #endif -#if PTRS_PER_PMD > 1 - -static void walk_pmd_level(struct pg_state *st, pud_t addr, - pgprotval_t eff_in, unsigned long P) +static int ptdump_test_pmd(unsigned long addr, unsigned long next, + pmd_t *pmd, struct mm_walk *walk) { - int i; - pmd_t *start, *pmd_start; - pgprotval_t prot, eff; - - pmd_start = start = (pmd_t *)pud_page_vaddr(addr); - for (i = 0; i < PTRS_PER_PMD; i++) { - st->current_address = normalize_addr(P + i * PMD_LEVEL_MULT); - if (!pmd_none(*start)) { - prot = pmd_flags(*start); - eff = effective_prot(eff_in, prot); - if (pmd_large(*start) || !pmd_present(*start)) { - note_page(st, __pgprot(prot), eff, 4); - } else if (!kasan_page_table(st, pmd_start)) { - walk_pte_level(st, *start, eff, - P + i * PMD_LEVEL_MULT); - } - } else - note_page(st, __pgprot(0), 0, 4); - start++; - } + struct pg_state *st = walk->private; + + st->current_address = normalize_addr(addr); + + if (kasan_page_table(st, pmd)) + return 1; + return 0; } -#else -#define walk_pmd_level(s,a,e,p) walk_pte_level(s,__pmd(pud_val(a)),e,p) -#define pud_large(a) pmd_large(__pmd(pud_val(a))) -#define pud_none(a) pmd_none(__pmd(pud_val(a))) -#endif +static int ptdump_pmd_entry(pmd_t *pmd, unsigned long addr, + unsigned long next, struct mm_walk *walk) +{ + struct pg_state *st = walk->private; + pgprotval_t eff, prot; + + prot = pmd_flags(*pmd); + eff = effective_prot(st->effective_prot_pud, prot); + + st->current_address = normalize_addr(addr); + + if (pmd_large(*pmd)) + note_page(st, __pgprot(prot), eff, 4); -#if PTRS_PER_PUD > 1 + st->effective_prot_pmd = eff; -static void walk_pud_level(struct pg_state *st, p4d_t addr, pgprotval_t eff_in, - unsigned long P) + return 0; +} + +static int ptdump_test_pud(unsigned long addr, unsigned long next, + pud_t *pud, struct mm_walk *walk) { - int i; - pud_t *start, *pud_start; - pgprotval_t prot, eff; - pud_t *prev_pud = NULL; - - pud_start = start = (pud_t *)p4d_page_vaddr(addr); - - for (i = 0; i < PTRS_PER_PUD; i++) { - st->current_address = normalize_addr(P + i * PUD_LEVEL_MULT); - if (!pud_none(*start)) { - prot = pud_flags(*start); - eff = effective_prot(eff_in, prot); - if (pud_large(*start) || !pud_present(*start)) { - note_page(st, __pgprot(prot), eff, 3); - } else if (!kasan_page_table(st, pud_start)) { - walk_pmd_level(st, *start, eff, - P + i * PUD_LEVEL_MULT); - } - } else - note_page(st, __pgprot(0), 0, 3); + struct pg_state *st = walk->private; - prev_pud = start; - start++; - } + st->current_address = normalize_addr(addr); + + if (kasan_page_table(st, pud)) + return 1; + return 0; } -#else -#define walk_pud_level(s,a,e,p) walk_pmd_level(s,__pud(p4d_val(a)),e,p) -#define p4d_large(a) pud_large(__pud(p4d_val(a))) -#define p4d_none(a) pud_none(__pud(p4d_val(a))) -#endif +static int ptdump_pud_entry(pud_t *pud, unsigned long addr, + unsigned long next, struct mm_walk *walk) +{ + struct pg_state *st = walk->private; + pgprotval_t eff, prot; + + prot = pud_flags(*pud); + eff = effective_prot(st->effective_prot_p4d, prot); + + st->current_address = normalize_addr(addr); + + if (pud_large(*pud)) + note_page(st, __pgprot(prot), eff, 3); + + st->effective_prot_pud = eff; -static void walk_p4d_level(struct pg_state *st, pgd_t addr, pgprotval_t eff_in, - unsigned long P) + return 0; +} + +static int ptdump_test_p4d(unsigned long addr, unsigned long next, + p4d_t *p4d, struct mm_walk *walk) { - int i; - p4d_t *start, *p4d_start; - pgprotval_t prot, eff; - - if (PTRS_PER_P4D == 1) - return walk_pud_level(st, __p4d(pgd_val(addr)), eff_in, P); - - p4d_start = start = (p4d_t *)pgd_page_vaddr(addr); - - for (i = 0; i < PTRS_PER_P4D; i++) { - st->current_address = normalize_addr(P + i * P4D_LEVEL_MULT); - if (!p4d_none(*start)) { - prot = p4d_flags(*start); - eff = effective_prot(eff_in, prot); - if (p4d_large(*start) || !p4d_present(*start)) { - note_page(st, __pgprot(prot), eff, 2); - } else if (!kasan_page_table(st, p4d_start)) { - walk_pud_level(st, *start, eff, - P + i * P4D_LEVEL_MULT); - } - } else - note_page(st, __pgprot(0), 0, 2); + struct pg_state *st = walk->private; - start++; - } + st->current_address = normalize_addr(addr); + + if (kasan_page_table(st, p4d)) + return 1; + return 0; } -#define pgd_large(a) (pgtable_l5_enabled() ? pgd_large(a) : p4d_large(__p4d(pgd_val(a)))) -#define pgd_none(a) (pgtable_l5_enabled() ? pgd_none(a) : p4d_none(__p4d(pgd_val(a)))) +static int ptdump_p4d_entry(p4d_t *p4d, unsigned long addr, + unsigned long next, struct mm_walk *walk) +{ + struct pg_state *st = walk->private; + pgprotval_t eff, prot; + + prot = p4d_flags(*p4d); + eff = effective_prot(st->effective_prot_pgd, prot); + + st->current_address = normalize_addr(addr); + + if (p4d_large(*p4d)) + note_page(st, __pgprot(prot), eff, 2); + + st->effective_prot_p4d = eff; + + return 0; +} -static inline bool is_hypervisor_range(int idx) +static int ptdump_pgd_entry(pgd_t *pgd, unsigned long addr, + unsigned long next, struct mm_walk *walk) { -#ifdef CONFIG_X86_64 - /* - * A hole in the beginning of kernel address space reserved - * for a hypervisor. - */ - return (idx >= pgd_index(GUARD_HOLE_BASE_ADDR)) && - (idx < pgd_index(GUARD_HOLE_END_ADDR)); + struct pg_state *st = walk->private; + pgprotval_t eff, prot; + + prot = pgd_flags(*pgd); + +#ifdef CONFIG_X86_PAE + eff = _PAGE_USER | _PAGE_RW; #else - return false; + eff = prot; #endif + + st->current_address = normalize_addr(addr); + + if (pgd_large(*pgd)) + note_page(st, __pgprot(prot), eff, 1); + + st->effective_prot_pgd = eff; + + return 0; +} + +static int ptdump_hole(unsigned long addr, unsigned long next, int depth, + struct mm_walk *walk) +{ + struct pg_state *st = walk->private; + + st->current_address = normalize_addr(addr); + + note_page(st, __pgprot(0), 0, depth + 1); + + return 0; } static void ptdump_walk_pgd_level_core(struct seq_file *m, struct mm_struct *mm, bool checkwx, bool dmesg) { - pgd_t *start = mm->pgd; - pgprotval_t prot, eff; - int i; struct pg_state st = {}; + struct mm_walk walk = { + .mm = mm, + .pgd_entry = ptdump_pgd_entry, + .p4d_entry = ptdump_p4d_entry, + .pud_entry = ptdump_pud_entry, + .pmd_entry = ptdump_pmd_entry, + .pte_entry = ptdump_pte_entry, + .test_p4d = ptdump_test_p4d, + .test_pud = ptdump_test_pud, + .test_pmd = ptdump_test_pmd, + .pte_hole = ptdump_hole, + .private = &st + }; st.to_dmesg = dmesg; st.check_wx = checkwx; @@ -530,27 +555,15 @@ static void ptdump_walk_pgd_level_core(struct seq_file *m, struct mm_struct *mm, if (checkwx) st.wx_pages = 0; - for (i = 0; i < PTRS_PER_PGD; i++) { - st.current_address = normalize_addr(i * PGD_LEVEL_MULT); - if (!pgd_none(*start) && !is_hypervisor_range(i)) { - prot = pgd_flags(*start); -#ifdef CONFIG_X86_PAE - eff = _PAGE_USER | _PAGE_RW; + down_read(&mm->mmap_sem); +#ifdef CONFIG_X86_64 + walk_page_range(0, PTRS_PER_PGD*PGD_LEVEL_MULT/2, &walk); + walk_page_range(normalize_addr(PTRS_PER_PGD*PGD_LEVEL_MULT/2), ~0, + &walk); #else - eff = prot; + walk_page_range(0, ~0, &walk); #endif - if (pgd_large(*start) || !pgd_present(*start)) { - note_page(&st, __pgprot(prot), eff, 1); - } else { - walk_p4d_level(&st, *start, eff, - i * PGD_LEVEL_MULT); - } - } else - note_page(&st, __pgprot(0), 0, 1); - - cond_resched(); - start++; - } + up_read(&mm->mmap_sem); /* Flush out the last page */ st.current_address = normalize_addr(PTRS_PER_PGD*PGD_LEVEL_MULT);