From patchwork Mon Aug 1 08:04:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 12933602 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 67233C00144 for ; Mon, 1 Aug 2022 08:04:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CD76B8E0002; Mon, 1 Aug 2022 04:04:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C86648E0001; Mon, 1 Aug 2022 04:04:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B4E128E0002; Mon, 1 Aug 2022 04:04:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A59C18E0001 for ; Mon, 1 Aug 2022 04:04:37 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7E52B4087A for ; Mon, 1 Aug 2022 08:04:37 +0000 (UTC) X-FDA: 79750286994.07.E7C8087 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf16.hostedemail.com (Postfix) with ESMTP id ED9151800F4 for ; Mon, 1 Aug 2022 08:04:35 +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 1541460F11; Mon, 1 Aug 2022 08:04:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04576C433D6; Mon, 1 Aug 2022 08:04:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659341074; bh=56n+0m+xaHkhO9EercwLYHh4JA36EIdVcoYGgta05LM=; h=From:To:Cc:Subject:Date:From; b=PBTOQQmjAlS/LOaIiG9gZDpZNG456lN6JjSjXbHBgemcsUCZlcon3FWS3cRznwonl jwI8f1YENB0df5Ks3YrRDkO3mzP0TGnYfumoxMS29SzSgh16Pg9LsCeNl1HAjMt0q+ 0qV2CSWGls94Q3xgUU25TVJpf8nD/pmTYrGZrqA2Wfqfewf3CKPF+7yG9jvEgyWse2 aheSEixbfrrXyCsETH4ojUN1bWsAsnI+hH/YFLGQ69bdvPAE7dXhVoOc22SZXPHHY7 NrQGbpBDqcX4++iBSyN2UBtap8HzR9uXYhXUAN4My9vE43gPZQdenoipFA09OaR5jh kUu6BkdmJ+ROA== 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 Subject: [RFC PATCH 0/4] arm64/mm: remap crash kernel with base pages even if rodata_full disabled Date: Mon, 1 Aug 2022 11:04:14 +0300 Message-Id: <20220801080418.120311-1-rppt@kernel.org> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=PBTOQQmj; spf=pass (imf16.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659341076; a=rsa-sha256; cv=none; b=eXsGaS3r1fVQ5bjjX+HwAT5j6wITRA+ivJn/0YyF3berXyeYTqsiq2LYE7LPU7+XTurWVH 0EcISPpu7a/gVIUV/3ECvA5aRrqGs3MiuD7RGo4fVLvBtmBnMA6CNVx4tIawjCr7bORSHu xkHGRvdsxFpw2qXxCOmKq++5nQ4yLO8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659341076; 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=JtwjwemtV0j9JzKQUNiGVHseK4rWUUKFIx7A8YUqvKw=; b=t653oUWMIHzj+VXJUNPouXSuIGTpVhS5FbVWo1PS1kLV6En93eUUn7TGWf9Lw6+6WqDrUt VraRzVk58wTczyvu3utbqKghyAwrg6USlfYJu18xurXpgrni6NP3yAegfHrqCPMMGFh6To SE1T4K5Zd+8zBTTyQpP9jda1eQvX1G0= X-Stat-Signature: mp3hzat8bhautnki5khxyxskt9eauemz X-Rspamd-Queue-Id: ED9151800F4 Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=PBTOQQmj; spf=pass (imf16.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1659341075-27357 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. Mike Rapoport (4): arm64: introduce have_zone_dma() helper 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 arch/arm64/include/asm/memory.h | 8 +++ arch/arm64/include/asm/mmu.h | 2 + arch/arm64/mm/init.c | 44 ++++++++++-- arch/arm64/mm/mmu.c | 116 ++++++++++++++++++++------------ 4 files changed, 122 insertions(+), 48 deletions(-)