From patchwork Thu Feb 15 10:31:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13557861 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 BBEBDC48BF0 for ; Thu, 15 Feb 2024 10:33:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 418D88D001D; Thu, 15 Feb 2024 05:33:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A0408D000E; Thu, 15 Feb 2024 05:33:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F1F08D001D; Thu, 15 Feb 2024 05:33:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0B0048D000E for ; Thu, 15 Feb 2024 05:33:00 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D47E0C080F for ; Thu, 15 Feb 2024 10:32:59 +0000 (UTC) X-FDA: 81793675278.08.777F2D7 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf15.hostedemail.com (Postfix) with ESMTP id 50894A000F for ; Thu, 15 Feb 2024 10:32:58 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707993178; 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=4J1dTrrIzJ+DpallLluT2b35txLH0YV5OvrN+DtNofk=; b=122e5Aa2JWLqtbrxft72U/zdLQsfLxCpVJA3NwAc6cjoe4Vp9mIpXCbZ8B4E2jXk+vpxs7 1SiZeS5w2bjmpqx/q3whBSNFtQ690ZgekeDZzx4aq8gSnvYAfYFsMBwim1Tq8AhdwDxtmM XqmNYJQqzJOzkEClVPoiuikITgrnXaE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707993178; a=rsa-sha256; cv=none; b=ut0YQlJtOCwJHfnUqevHdTCjgtb+icdalRlgpfhYG51Ddf30T5cexicN4OSdGEs+j6Ywq9 GkVvwP+7IQsbusqMqRVWePuZi9ZX07gCMIw4vZzuzSjZbn5wk18FVXuxDBPv43gY804TTq i5I5HrBGM3jE6nrbv1h6qc9SqG8BOfs= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com 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 79677DA7; Thu, 15 Feb 2024 02:33:38 -0800 (PST) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6E5073F7B4; Thu, 15 Feb 2024 02:32:54 -0800 (PST) From: Ryan Roberts To: Catalin Marinas , Will Deacon , Ard Biesheuvel , Marc Zyngier , James Morse , Andrey Ryabinin , Andrew Morton , Matthew Wilcox , Mark Rutland , David Hildenbrand , Kefeng Wang , John Hubbard , Zi Yan , Barry Song <21cnbao@gmail.com>, Alistair Popple , Yang Shi , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 11/18] arm64/mm: Split __flush_tlb_range() to elide trailing DSB Date: Thu, 15 Feb 2024 10:31:58 +0000 Message-Id: <20240215103205.2607016-12-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240215103205.2607016-1-ryan.roberts@arm.com> References: <20240215103205.2607016-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 50894A000F X-Rspam-User: X-Stat-Signature: jo8whq9azk4dsbgdhia3xhf93wg4hw6k X-Rspamd-Server: rspam03 X-HE-Tag: 1707993178-559821 X-HE-Meta: U2FsdGVkX19uGRgvXN5lzZuQed1nDYgMdmJXUg4tL/GdUDVS+DBAiKrnoi3/53DMSQgrVfBB+cIY7pQaGMN82z0CiAnfmSJ05kPYP38MpPUIssA3/gMFKOqFn510MWVzU4tPNFe/vpyBrlxk4Sm+/VCQnnusQOczlKVhIXc4uwcij6alhakyCJP2+WXkl28s/hYIFBD5KMroNP6MnCwjOJNFESqEogqYdWEIgC4TrkNVpXOw0vwa+CmdYepAoB7QXzPar8Hqu4yrLgdo5d2otpWQZHqVJx8TlQJyW6KLsKB4IuHZhxqo+Qoz7vHqQ7qZ/zf6hsu7fK6huvI0TM96g3cYaHpHjNwUclwtkE3goBMw1M7EgGuHRwxyrAPsNVLeVQvthrVpyaGoaOJNukfElAQqgmCyLd1AQBs0rX5gy+Q64pIiRIj9FLHO7jNaCMXO7/RBHjKCcTRp+nGZZ2ireibfqyNVniN7xLQmsTcWU1oKdGGbhVCHcFkFG236CWVFZjgDfFHGfwOm2l4IETqZDOy/807V1Y4Xh5vHKTEVFIR500blVWrELY7RApH5pOP+4Fr/Q6H65H/QqOxNDDrtCOD/i94Z33Gom7IDDHSbU2Z2jW8B7BcmxWLZZ1EqrpgybFQgBQDrzQsk209dPjSdQHdJ5TcwG7BTJA7oqBiOPfCaY05vljYkJp7LuRw+iD10YZzM5Qfckmgt818P9N16nHD+xoSNz6AK+G4mWpmEWZrQ/TQ2e5OU7rLiJyyZKsd8LTNF1Tzx+XJ4qyZL3z04I6wkEu5MPY70N/bTPnMvaqhbc6Xqa0Z4g8RHtmY5GbICmzB3zEfdztTGBA3dMCPG7P21TQzL6UCMI4Bc8Hvt+wEjgMO/5U4gdtPdw3kckBxgb7wcW+WPSNNkB6z0NV828ogoop5tjXHANZ/mEbEHF0Out0D+xo2vCUpLJkP5PTnyjb7j2jGBCPy4be3lH61 fERbHdom /H1qs+JGEP2qEKDdKMXRGgRVRgkfKn5Xslyxw/NFC81bGW1zA+qjnmCuNv57YUX1G2rZdidISoHwe4ppFmCapD4uj3ekIPdFE6EdwxruWgA1KT/px+CFXift4i+FXllQBu07hB43UDv8RRRTQluPievS1i9F+GZL/u7iwXggiAk2DxCC/8yPLE9fioKyquFueYjiVDNQW4InJ4F+r6TYgT+ZDJ4m0usf9arfw8VUuoHXuEv3fV7Xx5xpjdjGf3wxzoN0oBtoP6ossVUK1iZ7gg9wrk+f3FbQYHOjQhp8gUqLofsaXfqSPfUbwkMYDyuF3xIvCDggv6rrAAW0= 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: Split __flush_tlb_range() into __flush_tlb_range_nosync() + __flush_tlb_range(), in the same way as the existing flush_tlb_page() arrangement. This allows calling __flush_tlb_range_nosync() to elide the trailing DSB. Forthcoming "contpte" code will take advantage of this when clearing the young bit from a contiguous range of ptes. Ordering between dsb and mmu_notifier_arch_invalidate_secondary_tlbs() has changed, but now aligns with the ordering of __flush_tlb_page(). It has been discussed that __flush_tlb_page() may be wrong though. Regardless, both will be resolved separately if needed. Reviewed-by: David Hildenbrand Tested-by: John Hubbard Signed-off-by: Ryan Roberts Acked-by: Mark Rutland Acked-by: Catalin Marinas --- arch/arm64/include/asm/tlbflush.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h index 1deb5d789c2e..3b0e8248e1a4 100644 --- a/arch/arm64/include/asm/tlbflush.h +++ b/arch/arm64/include/asm/tlbflush.h @@ -422,7 +422,7 @@ do { \ #define __flush_s2_tlb_range_op(op, start, pages, stride, tlb_level) \ __flush_tlb_range_op(op, start, pages, stride, 0, tlb_level, false, kvm_lpa2_is_enabled()); -static inline void __flush_tlb_range(struct vm_area_struct *vma, +static inline void __flush_tlb_range_nosync(struct vm_area_struct *vma, unsigned long start, unsigned long end, unsigned long stride, bool last_level, int tlb_level) @@ -456,10 +456,19 @@ static inline void __flush_tlb_range(struct vm_area_struct *vma, __flush_tlb_range_op(vae1is, start, pages, stride, asid, tlb_level, true, lpa2_is_enabled()); - dsb(ish); mmu_notifier_arch_invalidate_secondary_tlbs(vma->vm_mm, start, end); } +static inline void __flush_tlb_range(struct vm_area_struct *vma, + unsigned long start, unsigned long end, + unsigned long stride, bool last_level, + int tlb_level) +{ + __flush_tlb_range_nosync(vma, start, end, stride, + last_level, tlb_level); + dsb(ish); +} + static inline void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end) {