From patchwork Thu Jan 25 16:42:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Elisei X-Patchwork-Id: 13531338 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 CFA45C47422 for ; Thu, 25 Jan 2024 16:44:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 628486B00A3; Thu, 25 Jan 2024 11:44:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B1FC6B00A4; Thu, 25 Jan 2024 11:44:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 451E78D0002; Thu, 25 Jan 2024 11:44:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 2ED666B00A3 for ; Thu, 25 Jan 2024 11:44:51 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D69B0140515 for ; Thu, 25 Jan 2024 16:44:50 +0000 (UTC) X-FDA: 81718407540.11.94313AB Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf01.hostedemail.com (Postfix) with ESMTP id 1C23140007 for ; Thu, 25 Jan 2024 16:44:48 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf01.hostedemail.com: domain of alexandru.elisei@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=alexandru.elisei@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706201089; 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:in-reply-to:references:references; bh=NKb8hXHRJf1xlcryWkhAW3EgZtKBRLV38rWEpFR2xbw=; b=YkiHAjESu55wNCJR2nKKN3InGkaPXB0fJ+7xFHunppZOzijWei8chymkyU2I1tcmDxmIlX 1jBHNzvq/Quo+ztZu3J/TPIvSX+v3kqLOfVkqRLObJzQvfUiNqJYs0VS8FHJmmK1vJP9Qj tgBIb3HGcsRuWH9i4dkVZrz/bSx5ZN0= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf01.hostedemail.com: domain of alexandru.elisei@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=alexandru.elisei@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706201089; a=rsa-sha256; cv=none; b=WC75esh0O/TQLGRZe9LMKmU+JF2osyq0sESvk3JL60FBGPI/DhFMNp/OdRYmVLlytCTpWx YVcfXnmJX0sqX9I/CWsLiwIYZEYBI7HDUmf3WrwAVCfCb4tOJ1JlX2wr5w2rwCbCHdJ0rJ uQx4QvTtbTXZ/5x2+94Fbcy+DGU0B8E= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E894C1688; Thu, 25 Jan 2024 08:45:32 -0800 (PST) Received: from e121798.cable.virginm.net (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 03CA73F5A1; Thu, 25 Jan 2024 08:44:42 -0800 (PST) From: Alexandru Elisei To: catalin.marinas@arm.com, will@kernel.org, oliver.upton@linux.dev, maz@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, arnd@arndb.de, akpm@linux-foundation.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, mhiramat@kernel.org, rppt@kernel.org, hughd@google.com Cc: pcc@google.com, steven.price@arm.com, anshuman.khandual@arm.com, vincenzo.frascino@arm.com, david@redhat.com, eugenis@google.com, kcc@google.com, hyesoo.yu@samsung.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH RFC v3 21/35] arm64: mte: Disable dynamic tag storage management if HW KASAN is enabled Date: Thu, 25 Jan 2024 16:42:42 +0000 Message-Id: <20240125164256.4147-22-alexandru.elisei@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240125164256.4147-1-alexandru.elisei@arm.com> References: <20240125164256.4147-1-alexandru.elisei@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 1C23140007 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: kartb4nrzk4tyan9cq5nyo55n9ug1ofg X-HE-Tag: 1706201088-740582 X-HE-Meta: U2FsdGVkX19dzh5qffO8g6D/3/DHANyMPe/U57djF0ul2UOds1cy2uAXaFjOZ0/CzYAyMt/LAUslD4Z2gYpkZmunBnq1UM5R3yXNBg918r6zqsVrkc4o0UMGJrEIR3s0du1UV0oG+CHKPBM5P7142jD0MLTdJqWGeqNBfOTTmnOivxkqedh+3IbLPEA1RKNhxy2Dn87QLBY+5X20U3BOhlUiYbiy0QwEFW6dqvwVEBisyZtNUkmQGiDE+1nZeMdACesVdhWJj3uJb3u8GMSwAhhM9pdgNp4CPqyeNFcDPVKQ04mvMQYnjsHvC6gKC72ueQzigjXQ4UJpjoWqhB852wikPVkQRvXva+4Xs+ZPCgH6FiO6fonRDYISWORKtcCHLDTHfmmpeUHMOhY7QFLA4n1Gys/b7N/o+prfFqQnYHu4nrkV62Uvf81IsA2wb/4mLDxq8E5v3Zmq2uGeI2hw11o5zxj0hidV/tUin1nGNYTTHNDBKkGjJr2nL5AbeYmiwfM6uF+AYJ9nQtbfOZH+/oDOMlmTrJStqVkfDnhabRIzBU492cHT94JNeO4UkcozCO7njNPmwowroJb5w70FwXLaL0vDu7hRT2DvGiinSO8yU/aa60KF+qgJnSSKh/iQ41BUwVDS9s4yAVwnbxYzZqlbirQtOGkXGL0HQQLOKgqX1SBAkTFeqdze3d5nDJFOpRIniQkHKuVGxjajBlyPiO04aJwPlwCU5yrIodphMS6h07P03HYJP+w1YUykCOkB8LIyyPQtf29D1f3nwxZflN2FmDFTU4whrFWhaxjBdXAm9mLqYafP6eCNJVGgL8edgQpcNcDw0nZOLwEuhJogWHiPBE9fbPTylrqwTq2ulEYyqzZ0HmWfwC0qWE9JiK+dB1KqU1bTzpt2ZARPgqgZ3q9moPueWKknZFnnkMc7BRLvTF7MFU4fw7Pa2rZBXykdP0FGi9o1L+4BHMdYu2v O+DKeYo+ JgwDZSP5AhCfVf4gwmK0to2tsgIEPYZalltVc43uX9arnnHGB5WJdzZxq40U9yjtz5gtB7u5NpQKVmSBiSDar3qrE3rGrBKrVerm9oE8qClMFZg4pJYZ69NCYpo2S5FWOVlwimEztAPhCnx4E6T7vV9sl7ZbPPk+2bfd/ 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: List-Subscribe: List-Unsubscribe: To be able to reserve the tag storage associated with a tagged page requires that the tag storage can be migrated, if it's in use for data. The kernel allocates pages in non-preemptible contexts, which makes migration impossible. The only user of tagged pages in the kernel is HW KASAN, so don't use tag storage pages if HW KASAN is enabled. Signed-off-by: Alexandru Elisei --- Changes since rfc v2: * Expanded commit message (David Hildenbrand) arch/arm64/kernel/mte_tag_storage.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/kernel/mte_tag_storage.c b/arch/arm64/kernel/mte_tag_storage.c index 90b157132efa..9a1a8a45171e 100644 --- a/arch/arm64/kernel/mte_tag_storage.c +++ b/arch/arm64/kernel/mte_tag_storage.c @@ -256,6 +256,16 @@ void __init mte_init_tag_storage(void) goto out_disabled; } + /* + * The kernel allocates memory in non-preemptible contexts, which makes + * migration impossible when reserving the associated tag storage. The + * only in-kernel user of tagged pages is HW KASAN. + */ + if (kasan_hw_tags_enabled()) { + pr_info("KASAN HW tags incompatible with MTE tag storage management"); + goto out_disabled; + } + /* * Check that tag storage is addressable by the kernel. * cma_init_reserved_mem(), unlike cma_declare_contiguous_nid(), doesn't