Message ID | 20240202080756.1453939-19-ryan.roberts@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-49432-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp279937dyc; Fri, 2 Feb 2024 00:14:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHeGbu34DnT2jiY44m+QGmmOm9VRMCr7q4F1cQMLvQgMKgcYvYl0m1fkpT19AUr6gusuooG X-Received: by 2002:a50:f603:0:b0:55f:d256:b745 with SMTP id c3-20020a50f603000000b0055fd256b745mr1773649edn.30.1706861641974; Fri, 02 Feb 2024 00:14:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706861641; cv=pass; d=google.com; s=arc-20160816; b=S60N1ut8wPB2s0JVw64rse10Lay0cZavE56lpB1/UnvsxCkavWsDClcgaiygqW0EXH HUd34DbnTnDPr8Mkh2zVEPUBrcBMB4ZOkqWRzUsPOiUqDEJW9MzaGWtGaPffNgv/FlM3 uXzh7+8Uk2PBK65vrftLoWhLg+9AYH2Xq1BakI/ukoZ3QW0LHSeLzehAyK7UgH+p3HcP P/a4WMvHuwa2ODKRrkio2+H4KgU3h1D1dcPcCWv1KcqKljXIAhUX2vicXpDkk1XFJMDd 30pWpJaeROivu9oNv0npH72KVWnuAo40P/iQYw9mEO6KbkCdenMCkYd5YqMwIse82Q4E PDIA== 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=FRrTlzE3p8cC7d5km9h1DtIXkpKyllJxB78QWhEHEs0=; b=vZeEIymbFgeGqa7T3HE0ij0tn5+6sGOVd6kw4jF0tT/zEgg/zrWPiFOJ8iLs3ULoKF asWO4jKd4itSlsGylIHJkhQ+N6eLghBmhuvZhXetSum9mDTJV3s8OARXkOXXXbxtKQUj gr1RX86t6WW1YE5OvPn3sHWjfzlz023KrdqbLui8NBdbuYN71JdutZ5Hfns9wWk7BXRM bee7emNhyh7Wn4YXqQuPLsfHQLRYv6EwBypANTiTU9CTZaPn5BtI/0tpzGJ8c8t1OUYs ZXjU5fUSHRSuE9XGN6kny1Wla5IQOPEQjrt2GfBE7EFiWSIm8a1s1569JXfJ8b3dHqVB +4Cg==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49432-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=1; AJvYcCU6n87T3h2xjZjZRcmqul9h4nrlQX7LbryQk4kcuvNFk/3R9H0Wn6BsFf4nYdN0ShbRecala0BNLHKHOoRzKbIjwf+j8A== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ee1-20020a056402290100b0054cd3ad8197si556073edb.306.2024.02.02.00.14.01 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 00:14:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49432-ouuuleilei=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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49432-ouuuleilei=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 93EAF1F23EFA for <ouuuleilei@gmail.com>; Fri, 2 Feb 2024 08:14:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5095B4D9EB; Fri, 2 Feb 2024 08:09:34 +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 <linux-kernel@vger.kernel.org>; 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 <ryan.roberts@arm.com> To: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Ard Biesheuvel <ardb@kernel.org>, Marc Zyngier <maz@kernel.org>, James Morse <james.morse@arm.com>, Andrey Ryabinin <ryabinin.a.a@gmail.com>, Andrew Morton <akpm@linux-foundation.org>, Matthew Wilcox <willy@infradead.org>, Mark Rutland <mark.rutland@arm.com>, David Hildenbrand <david@redhat.com>, Kefeng Wang <wangkefeng.wang@huawei.com>, John Hubbard <jhubbard@nvidia.com>, Zi Yan <ziy@nvidia.com>, Barry Song <21cnbao@gmail.com>, Alistair Popple <apopple@nvidia.com>, Yang Shi <shy828301@gmail.com>, Nicholas Piggin <npiggin@gmail.com>, Christophe Leroy <christophe.leroy@csgroup.eu>, "Aneesh Kumar K.V" <aneesh.kumar@kernel.org>, "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, "H. Peter Anvin" <hpa@zytor.com> Cc: Ryan Roberts <ryan.roberts@arm.com>, 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: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789774153113575546 X-GMAIL-MSGID: 1789774153113575546 |
Series |
Transparent Contiguous PTEs for User Mappings
|
|
Commit Message
Ryan Roberts
Feb. 2, 2024, 8:07 a.m. UTC
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 <jhubbard@nvidia.com> Signed-off-by: Ryan Roberts <ryan.roberts@arm.com> --- arch/arm64/include/asm/tlbflush.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
Comments
On 02.02.24 09:07, 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. > > Tested-by: John Hubbard <jhubbard@nvidia.com> > Signed-off-by: Ryan Roberts <ryan.roberts@arm.com> > --- > 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) > { You're now calling dsb() after mmu_notifier_arch_invalidate_secondary_tlbs(). In flush_tlb_mm(), we have the order dsb(ish); mmu_notifier_arch_invalidate_secondary_tlbs() In flush_tlb_page(), we have the effective order: mmu_notifier_arch_invalidate_secondary_tlbs() dsb(ish); In flush_tlb_range(), we used to have the order: dsb(ish); mmu_notifier_arch_invalidate_secondary_tlbs(); So I *suspect* having that DSB before mmu_notifier_arch_invalidate_secondary_tlbs() is fine. Hopefully, nothing in there relies on that placement. Maybe wort spelling out in the patch description Reviewed-by: David Hildenbrand <david@redhat.com>
On 12/02/2024 12:44, David Hildenbrand wrote: > On 02.02.24 09:07, 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. >> >> Tested-by: John Hubbard <jhubbard@nvidia.com> >> Signed-off-by: Ryan Roberts <ryan.roberts@arm.com> >> --- >> 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) >> { > > You're now calling dsb() after mmu_notifier_arch_invalidate_secondary_tlbs(). > > > In flush_tlb_mm(), we have the order > > dsb(ish); > mmu_notifier_arch_invalidate_secondary_tlbs() > > In flush_tlb_page(), we have the effective order: > > mmu_notifier_arch_invalidate_secondary_tlbs() > dsb(ish); > > In flush_tlb_range(), we used to have the order: > > dsb(ish); > mmu_notifier_arch_invalidate_secondary_tlbs(); > > > So I *suspect* having that DSB before > mmu_notifier_arch_invalidate_secondary_tlbs() is fine. Hopefully, nothing in > there relies on that placement. Will spotted this against v3. My argument was that I was following the existing pattern in flush_tlb_page(). Apparently that is not correct and needs changing, but the conclusion was to leave my change as is for now, since it is consistent and change them at a later date together. https://lore.kernel.org/linux-arm-kernel/123a58b0-2ea6-4da3-9719-98ca55c8095e@arm.com/ > > Maybe wort spelling out in the patch description > > Reviewed-by: David Hildenbrand <david@redhat.com> > Thanks!
On 12.02.24 14:05, Ryan Roberts wrote: > On 12/02/2024 12:44, David Hildenbrand wrote: >> On 02.02.24 09:07, 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. >>> >>> Tested-by: John Hubbard <jhubbard@nvidia.com> >>> Signed-off-by: Ryan Roberts <ryan.roberts@arm.com> >>> --- >>> 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) >>> { >> >> You're now calling dsb() after mmu_notifier_arch_invalidate_secondary_tlbs(). >> >> >> In flush_tlb_mm(), we have the order >> >> dsb(ish); >> mmu_notifier_arch_invalidate_secondary_tlbs() >> >> In flush_tlb_page(), we have the effective order: >> >> mmu_notifier_arch_invalidate_secondary_tlbs() >> dsb(ish); >> >> In flush_tlb_range(), we used to have the order: >> >> dsb(ish); >> mmu_notifier_arch_invalidate_secondary_tlbs(); >> >> >> So I *suspect* having that DSB before >> mmu_notifier_arch_invalidate_secondary_tlbs() is fine. Hopefully, nothing in >> there relies on that placement. > > Will spotted this against v3. My argument was that I was following the existing > pattern in flush_tlb_page(). Apparently that is not correct and needs changing, > but the conclusion was to leave my change as is for now, since it is consistent > and change them at a later date together. Good, I think you should add a few words to the patch description ("ordering might be incorrect, but is in-line with __flush_tlb_page()"; will be resolved separately).
On 12/02/2024 13:15, David Hildenbrand wrote: > On 12.02.24 14:05, Ryan Roberts wrote: >> On 12/02/2024 12:44, David Hildenbrand wrote: >>> On 02.02.24 09:07, 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. >>>> >>>> Tested-by: John Hubbard <jhubbard@nvidia.com> >>>> Signed-off-by: Ryan Roberts <ryan.roberts@arm.com> >>>> --- >>>> 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) >>>> { >>> >>> You're now calling dsb() after mmu_notifier_arch_invalidate_secondary_tlbs(). >>> >>> >>> In flush_tlb_mm(), we have the order >>> >>> dsb(ish); >>> mmu_notifier_arch_invalidate_secondary_tlbs() >>> >>> In flush_tlb_page(), we have the effective order: >>> >>> mmu_notifier_arch_invalidate_secondary_tlbs() >>> dsb(ish); >>> >>> In flush_tlb_range(), we used to have the order: >>> >>> dsb(ish); >>> mmu_notifier_arch_invalidate_secondary_tlbs(); >>> >>> >>> So I *suspect* having that DSB before >>> mmu_notifier_arch_invalidate_secondary_tlbs() is fine. Hopefully, nothing in >>> there relies on that placement. >> >> Will spotted this against v3. My argument was that I was following the existing >> pattern in flush_tlb_page(). Apparently that is not correct and needs changing, >> but the conclusion was to leave my change as is for now, since it is consistent >> and change them at a later date together. > > Good, I think you should add a few words to the patch description ("ordering > might be incorrect, but is in-line with __flush_tlb_page()"; will be resolved > separately). > ACK, will do. Thanks!
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) {