From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1B9E4C4332F for ; Tue, 12 Dec 2023 11:36:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EMEAClvgrcYZl/XXrSxlhnBgweVHfW72kt/7xyrUHT8=; b=v5h4zMBjjRtGN9 2RV2c9YZVoAvgCi7W1c+l72SNMcQeDLJhTPdlkxcPk5AYhRtAVJpvgRQPKB6xVfK+qOqWQfpAcFrd wfe84OrG137MWM6g6sFKBknjsXicwpGZkpn4/Jq0VmRr69BZNGImqrf1VxvGxJ/3qASPwIdY1QvEK v97iTYTPckqsQtteEALStfWxDyjVzbiVAXT7PLgIVcUNUFJBTDL4zAy5AtG62UmpSO4/e4/zDxkHX FE1J03HZHmAaVPvI6gX/Mx2Sx+hCd4P/HP3irz+fgXKvNS4lkLKe0Q1C8TgbDj5+uGIkg1Pv2bZ1k j9aIC2G0ca62ShnMPWKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rD12y-00BYEO-2n; Tue, 12 Dec 2023 11:35:32 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rD12v-00BYDh-1w for linux-arm-kernel@lists.infradead.org; Tue, 12 Dec 2023 11:35:31 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 3339BCE191E; Tue, 12 Dec 2023 11:35:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62A08C433C7; Tue, 12 Dec 2023 11:35:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702380926; bh=Pob5Ge2gFIJG7Q0aQ/vTG1K/p3ucC0PSIOzsvYWOUOo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ChlUuItjd2gyTeqVgCQDk6fs8gtd16Kn8Oa3hq1KQzsfcuMRdXOO94YGbS6d5rrtZ BIHf3nUh3dH7CNtKK8gAKoXCsANL6oDpEQ2BhHM6yakdd320Tcejtf3TfUzKQM3gfA 18OY+N62lKSXe+hmmqQCRvVphdJzXtnDQ8n8izElVjsmny2rNvVd/+ei6Wnkuz6US5 GTNZvoLtx7xOdkB15mZ1bbde96IYyYuwN/mNJiVxSsw7KC6kAZ5WLZ0eHhrOzRa2X9 /9RE21fot+BNmpRpDI8ZajgjLklP0liEfU2d8VJ2EEywo6wLZ23gCYIcrY3hy08OMP BDjmon0SElTXQ== Date: Tue, 12 Dec 2023 11:35:17 +0000 From: Will Deacon To: Ryan Roberts Cc: Catalin Marinas , 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 , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 12/15] arm64/mm: Split __flush_tlb_range() to elide trailing DSB Message-ID: <20231212113517.GA28857@willie-the-truck> References: <20231204105440.61448-1-ryan.roberts@arm.com> <20231204105440.61448-13-ryan.roberts@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231204105440.61448-13-ryan.roberts@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231212_033530_116639_37892EE3 X-CRM114-Status: GOOD ( 18.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Dec 04, 2023 at 10:54:37AM +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. > > 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); > +} Hmm, are you sure it's safe to defer the DSB until after the secondary TLB invalidation? It will have a subtle effect on e.g. an SMMU participating in broadcast TLB maintenance, because now the ATC will be invalidated before completion of the TLB invalidation and it's not obviously safe to me. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel