From patchwork Wed Nov 15 16:30:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13457065 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 27774C2BB3F for ; Wed, 15 Nov 2023 16:31:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B28066B0396; Wed, 15 Nov 2023 11:31:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AD85E6B0398; Wed, 15 Nov 2023 11:31:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9C7D56B0399; Wed, 15 Nov 2023 11:31:11 -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 8C8736B0396 for ; Wed, 15 Nov 2023 11:31:11 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 71C87B59D7 for ; Wed, 15 Nov 2023 16:31:11 +0000 (UTC) X-FDA: 81460728342.20.0444892 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf07.hostedemail.com (Postfix) with ESMTP id 927894001B for ; Wed, 15 Nov 2023 16:31:09 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=none; spf=pass (imf07.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=1700065869; 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=23wa95YYr+lepWqTjV9qXNKPGiDUmSxG075F0NZsaAxB5y9N1mxYrbnqEB3Vjx550kyb1H m5kdNHKY6t4iv4KS4o6rbSk5iCtal+j7GxT840qEVFGWR8ABPDwTqlnz74grWfQDfEIvc/ x1OF/QUS7TN9QOcIDC/jm/yF+ynugzk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700065869; a=rsa-sha256; cv=none; b=dmINiNl4mxVfEVrNuPzPkNrGVrvkU3fLV965NU+43JiYPd3CopsHnOLKJ29q+1dTD4oBhM rfK6btfG1CVdoQCama9CGew5nm8FOL5Rg1ZUrRb6oM8oLO5EhALJ9up7XNyDR3CBZ2Oc2Z t8xSmngRvWz7kkIxOfb+L6hb+P+M/RI= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; spf=pass (imf07.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 88BC9DA7; Wed, 15 Nov 2023 08:31:54 -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 CF1963F641; Wed, 15 Nov 2023 08:31:05 -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 Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 11/14] arm64/mm: Split __flush_tlb_range() to elide trailing DSB Date: Wed, 15 Nov 2023 16:30:15 +0000 Message-Id: <20231115163018.1303287-12-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231115163018.1303287-1-ryan.roberts@arm.com> References: <20231115163018.1303287-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 927894001B X-Rspam-User: X-Stat-Signature: 88qoirr5erpc149berr9fgg1utujiqip X-Rspamd-Server: rspam03 X-HE-Tag: 1700065869-758130 X-HE-Meta: U2FsdGVkX1/OR8EgVHOKR6wzMtrotyDQrHErumzG4Pqvs8EMGQRT7sgWz/2Z9FdXwaYWrnlURxTz4S6rUmCpZ6iToNuTKZ3TwUI0fCzoKdWDcyGJFnffepFW3mZlJYjkzhRDzhrbmfeUdqj/Y9MisN4TRIzkIjfr2jWKwUSTIQOpTX09oY3PUzYoY+Qd1J9s8BkcOOvq8Sq3YSeuQrX7GGPNHUeyodMDRlH/bgoRNDhCGmW6J7X/sFevazH1VZVhD1JB+LKBEklltOAcAG6/CZRObXh/HScjHqIpwaANxvP976Jyj8BdS5pMLWmyRmNEs1vzWesoLPPHhfeUjTt7G3v7GgcQ32+KmTgYptOYzUYzgf/caSs5E+3ZrAexUY6bSqU0LCV5o9djmteGBsjcfqUuoeU9QfdnQ5pEwE8wXF6FWhCyEXSlpzv9OVMZe8qwtPt21ns5nhDJ3atbmhcUNO8soap1eyN5zE9Z83DSqw+4/uv+ZzWTHzM2vk9SZCKHNBFduZ+m8gp/aOmepziVP0g2YNXuwHaxkrl+zLA66aUrzZ88OvFBAGBiklxD+iZgxfGscgRKrHEy6iJByRWEdaBhuMTO8y4Y/Ltr83EOQW7E3pqZbG5QFjJNACnCHgpSfeNerZwR20lov7upM8i0FOustAujZAVdU76tYEjGfBQFbQMfJ6TI2mP/n/7DqtUoQV4rkBAD+C1/GR1AmDKHh6GYNi+c+6Q61T5NMaU3Gpg0u9o2dnBTHnevwjwM4iTs4LweiaeePiQ+bw5Q1PSdncouUSQOwHmk+fVYo1gTi2YwN8igJj3YPZ3XHssadATNMSUp4ygGInRwVkIk55jSQHykjapOTWR44sCu7YU3RSi7PHdaLw1ZupZI6sloJ2j6gvX/trrDWoaL+fpr1K1OQ7zP7szYxLn3GFRMHpHQiH2VtgamB3d+LHhkPdeRgmNMpZd6tn02zUV8mW/4G+J jDlfFSGP DBNGA4EaX0EcIBFAXvA8jFjelMnLO1Q+6SApIB2Csx4SHQN+7QkqqZ56rkilae3QK8sxyCSQmNYvu/UEdXOyFPTOy4/QtTZQtx6TABQruDy1KCMN+HnnEPPLzgYdPjQM2vIiCdgxc1H2ILDphk9nEUd4povTOrcIbL1ngEC1F5UOlsY2PL5HtzIss6yPzbD5JpRG2csdyYdkHyvbYmD2FQUCM3qsMLmzD4yu5oGHEjcH7uwoOylQ7gpc4p0c/+AesUcaTHD0bOqBwiTr2W5D+qRbuYg== 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) {