Message ID | 20201108065758.1815-1-rppt@kernel.org (mailing list archive) |
---|---|
Headers | show
Return-Path: <SRS0=dXdu=EO=lists.infradead.org=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@kernel.org> Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 596F114C0 for <patchwork-linux-riscv@patchwork.kernel.org>; Sun, 8 Nov 2020 06:59:04 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1538820897 for <patchwork-linux-riscv@patchwork.kernel.org>; Sun, 8 Nov 2020 06:59:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SnX2HV/z"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="vEcjSbJx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1538820897 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=Fz3D0OhPdsUiwkuZaq1AD1Gp98IWeymBpfUxvHLHbC4=; b=SnX2HV/zOvWk4BdsUPFQGkj/3x +1jqKcnmwGwyYU0CId6FzYaQTKr0X3/lTrJhsJ53VvpBeDVUWydWMTs+hyL7U7JqMPJgDv+5t+v9r 2C9NY1bn6RFIuNYNxfHoDrwjVrcf4ITD5ZKtjAfGRcUmNIrLhwv7FkgZJ0y8QkuOcFW86TkIf2bKW UNeYBD6tC6TE0rwtrRxq1zA11tWDC4M5LjLdMBo8xDWcDoXNVGfW+lAMD1k/iym2/EG9VHO8aznQo aGpuIJD5mmEBWlKIDhw8xpwNUIZwGRwT5feIOnGbU/7jY0BzPerCmigjx6I+KLrDRjpRj1OtNGx77 E1ZOQK4Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kbeeb-0004qm-Pe; Sun, 08 Nov 2020 06:58:21 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kbeeU-0004ob-E6; Sun, 08 Nov 2020 06:58:15 +0000 Received: from aquarius.haifa.ibm.com (nesher1.haifa.il.ibm.com [195.110.40.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9FA2C20719; Sun, 8 Nov 2020 06:58:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604818692; bh=wFNXZxJs2g5BcW3aCm2TF4VcMb1iBggKCmWf8Xc7OXQ=; h=From:To:Cc:Subject:Date:From; b=vEcjSbJxV1osIHprGn0uUivu2ID8+CzSj4Gez7BD1cn8ZWSCusNjvXx7R84zomGgH TCfOcB3essBAWR2sfg4dWEIKILFOIgLaYZaPcH8bFTlWeVokIFRf7C18MtlyF9fZa7 wnZ5i133kJilecrWVEAX6ixDBBd41cTdQGyorHrk= From: Mike Rapoport <rppt@kernel.org> To: Andrew Morton <akpm@linux-foundation.org> Subject: [PATCH v5 0/5] arch, mm: improve robustness of direct map manipulation Date: Sun, 8 Nov 2020 08:57:53 +0200 Message-Id: <20201108065758.1815-1-rppt@kernel.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201108_015814_642232_8BC083B1 X-CRM114-Status: GOOD ( 16.75 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-5.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [198.145.29.99 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <linux-riscv.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-riscv>, <mailto:linux-riscv-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-riscv/> List-Post: <mailto:linux-riscv@lists.infradead.org> List-Help: <mailto:linux-riscv-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-riscv>, <mailto:linux-riscv-request@lists.infradead.org?subject=subscribe> Cc: David Hildenbrand <david@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Benjamin Herrenschmidt <benh@kernel.crashing.org>, Dave Hansen <dave.hansen@linux.intel.com>, linux-mm@kvack.org, Paul Mackerras <paulus@samba.org>, Pavel Machek <pavel@ucw.cz>, "H. Peter Anvin" <hpa@zytor.com>, sparclinux@vger.kernel.org, Christoph Lameter <cl@linux.com>, Will Deacon <will@kernel.org>, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, Michael Ellerman <mpe@ellerman.id.au>, x86@kernel.org, Mike Rapoport <rppt@linux.ibm.com>, Christian Borntraeger <borntraeger@de.ibm.com>, Ingo Molnar <mingo@redhat.com>, linux-arm-kernel@lists.infradead.org, Catalin Marinas <catalin.marinas@arm.com>, Len Brown <len.brown@intel.com>, Albert Ou <aou@eecs.berkeley.edu>, Vasily Gorbik <gor@linux.ibm.com>, linux-pm@vger.kernel.org, Heiko Carstens <hca@linux.ibm.com>, David Rientjes <rientjes@google.com>, Borislav Petkov <bp@alien8.de>, Andy Lutomirski <luto@kernel.org>, Paul Walmsley <paul.walmsley@sifive.com>, "Kirill A. Shutemov" <kirill@shutemov.name>, Thomas Gleixner <tglx@linutronix.de>, Vlastimil Babka <vbabka@suse.cz>, "Rafael J. Wysocki" <rjw@rjwysocki.net>, linux-kernel@vger.kernel.org, Pekka Enberg <penberg@kernel.org>, Palmer Dabbelt <palmer@dabbelt.com>, "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>, Joonsoo Kim <iamjoonsoo.kim@lge.com>, "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>, linuxppc-dev@lists.ozlabs.org, "David S. Miller" <davem@davemloft.net>, Mike Rapoport <rppt@kernel.org> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" <linux-riscv-bounces@lists.infradead.org> Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org |
Series |
arch, mm: improve robustness of direct map manipulation
|
expand
|
From: Mike Rapoport <rppt@linux.ibm.com> Hi, During recent discussion about KVM protected memory, David raised a concern about usage of __kernel_map_pages() outside of DEBUG_PAGEALLOC scope [1]. Indeed, for architectures that define CONFIG_ARCH_HAS_SET_DIRECT_MAP it is possible that __kernel_map_pages() would fail, but since this function is void, the failure will go unnoticed. Moreover, there's lack of consistency of __kernel_map_pages() semantics across architectures as some guard this function with #ifdef DEBUG_PAGEALLOC, some refuse to update the direct map if page allocation debugging is disabled at run time and some allow modifying the direct map regardless of DEBUG_PAGEALLOC settings. This set straightens this out by restoring dependency of __kernel_map_pages() on DEBUG_PAGEALLOC and updating the call sites accordingly. Since currently the only user of __kernel_map_pages() outside DEBUG_PAGEALLOC is hibernation, it is updated to make direct map accesses there more explicit. [1] https://lore.kernel.org/lkml/2759b4bf-e1e3-d006-7d86-78a40348269d@redhat.com v5 changes: * use pairs of _map()/_unmap() functions instead of _map(..., int enable) as Vlastimil suggested v4 changes: * s/WARN_ON/pr_warn_once/ per David and Kirill * rebase on v5.10-rc2 * add Acked/Reviewed tags https://lore.kernel.org/lkml/20201103162057.22916-1-rppt@kernel.org v3 changes: * update arm64 changes to avoid regression, per Rick's comments * fix bisectability https://lore.kernel.org/lkml/20201101170815.9795-1-rppt@kernel.org v2 changes: * Rephrase patch 2 changelog to better describe the change intentions and implications * Move removal of kernel_map_pages() from patch 1 to patch 2, per David https://lore.kernel.org/lkml/20201029161902.19272-1-rppt@kernel.org v1: https://lore.kernel.org/lkml/20201025101555.3057-1-rppt@kernel.org Mike Rapoport (5): mm: introduce debug_pagealloc_{map,unmap}_pages() helpers slab: debug: split slab_kernel_map() to map and unmap variants PM: hibernate: make direct map manipulations more explicit arch, mm: restore dependency of __kernel_map_pages() on DEBUG_PAGEALLOC arch, mm: make kernel_page_present() always available arch/Kconfig | 3 +++ arch/arm64/Kconfig | 4 +-- arch/arm64/include/asm/cacheflush.h | 1 + arch/arm64/mm/pageattr.c | 6 +++-- arch/powerpc/Kconfig | 5 +--- arch/riscv/Kconfig | 4 +-- arch/riscv/include/asm/pgtable.h | 2 -- arch/riscv/include/asm/set_memory.h | 1 + arch/riscv/mm/pageattr.c | 31 ++++++++++++++++++++++ arch/s390/Kconfig | 4 +-- arch/sparc/Kconfig | 4 +-- arch/x86/Kconfig | 4 +-- arch/x86/include/asm/set_memory.h | 1 + arch/x86/mm/pat/set_memory.c | 4 +-- include/linux/mm.h | 40 ++++++++++++++--------------- include/linux/set_memory.h | 5 ++++ kernel/power/snapshot.c | 38 +++++++++++++++++++++++++-- mm/memory_hotplug.c | 3 +-- mm/page_alloc.c | 6 ++--- mm/slab.c | 26 ++++++++++--------- 20 files changed, 127 insertions(+), 65 deletions(-)