From patchwork Wed Feb 19 14:38:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Miko=C5=82aj_Lenczewski?= X-Patchwork-Id: 13982387 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0BBAEC021AA for ; Wed, 19 Feb 2025 14:48:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1AP7vHCbm8vPBGji58pQ9MLO42f5GV5g/mANesyvEKI=; b=H3QcA7QYVURrGe3uQ9Mum67iL0 MRDE9vPwF1KaSoUVKUiO8lPqWqKPRFA4ZD8ZqW7Maf9PhNzcISwUBnGb24+SMBTkD6K99tU7/GT01 kG0HnLYdsTmnQ0phS9LyJJ52Vapigj1tZCUCjKhnJYcw/uUp9bCxMnax8RrBWBiTqCgqoMJ0msaFp GZFlANeq2k3wnr0GXiFxP2XCt7xjbrgs/b5XtRUdKSeFv4mj5LoaeDFAVFGDs4UK4cYfe3GIR/ovh PgRZhNrzoQAFTlXDH2rZKIIiG0q0fHiIfVoCEnWZLEOZMR9OKZdTpjODZKgxVlGdp+A8EZ8lVxqDq +q+ww9+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tklMs-0000000DMqA-1yC8; Wed, 19 Feb 2025 14:48:06 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tklL7-0000000DMHB-22QG for linux-arm-kernel@lists.infradead.org; Wed, 19 Feb 2025 14:46:18 +0000 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 DDE1C13D5; Wed, 19 Feb 2025 06:46:34 -0800 (PST) Received: from mazurka.cambridge.arm.com (mazurka.cambridge.arm.com [10.2.80.18]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8A3DF3F59E; Wed, 19 Feb 2025 06:46:13 -0800 (PST) From: =?utf-8?q?Miko=C5=82aj_Lenczewski?= To: ryan.roberts@arm.com, yang@os.amperecomputing.com, catalin.marinas@arm.com, will@kernel.org, joey.gouly@arm.com, broonie@kernel.org, mark.rutland@arm.com, james.morse@arm.com, yangyicong@hisilicon.com, robin.murphy@arm.com, anshuman.khandual@arm.com, maz@kernel.org, liaochang1@huawei.com, akpm@linux-foundation.org, david@redhat.com, baohua@kernel.org, ioworker0@gmail.com, oliver.upton@linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Miko=C5=82aj_Lenczewski?= Subject: [PATCH v1 1/3] arm64: Add BBM Level 2 cpu feature Date: Wed, 19 Feb 2025 14:38:38 +0000 Message-ID: <20250219143837.44277-5-miko.lenczewski@arm.com> X-Mailer: git-send-email 2.45.3 In-Reply-To: <20250219143837.44277-3-miko.lenczewski@arm.com> References: <20250219143837.44277-3-miko.lenczewski@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250219_064617_614606_8B7320EF X-CRM114-Status: GOOD ( 17.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The Break-Before-Make cpu feature supports multiple levels (levels 0-2), and this commit adds a dedicated BBML2 cpufeature to test against support for. This is a system feature as we might have a big.LITTLE architecture where some cores support BBML2 and some don't, but we want all cores to be available and BBM to default to level 0 (as opposed to having cores without BBML2 not coming online). To support BBML2 in as wide a range of contexts as we can, we want not only the architectural guarantees that BBML2 makes, but additionally want BBML2 to not create TLB conflict aborts. Not causing aborts avoids us having to prove that no recursive faults can be induced in any path that uses BBML2, allowing its use for arbitrary kernel mappings. Support detection of such CPUs. Signed-off-by: Mikołaj Lenczewski --- arch/arm64/Kconfig | 9 ++++++++ arch/arm64/include/asm/cpufeature.h | 5 +++++ arch/arm64/kernel/cpufeature.c | 32 +++++++++++++++++++++++++++++ arch/arm64/tools/cpucaps | 1 + 4 files changed, 47 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 940343beb3d4..84be2c5976f0 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -2057,6 +2057,15 @@ config ARM64_TLB_RANGE The feature introduces new assembly instructions, and they were support when binutils >= 2.30. +config ARM64_ENABLE_BBML2 + bool "Enable support for Break-Before-Make Level 2 detection and usage" + default y + help + FEAT_BBM provides detection of support levels for break-before-make + sequences. If BBM level 2 is supported, some TLB maintenance requirements + can be relaxed to improve performance. Selecting N causes the kernel to + fallback to BBM level 0 behaviour even if the system supports BBM level 2. + endmenu # "ARMv8.4 architectural features" menu "ARMv8.5 architectural features" diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index e0e4478f5fb5..2da872035f2e 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -866,6 +866,11 @@ static __always_inline bool system_supports_mpam_hcr(void) return alternative_has_cap_unlikely(ARM64_MPAM_HCR); } +static inline bool system_supports_bbml2_noconflict(void) +{ + return alternative_has_cap_unlikely(ARM64_HAS_BBML2_NOCONFLICT); +} + int do_emulate_mrs(struct pt_regs *regs, u32 sys_reg, u32 rt); bool try_emulate_mrs(struct pt_regs *regs, u32 isn); diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index d561cf3b8ac7..8c337bd95ef7 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -2176,6 +2176,31 @@ static bool hvhe_possible(const struct arm64_cpu_capabilities *entry, return arm64_test_sw_feature_override(ARM64_SW_FEATURE_OVERRIDE_HVHE); } +static bool has_bbml2_noconflict(const struct arm64_cpu_capabilities *entry, + int scope) +{ + if (!IS_ENABLED(CONFIG_ARM64_ENABLE_BBML2)) + return false; + + /* We want to allow usage of bbml2 in as wide a range of kernel contexts + * as possible. This list is therefore an allow-list of known-good + * implementations that both support bbml2 and additionally, fulfil the + * extra constraint of never generating TLB conflict aborts when using + * the relaxed bbml2 semantics (such aborts make use of bbml2 in certain + * kernel contexts difficult to prove safe against recursive aborts). + */ + static const struct midr_range supports_bbml2_without_abort_list[] = { + MIDR_REV_RANGE(MIDR_CORTEX_X4, 0, 3, 0xf), + MIDR_REV_RANGE(MIDR_NEOVERSE_V3, 0, 2, 0xf), + {} + }; + + if (!is_midr_in_range_list(read_cpuid_id(), supports_bbml2_without_abort_list)) + return false; + + return true; +} + #ifdef CONFIG_ARM64_PAN static void cpu_enable_pan(const struct arm64_cpu_capabilities *__unused) { @@ -2926,6 +2951,13 @@ static const struct arm64_cpu_capabilities arm64_features[] = { .matches = has_cpuid_feature, ARM64_CPUID_FIELDS(ID_AA64MMFR2_EL1, EVT, IMP) }, + { + .desc = "BBM Level 2 without conflict abort", + .capability = ARM64_HAS_BBML2_NOCONFLICT, + .type = ARM64_CPUCAP_SYSTEM_FEATURE, + .matches = has_bbml2_noconflict, + ARM64_CPUID_FIELDS(ID_AA64MMFR2_EL1, BBM, 2) + }, { .desc = "52-bit Virtual Addressing for KVM (LPA2)", .capability = ARM64_HAS_LPA2, diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps index 1e65f2fb45bd..8d67bb4448c5 100644 --- a/arch/arm64/tools/cpucaps +++ b/arch/arm64/tools/cpucaps @@ -26,6 +26,7 @@ HAS_ECV HAS_ECV_CNTPOFF HAS_EPAN HAS_EVT +HAS_BBML2_NOCONFLICT HAS_FPMR HAS_FGT HAS_FPSIMD From patchwork Wed Feb 19 14:38:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Miko=C5=82aj_Lenczewski?= X-Patchwork-Id: 13982388 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70047C021AA for ; Wed, 19 Feb 2025 14:49:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=X49qZOu4mRzA9kiupZ/PP4T0O97sIjrpcZUf9r0wWp4=; b=rrK0skL64DotcrH1MA808pRbFw GZ+PKiGHtt9JJKu2Cgo3mHTTy+apU806Zceht9sQuJvtLbYolgBtKEFlvceCmKMva3k2phGYUggYi yTdSYaYwvrMRBcLVhQ0VWj/eTgrURerzEBdT4uQi08J968PVggJQJv6lO4wOYmPKRCMVJw+yXgKrf 1wbRYlOW1zIdPyXL/bc4yzr1ZqZlfGJiMhEfo8zdr2dqxmbULu6G1XhAPChsLQDg0fP1PApgGMvId Ejvr8Rs0DlwWCzTb91bF+sLL5w4lOaAiBFg/rFBEuiGh6ZFByPXtkIL6J0GY8u3ikdNRwtJhx2Jxt GjMNKJrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tklOL-0000000DNEJ-0vob; Wed, 19 Feb 2025 14:49:37 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tklLG-0000000DMK6-2eBb for linux-arm-kernel@bombadil.infradead.org; Wed, 19 Feb 2025 14:46:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=X49qZOu4mRzA9kiupZ/PP4T0O97sIjrpcZUf9r0wWp4=; b=lGsp0vr1rD8Nmrcxhh6HIr1w8c bdkgZDDWrFEl4xMHQRvPn1H0jDOyptMxNCC3cKEwXrj/Dgyn+2Vy0Tk9FlXZaXl89e09Nwfr6X3eN yDoh921waV7eybwOGLfjlUMPQVdMAIS9H4J8H1FsdCB88u/oWyziUuwqxlKT2AAGdrpRASFcGEUwV AH/IsRtyJ9FSpKNoIyEyHUqnAniZZVMoLQ40xmg61Pyj8IY1i/ymS2ZMBzfy8DPPqGz54vu7Q9IF/ dhL91BMRVeSKxCJVAvwkplwN9I1ydoFr2uTDwzmImSgJvYZGwIzZGXVkau+ir9h3UPargDHyrhYUf gqlhxJ3Q==; Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tklLD-00000002CpK-2eVc for linux-arm-kernel@lists.infradead.org; Wed, 19 Feb 2025 14:46:25 +0000 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 68B071688; Wed, 19 Feb 2025 06:46:38 -0800 (PST) Received: from mazurka.cambridge.arm.com (mazurka.cambridge.arm.com [10.2.80.18]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B64FD3F59E; Wed, 19 Feb 2025 06:46:16 -0800 (PST) From: =?utf-8?q?Miko=C5=82aj_Lenczewski?= To: ryan.roberts@arm.com, yang@os.amperecomputing.com, catalin.marinas@arm.com, will@kernel.org, joey.gouly@arm.com, broonie@kernel.org, mark.rutland@arm.com, james.morse@arm.com, yangyicong@hisilicon.com, robin.murphy@arm.com, anshuman.khandual@arm.com, maz@kernel.org, liaochang1@huawei.com, akpm@linux-foundation.org, david@redhat.com, baohua@kernel.org, ioworker0@gmail.com, oliver.upton@linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Miko=C5=82aj_Lenczewski?= Subject: [PATCH v1 2/3] arm64/mm: Delay tlbi in contpte_convert() under BBML2 Date: Wed, 19 Feb 2025 14:38:39 +0000 Message-ID: <20250219143837.44277-6-miko.lenczewski@arm.com> X-Mailer: git-send-email 2.45.3 In-Reply-To: <20250219143837.44277-3-miko.lenczewski@arm.com> References: <20250219143837.44277-3-miko.lenczewski@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250219_144623_894504_0C844B13 X-CRM114-Status: GOOD ( 12.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When converting a region via contpte_convert() to use mTHP, we have two different goals. We have to mark each entry as contiguous, and we would like to smear the dirty and young (access) bits across all entries in the contiguous block. Currently, we do this by first accumulating the dirty and young bits in the block, using an atomic __ptep_get_and_clear() and the relevant pte_{dirty,young}() calls, performing a tlbi, and finally smearing the correct bits across the block using __set_ptes(). This approach works fine for BBM level 0, but with support for BBM level 2 we are allowed to reorder the tlbi to after setting the pagetable entries. This reordering means that other threads will not see an invalid pagetable entry, instead operating on stale data, until we have performed our smearing and issued the invalidation. Avoiding this invalid entry reduces faults in other threads, and thus improves performance marginally (more so when there are more threads). Signed-off-by: Mikołaj Lenczewski Reviewed-by: Ryan Roberts --- arch/arm64/mm/contpte.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/contpte.c b/arch/arm64/mm/contpte.c index 55107d27d3f8..e26e8f8cfb9b 100644 --- a/arch/arm64/mm/contpte.c +++ b/arch/arm64/mm/contpte.c @@ -68,9 +68,13 @@ static void contpte_convert(struct mm_struct *mm, unsigned long addr, pte = pte_mkyoung(pte); } - __flush_tlb_range(&vma, start_addr, addr, PAGE_SIZE, true, 3); + if (!system_supports_bbml2_noconflict()) + __flush_tlb_range(&vma, start_addr, addr, PAGE_SIZE, true, 3); __set_ptes(mm, start_addr, start_ptep, pte, CONT_PTES); + + if (system_supports_bbml2_noconflict()) + __flush_tlb_range(&vma, start_addr, addr, PAGE_SIZE, true, 3); } void __contpte_try_fold(struct mm_struct *mm, unsigned long addr, From patchwork Wed Feb 19 14:38:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Miko=C5=82aj_Lenczewski?= X-Patchwork-Id: 13982482 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 928C6C021AA for ; Wed, 19 Feb 2025 15:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=S1cyu4qLCW+G5IS8eMs/nlDOlaE0XI3DusDqdVY92os=; b=I6A6NWMbVyT9EoIX0jVNP61DEA waN6bRdBbvD7R/nObdpGEDu9oxEcyqHq3CB2aQznHh411P2xc9MZlsG+1pWombBQ7lvXXJOT8KaCl Y6ERxd87LHHR8oKY72A6D/ZWH3pAodYn281L6avPbsdho68F3ZRygWmLAU4Wz4KhbI1SOD+0utnrI nPZz6KuywyrqjsaYOH3M4bleYVSQFORdY4o/rlMneul7nm8bLyrBUHotngBy9U8t16gNwWX4qfmhN Ere44pa5RcY55bXvG8xHqRoxYxhDRqFebWIqoGbxH92sYyDzT+PtDml14+g6vDzdc8aZf4DiQWgaz /9Lb7SQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tkmQm-0000000DfOA-1yKJ; Wed, 19 Feb 2025 15:56:12 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tklLG-0000000DMK7-2dvI for linux-arm-kernel@bombadil.infradead.org; Wed, 19 Feb 2025 14:46:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=S1cyu4qLCW+G5IS8eMs/nlDOlaE0XI3DusDqdVY92os=; b=SN2aC96RoBTOAg49+w+VQLrQ09 Op+F6msNc556ma0Vn+lpnkeYOzT81vBXuEAW4sNj5gg4AcjTxyzqzDWHxN7scEES8tywuO7a+OmcV 8jDpaGJ8G5Yorjc7QvuM6D8514j6cqGf+mEBz8Fn/I5S2R7+zmlp944G+bRGE3TXgDuGFjiuKkXhB k/Otn9uDAjRe5NtjslsGNPDIyrfInRDN+H+MauCU+375bYCdKQu3XOSJPMJRrdURAHt2uyZv2zLN4 A+n3vhukAgSLj7OqWYMQJKeISdlEDffSypWau0i8Adu68yKz+cxgeigASQipiZn6zPsVL6+eiAtHW t8JFdoIQ==; Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tklLD-00000002CpS-3LfK for linux-arm-kernel@lists.infradead.org; Wed, 19 Feb 2025 14:46:25 +0000 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 9499C202C; Wed, 19 Feb 2025 06:46:41 -0800 (PST) Received: from mazurka.cambridge.arm.com (mazurka.cambridge.arm.com [10.2.80.18]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 40E293F59E; Wed, 19 Feb 2025 06:46:20 -0800 (PST) From: =?utf-8?q?Miko=C5=82aj_Lenczewski?= To: ryan.roberts@arm.com, yang@os.amperecomputing.com, catalin.marinas@arm.com, will@kernel.org, joey.gouly@arm.com, broonie@kernel.org, mark.rutland@arm.com, james.morse@arm.com, yangyicong@hisilicon.com, robin.murphy@arm.com, anshuman.khandual@arm.com, maz@kernel.org, liaochang1@huawei.com, akpm@linux-foundation.org, david@redhat.com, baohua@kernel.org, ioworker0@gmail.com, oliver.upton@linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Miko=C5=82aj_Lenczewski?= Subject: [PATCH v1 3/3] arm64/mm: Elide tlbi in contpte_convert() under BBML2 Date: Wed, 19 Feb 2025 14:38:40 +0000 Message-ID: <20250219143837.44277-7-miko.lenczewski@arm.com> X-Mailer: git-send-email 2.45.3 In-Reply-To: <20250219143837.44277-3-miko.lenczewski@arm.com> References: <20250219143837.44277-3-miko.lenczewski@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250219_144624_026805_56A716AE X-CRM114-Status: UNSURE ( 7.95 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If we support bbml2 without conflict aborts, we can avoid the final flush and have hardware manage the tlb entries for us. Avoiding flushes is a win. Signed-off-by: Mikołaj Lenczewski Reviewed-by: Ryan Roberts --- arch/arm64/mm/contpte.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/arm64/mm/contpte.c b/arch/arm64/mm/contpte.c index e26e8f8cfb9b..26a86248f897 100644 --- a/arch/arm64/mm/contpte.c +++ b/arch/arm64/mm/contpte.c @@ -72,9 +72,6 @@ static void contpte_convert(struct mm_struct *mm, unsigned long addr, __flush_tlb_range(&vma, start_addr, addr, PAGE_SIZE, true, 3); __set_ptes(mm, start_addr, start_ptep, pte, CONT_PTES); - - if (system_supports_bbml2_noconflict()) - __flush_tlb_range(&vma, start_addr, addr, PAGE_SIZE, true, 3); } void __contpte_try_fold(struct mm_struct *mm, unsigned long addr,