From patchwork Mon Dec 4 10:54:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13478196 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 48C98C4167B for ; Mon, 4 Dec 2023 10:55:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D4B476B02B2; Mon, 4 Dec 2023 05:55:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D21BA6B02B4; Mon, 4 Dec 2023 05:55:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C10B36B02B5; Mon, 4 Dec 2023 05:55:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id B10D66B02B2 for ; Mon, 4 Dec 2023 05:55:42 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 86D71C0191 for ; Mon, 4 Dec 2023 10:55:42 +0000 (UTC) X-FDA: 81528830124.18.5296BCA Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf27.hostedemail.com (Postfix) with ESMTP id F3E6440013 for ; Mon, 4 Dec 2023 10:55:40 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf27.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701687341; a=rsa-sha256; cv=none; b=Zh0HU4Buk5Ktge7xXDN7hEX/IEXCfnu4DXVKTNZzH40xh3+TFUl8nVyE2isLdT5pJPzcvA RFzfQ2bwQu0j5Q88PPWCTZtnq5lcZOc77JmX5KC/157caOI8YogCvP4siSwQPY/u3F2t0q fU+TmCC11biPgKQr6Zudv1Zz2K41TKU= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf27.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701687341; 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=mOqMiM5NGpNjoYnvzB47gVofKLzjpD8ExtOVjQRbqJI=; b=ukKHLjXwXT9WQ311xE0HqwyRgqfwefANbLZKEbG0NkKEYQ/ynaKZNFryybkEE3BDTrFiZR XhC75WMHeE2KRNuk6NJPctGgwlmyI7s1W42tKeYSyOY8DAthPPm5+njM5aFwuBmGy8i2tk x7bbu/7ty5ZMs6yGS4Z/77TvUDSoZFI= 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 7825816F2; Mon, 4 Dec 2023 02:56:27 -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 C3DCA3F6C4; Mon, 4 Dec 2023 02:55:36 -0800 (PST) From: Ryan Roberts To: Catalin Marinas , Will Deacon , Ard Biesheuvel , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Andrew Morton , Anshuman Khandual , Matthew Wilcox , Yu Zhao , Mark Rutland , David Hildenbrand , Kefeng Wang , John Hubbard , Zi Yan , Barry Song <21cnbao@gmail.com>, Alistair Popple , Yang Shi Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 12/15] arm64/mm: Split __flush_tlb_range() to elide trailing DSB Date: Mon, 4 Dec 2023 10:54:37 +0000 Message-Id: <20231204105440.61448-13-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231204105440.61448-1-ryan.roberts@arm.com> References: <20231204105440.61448-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: F3E6440013 X-Stat-Signature: j5hm8tgtqx9cmrtznid7h19nuctx8mza X-Rspam-User: X-HE-Tag: 1701687340-373254 X-HE-Meta: U2FsdGVkX1+ZUxf4w5upf7QuP+7MVASaY53SfPnGo8HTsgxJMO4Hy2bmtXLmclsBt2cB5oam7chWwpCxulGb/JXjwsQKH1pS7ZdWvasN9mnlaUmJrqVufi4HQnFIbhnSvpxm1Zrwlr1q+SGz8G1LGpWWZcIAXXbI15eMHyTFjCbyFEf0DJ12oww9+aqB3QX5HIs5bWmlIn17k9XoGjAw2B19KIQsUmI1rK9xT8j7pHxuhk/7BsResROUTHx1K0lZxKwemSixMdVOutyk+BnEAuGQTCftcHr17vHoGXnl8ZDHSOnX0UB6rqcZzk2/Fv7sWPClX00IGwXhbkSxOBZqCFEesjT7tv6prAIt0v5gG3g8X1rhHChOvuzD/R+KRJh/0nC7/7u1aC8HM3weQiA2r3Am5hQtk+RGbSXGtW1XcNRivRgLJfgEbGhs9fz2vZ99ZnJk/RmZoDq9XJOc5xHUDWktNh9vv7GDQn+rMGH0L6qOf5gA5dQ9MUAzBdoXIr0VjwcMlwVhejeS81u8YAhGE5v404j7zKtVIjBhJpHAolzgph5GlsIIkMTsqIFv5rrYHOXRgGk6way+muEJ++oZsrB3ZDEN8LRIEaVhOYJoIN4HnGaGZbC3oWhiD+dkkV95YrDIS/HRv/MmMlFnBEu3+pXt65i2srPGr0q47o3MugHFiB/CA4w/ZNFEzlhwrJTiEDMOJ6NMnL/Ntzk1S5X9yJQktS4t22156AEq/McRkhQr9p5EUtb86qu6eIIyqTuSeqfWorke7dB1OTOWfe8gzBMCOBt83I5ZH89Qh1jduagHTFbS0cDmvlkaUMzUEV4oxKUwHlc4EBQv8pX70sGrqg+ABn6n2edfOFbjnaBuGOm2YAbkx+XI8ooA8JpCkluvc9zKSmc7UW1/8LHbVbJbjRvAMEHs5DELU0gtl3DSNXndtdMNWD1qpsiGf3amBJLrKxgMGXBV6irbWeYrqI2 tQCPrY+G l/qoO+HoWpvP7Auc3tbc/IJnHAGJi8Nd6GAamAFZSkUuVu6HF72Rbof7W6hZLuspyFuZN+0nVov4kfKRy1Bb07XCVlXh3VQGLImDY0v3KnmjYIIdvm9j0IyjHsIvkyYa+4f75xrcVOaaAPuO0irHLV6n2VbJayfpSdqln9H4B9RyRCBPPnzCaZHpyKSFM9berfPehHyHFRllwVWDPo9/PB3krx36SqjC9KggwPeDNdEA6lMnfqD/dBBCIv6sIyWprUqPFVFqemQYVNFQLS5SwHTCLjA== 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. Signed-off-by: Ryan Roberts --- 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 bb2c2833a987..925ef3bdf9ed 100644 --- a/arch/arm64/include/asm/tlbflush.h +++ b/arch/arm64/include/asm/tlbflush.h @@ -399,7 +399,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) -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) @@ -431,10 +431,19 @@ static inline void __flush_tlb_range(struct vm_area_struct *vma, else __flush_tlb_range_op(vae1is, start, pages, stride, asid, tlb_level, true); - 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) {