Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp686938rdb; Fri, 2 Feb 2024 00:13:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IFOZtquJ1rS7uqADHWfkngyqo+ZaQuvapoMGus0WR5SreHpG2sfxlVgcOg5FMDdykrepsb+ X-Received: by 2002:a17:906:abc2:b0:a2f:15b8:cbcd with SMTP id kq2-20020a170906abc200b00a2f15b8cbcdmr3112516ejb.8.1706861629385; Fri, 02 Feb 2024 00:13:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706861629; cv=pass; d=google.com; s=arc-20160816; b=DlUOTa2ilEGdWvobT9CPIACq0kgUCP7laLk/5v+icjjUOPG4jAe5moXE3g2MU2VFzZ aoiwvHg2DJSx7hw5ObXUfctountohci0dZIgdWv+ZklZLsvdLYHRg8VoPE4Tz898NupV 467ZgfHAcUNledPVPqhqXjeuEHbC9SeAucJ49H262HiAZ+T180VL994QVKvJfRkvGJxa B1+9eRs81blaLlA+5G3tQMigg7diIINSJ+/HKlGOzvCRtDCWWCKmFWa4bu+WmE47l6Fq vOewVnK+U4qgfggXO+EynuJGWCZubxnZSbwmB3AIFI5ykYMVbIY3psmrnKwyrpH4xPJT J8Aw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=nA5bUrRt6blUgSGh1rucsmmbrNp8un7UcFTvjqqTNjA=; fh=Ycnh8C3WCt9Wc6GUX5+OTuGQCmBw0i9yz0xSfhqEBQc=; b=RLzHJsl81gR9SjNR0L4BeC+nJrKvHRn7n9Pz89n9EBqcK2mkAT8W1/McJq2VOSZ/UW VeKVWVGYJPlCzHAw3YTZ7nMZQmpjFC4oA3zuVI+nTsWHIAhPMVifYfZpYNc/QR4gggJk S7eH6PjY3MRE51cOcgMW40UfJxv+M25dwr69v/HfiB1XWaFcYm2lg4B2kH8QUmdMtoA4 hJSEdt7NaQ0biqHftJAQzLoZHUtKrQbwgiaQUTS8zzDVcHAHPLRc7063iz1EeSMPbMyb 5p+nlHQGznfNLb4SbibHk6sRtYQyZ63C62wdfbb9dFGkzD80LMLMrHdYRRcNXel7hBj0 A6Mw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-49432-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49432-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=1; AJvYcCWoAsdYTlejUoQxj/+JrOrHlgP+aiF5NH1Wxn6mGSXNfkEmcv8IIGFW705e7/ZtQn5KqLWd/+kWk7mJjrHjasNgHNDS65dMhlmUqWXxEA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gw26-20020a170906f15a00b00a35b6a2117dsi562385ejb.172.2024.02.02.00.13.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 00:13:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49432-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-49432-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49432-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 24E321F23A9B for ; Fri, 2 Feb 2024 08:13:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 370A84D106; Fri, 2 Feb 2024 08:09:33 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD90C4CB45 for ; Fri, 2 Feb 2024 08:09:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706861372; cv=none; b=Fl0zMyfdTb/V4Xr4ls9BL/1igJg2ylqmc2cUgHzxadStRZK1JrtNTmRlGSCPM1TW/fc4gkOVbD1Eg5yzGhrMeW7LGstM0yU7JODvSgxObwEP3rHlsyX1UZ45fCTTG/z8P6tddiNwWFdnbHJTrnCuVGC7xSuPXIlQbvkG7sCcaHE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706861372; c=relaxed/simple; bh=6v3bAuhb3ybuKr98CSTFl92HE/KFoLGWUOZA4ZM01Yg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QhEUei6q2Xwor6fCTXD1nfbPYidPa7hCfuIo2zZEkx9v6gb8tqPHCDZTuDDEdpV79EjyS6Cm2cAYnO0bteYT4GN40lj0XHIWYoOiYO5II672dU3vMGwtjr9sE8ghXLS+/FiiPlz6wFg/W8Q9XHYgxn6QWDqiciqux/chunGFXsQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=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 704231BC0; Fri, 2 Feb 2024 00:10:12 -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 82DE43F5A1; Fri, 2 Feb 2024 00:09:21 -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 , Nicholas Piggin , Christophe Leroy , "Aneesh Kumar K.V" , "Naveen N. Rao" , 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 v5 18/25] arm64/mm: Split __flush_tlb_range() to elide trailing DSB Date: Fri, 2 Feb 2024 08:07:49 +0000 Message-Id: <20240202080756.1453939-19-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240202080756.1453939-1-ryan.roberts@arm.com> References: <20240202080756.1453939-1-ryan.roberts@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 79e932a1bdf8..50a765917327 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) { -- 2.25.1