From patchwork Fri Aug 19 04:11:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 12948295 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC46AC25B0E for ; Fri, 19 Aug 2022 04:12:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 156F48D0003; Fri, 19 Aug 2022 00:12:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1067F8D0002; Fri, 19 Aug 2022 00:12:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F36D08D0003; Fri, 19 Aug 2022 00:12:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E433F8D0002 for ; Fri, 19 Aug 2022 00:12:14 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B97F1A010A for ; Fri, 19 Aug 2022 04:12:14 +0000 (UTC) X-FDA: 79815019788.23.9634918 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf01.hostedemail.com (Postfix) with ESMTP id 5938140002 for ; Fri, 19 Aug 2022 04:12:14 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 763F761515; Fri, 19 Aug 2022 04:12:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34F9BC433D6; Fri, 19 Aug 2022 04:12:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660882332; bh=plPUZEi7gc9933Zm7xZLunqPtKaOCQ5hi0QL2k34NHk=; h=From:To:Cc:Subject:Date:From; b=pAd8j7GymJ3OOqOBRfqkrghT2RIqSNjx4KbfJWuF8coQopaDHzTfK484hzYXP8C9U npkFZZoEpzz/IpAho+FcQjKc+IcmGBbeesM9QouWxut2J8d5qcSLHmzbGvJGYFrt2S lkmCibHwMR3G6wdWZxdbfUbW1vL5WJAjygMjzAc0VpvREdQ7VY2w9sXyOOqqBId1Q+ EOANn6K7/jxmPtU5JcMTx2GwE1e/srHfP+b0uOGvzYoDwr1zHsm8Vf0Hf0RSHqvAh4 tEXhG96G5dSda3OGbwwE6uMKpWcyF2sp+74MU7R1so6x/DxiEakhplFqxmQ6aTqAf5 +eQjeiZUeoMKA== From: Mike Rapoport To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Catalin Marinas , Guanghui Feng , Mark Rutland , Mike Rapoport , Mike Rapoport , Will Deacon , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Mike Rapoport Subject: [PATCH 0/5] arm64/mm: remap crash kernel with base pages even if rodata_full disabled Date: Fri, 19 Aug 2022 07:11:51 +0300 Message-Id: <20220819041156.873873-1-rppt@kernel.org> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660882334; a=rsa-sha256; cv=none; b=kAoSd4nW9tNDP8s/h4cRv3IXjYfYkuTMafxLYnUBtS5p4NnR/uKkWjeAhj2FghnwcsKDaY fZVztLnadsLRTnCtSa2JdL0pZnavuD++YZ5uV57wUKp6T61mYpUvSyUL2DTRdTGCNNGiF3 B6q62P5COI8LuRQuhAW8Cezg6LFwLYM= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=pAd8j7Gy; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf01.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660882334; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=brqMN8AjXRxbz4xK2iLfvRL9NHsldF991nBSkgFfNtU=; b=SubyfJyXPQJ3i2OsF3DMzs5wTwMs5NP65Ml448Kb08ltm1QTZ3MWzWr/JopD4C70VLF+wv Q/Fe9LKuRHc5eK0Fakzz+7145RaR4gwzqy2i1p/31uTOzBWKllZRGvRml2Hb8MwjPY+WBJ d+giah619BnPbcthIXI7lbO6PWxJXlk= X-Rspamd-Server: rspam06 X-Rspam-User: X-Stat-Signature: um98acqr1m8u3i6oxchcdkukqbanb18p Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=pAd8j7Gy; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf01.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org X-Rspamd-Queue-Id: 5938140002 X-HE-Tag: 1660882334-638601 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: From: Mike Rapoport Hi, There were several rounds of discussion how to remap with base pages only the crash kernel area, the latest one here: https://lore.kernel.org/all/1656777473-73887-1-git-send-email-guanghuifeng@linux.alibaba.com and this is my attempt to allow having both large pages in the linear map and protection for the crash kernel memory. For server systems it is important to protect crash kernel memory for post-mortem analysis, and for that protection to work the crash kernel memory should be mapped with base pages in the linear map. On the systems with ZONE_DMA/DMA32 enabled, crash kernel reservation happens after the linear map is created and the current code forces using base pages for the entire linear map, which results in performance degradation. These patches enable remapping of the crash kernel area with base pages while keeping large pages in the rest of the linear map. The idea is to align crash kernel reservation to PUD boundaries, remap that PUD and then free the extra memory. For now the remapping does not deal with the case when crash kernel base is specified, but this won't be a problem to add if the idea is generally acceptable. RFC: https://lore.kernel.org/all/20220801080418.120311-1-rppt@kernel.org Mike Rapoport (5): arm64: rename defer_reserve_crashkernel() to have_zone_dma() arm64/mmu: drop _hotplug from unmap_hotplug_* function names arm64/mmu: move helpers for hotplug page tables freeing close to callers arm64/mm: remap crash kernel with base pages even if rodata_full disabled arm64/mmu: simplify logic around crash kernel mapping in map_mem() arch/arm64/include/asm/memory.h | 2 +- arch/arm64/include/asm/mmu.h | 3 + arch/arm64/kernel/machine_kexec.c | 6 ++ arch/arm64/mm/init.c | 69 +++++++++++--- arch/arm64/mm/mmu.c | 152 ++++++++++++++++-------------- 5 files changed, 147 insertions(+), 85 deletions(-) base-commit: 568035b01cfb107af8d2e4bd2fb9aea22cf5b868