Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp400343rdb; Thu, 15 Feb 2024 03:56:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUQmhT13GH4ShJ6MtFMrx/VrA65SLLBJi25YGp2IKGEEuoIsZmRLuUSqrT7ZO/pPClbep/flrvC4tbZbJxO58xu514n+nbDHp0R2TNtEQ== X-Google-Smtp-Source: AGHT+IHlgwD9FaZMesBywKX698ILBIsIbeD5EcJhAmAqN2YyWkz9WZA7U5+RPaPxot8Oo7sQO6jp X-Received: by 2002:a05:6a00:1898:b0:6e0:3d93:1bea with SMTP id x24-20020a056a00189800b006e03d931beamr2746463pfh.0.1707998165014; Thu, 15 Feb 2024 03:56:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707998165; cv=pass; d=google.com; s=arc-20160816; b=ZfkqA2t9lqGDxwenaO/sWokJ+bdyK60R79JJ3zjiEwcKVsbY7MjPk1/J9Fb1ZMKvm5 XltR80kBIsX8yMEAckj8GfDQMIcsthHa51A2ZQkRycGaA2lvwemcKE657ndasVISYOdB bkiWd0yu1aXakiNAuctb8en0HiWqhjqwyYxuAhokcC36UD53ZDKp6QloGMVK5up3k90r fP8SiYqCfVpKpg+FGnXV3J8gcFDsoewYMmWBdHw0zXW6JRJ3V9tEP4Hac4orbEjiYaDX MN3lyOYsySobNnYK4Qmuq/wxGVlFpePsb4nN3ffq2T9amignvoXmi3A/wwcNfmBry3Gv 00CQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=5AKcAvJHgC+3tcj8asxKg2o7dlfnv2wtx3VuiHIamrU=; fh=L1spsrv307lYRQgjy/3hwbvQ7NVbJ0u3hqQHYo6XNQg=; b=hPo1SUdsagf6CDh49W3OCjVOReLZokUnilt5XidFI7iM9yT/Cu7C7B9Aino3Pj8dM6 jcOd+xx98HX8Y9ItAfVDeg0+AHWd3Mtbe50AO2vOok0+K+FvcBsGX/R1bG19a4bAIWqW qxqKGjuXRQpIfsPgDUZx0FRgh5VRv6dMl4XCbWQD180NsY4Cs5kn0B8c2Sp2LhrutEyB p+T82ra5u4YAD8Jautl4hxa7xvg7gV8648fdgtAaBxvrZfXampCWd4kGuHgbUh/RgXq2 Dz8McY+ix5KYUmGxBucabKevpHhx+HSxLhTjEfvBfajvgDrOnLP6pI8kJNaL2mppY+0I CYZg==; 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-66781-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66781-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x24-20020a63b218000000b005cfbd190e58si997150pge.115.2024.02.15.03.56.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 03:56:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66781-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; 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-66781-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66781-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5C21528CD50 for ; Thu, 15 Feb 2024 11:24:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E72012B162; Thu, 15 Feb 2024 11:24:25 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C8FC129A91 for ; Thu, 15 Feb 2024 11:24:22 +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=1707996264; cv=none; b=IFehDqo2QCcSjOI5FAbNB7h0gQIV+w3r5vmPYFP8mmsDFxPEMYvueGcFftLm7Ohlw2c9JaciHKavr4e8eg1c8qAACSWjApEH2TEH0NXfN+4xpRaTH6wFqJcasdypaSFqJY83wj2GC3Jiy2tyXmmHPiURlK8ZlidChYQXlx0gXpg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707996264; c=relaxed/simple; bh=UKTmkMeT0BFC91Dpy0Xwa2YC5BAd2vCEeDM7XZy4Sl8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uDamQHx/ne3hwQTsz5k1g5kl97KiPDiQ4KhYhu//4YGhCc4cMgGPUmvdAdrsKTl5Vo1wiZPJIZoS1kyoLlgdbkmEC6HVZv6ov0ITIS5STU9imI8jpmMDthhO0BkRf8ga73Xi6Pyh2MwYu8RT2WJc/NZMpBmGZmV3oja/pIqIRD0= 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 6E6AEDA7; Thu, 15 Feb 2024 03:25:03 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.68.11]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E7DF33F7B4; Thu, 15 Feb 2024 03:24:18 -0800 (PST) Date: Thu, 15 Feb 2024 11:24:16 +0000 From: Mark Rutland To: Ryan Roberts Cc: Catalin Marinas , Will Deacon , Ard Biesheuvel , Marc Zyngier , James Morse , Andrey Ryabinin , Andrew Morton , Matthew Wilcox , 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" , linux-arm-kernel@lists.infradead.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 11/18] arm64/mm: Split __flush_tlb_range() to elide trailing DSB Message-ID: References: <20240215103205.2607016-1-ryan.roberts@arm.com> <20240215103205.2607016-12-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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240215103205.2607016-12-ryan.roberts@arm.com> On Thu, Feb 15, 2024 at 10:31:58AM +0000, Ryan Roberts wrote: > 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 Acked-by: Mark Rutland Mark. > --- > 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 >