From patchwork Mon Dec 18 10:50:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13496577 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 B6879C35274 for ; Mon, 18 Dec 2023 10:52:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 534026B00AB; Mon, 18 Dec 2023 05:52:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4BFB66B00AC; Mon, 18 Dec 2023 05:52:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 310DC6B00AD; Mon, 18 Dec 2023 05:52:08 -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 21BB16B00AB for ; Mon, 18 Dec 2023 05:52:08 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 07501A0D45 for ; Mon, 18 Dec 2023 10:52:08 +0000 (UTC) X-FDA: 81579624336.14.C2E9C19 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf02.hostedemail.com (Postfix) with ESMTP id 465328000E for ; Mon, 18 Dec 2023 10:52:06 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf02.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=1702896726; 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=3XWNUf0y+LoNhJb/OvSX6jZDQxYAWNT/5GVeo+DL1UM=; b=NL33FOs6H4nTWNFUMW7PEujJ2MhPz1gZCgXHD06pDyWYK3ZhcES/GD7K0kS2UHdvfl7oei hal8vPWfowZvPliS4Ge6NB9zX1d0lyEM54gQQ+85VAzeBNLA0Rfmn+055V+TGKuNbnbtue JFsB4RhsU8y/2cslEdg4LSqD3Wz7G7k= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf02.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=1702896726; a=rsa-sha256; cv=none; b=diKaD0LEagImnio8Fa1r5qYq/XOGQpqrQ62RdwlXZFdTlCQAO3j99MsrzUBgbF3r9w1Qmv wozuk2utD4UD6Zv/FV7GPPc64/rS1kbaEXCAGFp6prSnXJpMeYRJ7y+xPVdVyhNB4g1Udl wrpwY4LLZb72Xa10Zii5ZytftgimVNg= 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 000181FB; Mon, 18 Dec 2023 02:52:49 -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 26B0F3F738; Mon, 18 Dec 2023 02:52:02 -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 v4 13/16] arm64/mm: Split __flush_tlb_range() to elide trailing DSB Date: Mon, 18 Dec 2023 10:50:57 +0000 Message-Id: <20231218105100.172635-14-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231218105100.172635-1-ryan.roberts@arm.com> References: <20231218105100.172635-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 465328000E X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: hggwi7dooymgqak7xobqgizfzgpb69ez X-HE-Tag: 1702896726-715381 X-HE-Meta: U2FsdGVkX1+WBuo97Wh6hfEnVdveD9Cz4GwYDefDqxb8noFAA28YT76leN9zNNv87qbBJu4ARPcDximoJTX0Ny1X26HcuaykUQzRzio6ItZ6s0UuII1/VklPiHteWKTcjoUw56YeeBqYN15Zx4rgbIp6O8Bqz+zjKrenkHfkXb5ykYv+GyDOSDQf7xRu4dLy7Vr9V+GcVQhiIDG9Zind/YBhdyGCKpPWG4m2Jd43+6PgY2VZQ4AkDw1mX53PEIpa4Qa6kdw+ycJWbmxkSbNAIshcyY/pBtjtzjBpDXmbT9yBd979H5BMiLNtLzYuIcwcYKzARfLIToL9aTa/je+hoYvgnWBNZP6SJNrLBPF+Y6PyWxObOiALRAZSBprEd3VDaGbtVofjjcrUm7xniVqvenrgIwAKYX1xdYenkjvKMG2JBatKId2JMgjVdbWOirOh5CTx/TkDjEaVjmvru+oc7ixe6ghE2Ft14mzCmzMXnMk0oyw+SekMKd2aaCOnwGoV+0lXgvEeCIFYAdEYGvGMBDcPgviCQFLj1S1+WRMg47Ru5eZ4Mu5rziH51hUUhqVAlG2NdXem1WB54UmHHbqh1UfzPmy9utqndbat+G+Y4rh3TtZsHPL7naKLW3IJ59J56ZC8m5/Znxrwsq5KOBHFpi5FirIw+Y9gtqntp14xL+/ktD1N+Y03SBF0igUuGeWNaNw38dwIsMBBzkV8Gi9PkTKiwZIxJe7mPnoCSbZ6c6zfKQ+l6qXjBAi3xYGU89LF25NV1i3ETuqaJyNk54grEXgBgdV9Z5GF79dZl10i/Ca3tj0RJGDa+iajQ6wQFMqXD+Oc8R18QIBKA9ZUphqOaHdsN7/wFZJcI6zT4bfUqP04dKhHZn96g4gYmdElW6XXEJTytrIo3OL8yslMB/H3Ra/laIv59T6/5hkXZoCrlP9JYhGaKV3hvY6AucrRwaQ7WCKY9M0Q2WMUyPDh3Sk gSY7soNW 0xNYdNUrQeqeF4201CfUTJnQnSs292h6qnQRem0ncHMZ02CxmgDF7lLsgBFtoya+Yyc0lMRWQSpiAcm1cWLsGvrDbgcdNAtlkKCYNBIvE/oISKKI9aQsuxzBhd1jZNmkFwzl1X4IMno1AbMFgHoL3gPzj7R1QP05jjxFHEECsxWnqX/n5LDCWoxic7Knvn/Q7LwM4h/ybVJDfiVDcY/lzDmkwMyERxWHzlGa6HsPuIx8SB6u9GWeViWe2ixVOa2VwDvrjLxxuIZzlvt0oKU7F8tKemJWPb+O5QvPq/5hkj6FtMIc= 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. Tested-by: John Hubbard 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) {