Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp366650rdb; Thu, 15 Feb 2024 02:37:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXcpEh83FsyBezYEpIDdu/GPJVaAQy7OZ0PXXWUBs+mHITCQay+oo/gvkNVrjxuw2H0NbCJ1zu/q5yUmlr4QUNrlfwYdYCOsmQB6v1rlw== X-Google-Smtp-Source: AGHT+IH8k3mUoZ0Y8Uc56BIbsTTEH0GRkcvGeUIgpHziYgQc2FDTVDdMSLXLc5SqGJewumPn55tj X-Received: by 2002:a17:906:e2d9:b0:a3c:a65:7bd8 with SMTP id gr25-20020a170906e2d900b00a3c0a657bd8mr928447ejb.24.1707993467341; Thu, 15 Feb 2024 02:37:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707993467; cv=pass; d=google.com; s=arc-20160816; b=fsfPacErQbG9u960k4eKf4h0rgEMDTBdBgQkjZGUOVXgW+ucYOMA9lN73KxNScoB6X aTJHiqy6cJkkoKWSTpK+csTyKLNh0qD++vNLBkPusytamQD6AiNjVzGRwmxUCoUCVcCG Sn8ZJo+KRvRH8AFmu5dCNm+mcuhCqOg0YoxnogpxU6Luyt++cbc9U4l5BTJOU7R2mYPO PmMAG0kBa2aSd/j7icI0M66zJguaW+Ab4XbVoCJWlR0Usa3VYXmWbm3y+h/GZnc6B3P4 88Uwrbc6CL875GG42UxH1L8n4p/iMjeHWqPhaEiEDAJjKBLTl03U5unObNX9SBqrVnmv GQaQ== 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=4J1dTrrIzJ+DpallLluT2b35txLH0YV5OvrN+DtNofk=; fh=Heagowc1O8zVDXTyU76nJjOwDjz9r3Gi+0zmhF4ZELQ=; b=vXOE26ITSmS+jPAlzGI7ucc21FgoX7Nw6/W3CHFvgQvurWvJGbiHboSRYlVGEMLu0b /4F1zuiLteS0b/KJEbF3InU7yEc4KCdgmK7vHAFx0RLxMQRkc5fpJkOt9RX6MAiyp5A9 QKwqXxEK4UibtJ7vqI19vU1ItJBmhhwknbm+chDgQKp+BtQbNcIr94ygwyDi75HRcpH/ rSULuY+j5WXrdJjv0L6z5GiaRV0ch876Ivhawj3g/ifstP/hzMfg4Zq1myd4Z1+cWA0m o4uFxzLm4T72bRFBQOAFhmTspZNbKsaqQzjrSsksd1zsV6sGPJrVvMulsTyEhZbXMXLp Fawg==; 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-66648-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66648-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id la26-20020a170906ad9a00b00a3bd842545fsi517653ejb.395.2024.02.15.02.37.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 02:37:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66648-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-66648-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66648-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 196C21F21257 for ; Thu, 15 Feb 2024 10:37:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CEB2412F59D; Thu, 15 Feb 2024 10:33:00 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E50F012F38D for ; Thu, 15 Feb 2024 10:32:57 +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=1707993180; cv=none; b=MKTveGHENdRDJAb3iZsXJrfwGTAKvxLIm7uiXMK4ZkzQH9hk47NdVOfpqHbcscktIaMECtNU4lfyWBfULH+N3B+mzBFSMA8Mf4EWMRDWveTeX0FO0g7ujsTUAjLhJ9ZYMhjw07Vt60TgQq7IKMFCLp0Fp0/Gis02IzgByFgtF7g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707993180; c=relaxed/simple; bh=7hm98Uy4uzJ8moWfBkXOKwgSvNFZT6zUX8a/wpE/3D8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FhZCIDTh/YoMke6UJr7oV0TobnPA9odORjdckqVvniytUCwJCtlT9Rux8bTm8G3gLmP5X9IqYocQInQtErFkOw7HnAhsmm4OJ6KRT89J9UWKshYPsHTmtU9VAWNF5cPcJhE13Kq6cjJ6we2DkYtYErqJYSIZ82gf8P+rXu15Ug0= 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 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> 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. 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 --- 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) { -- 2.25.1