From: Marc Zyngier <maz@kernel.org>
To: Ryan Roberts <ryan.roberts@arm.com>
Cc: Gavin Shan <gshan@redhat.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, catalin.marinas@arm.com,
will@kernel.org, akpm@linux-foundation.org,
oliver.upton@linux.dev, apopple@nvidia.com, rananta@google.com,
mark.rutland@arm.com, v-songbaohua@oppo.com,
yangyicong@hisilicon.com, shahuang@redhat.com, yihyu@redhat.com,
shan.gavin@gmail.com
Subject: Re: [PATCH v3 3/3] arm64: tlb: Allow range operation for MAX_TLBI_RANGE_PAGES
Date: Wed, 10 Apr 2024 09:50:20 +0100 [thread overview]
Message-ID: <86v84psisz.wl-maz@kernel.org> (raw)
In-Reply-To: <27718d41-32cb-4976-b50e-e9237da7aedf@arm.com>
On Mon, 08 Apr 2024 09:43:44 +0100,
Ryan Roberts <ryan.roberts@arm.com> wrote:
>
> On 05/04/2024 04:58, Gavin Shan wrote:
> > MAX_TLBI_RANGE_PAGES pages is covered by SCALE#3 and NUM#31 and it's
> > supported now. Allow TLBI RANGE operation when the number of pages is
> > equal to MAX_TLBI_RANGE_PAGES in __flush_tlb_range_nosync().
> >
> > Suggested-by: Marc Zyngier <maz@kernel.org>
> > Signed-off-by: Gavin Shan <gshan@redhat.com>
>
> Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
>
> > ---
> > arch/arm64/include/asm/tlbflush.h | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h
> > index 243d71f7bc1f..95fbc8c05607 100644
> > --- a/arch/arm64/include/asm/tlbflush.h
> > +++ b/arch/arm64/include/asm/tlbflush.h
> > @@ -446,11 +446,11 @@ static inline void __flush_tlb_range_nosync(struct vm_area_struct *vma,
> > * When not uses TLB range ops, we can handle up to
> > * (MAX_DVM_OPS - 1) pages;
> > * When uses TLB range ops, we can handle up to
> > - * (MAX_TLBI_RANGE_PAGES - 1) pages.
> > + * MAX_TLBI_RANGE_PAGES pages.
> > */
> > if ((!system_supports_tlb_range() &&
> > (end - start) >= (MAX_DVM_OPS * stride)) ||
> > - pages >= MAX_TLBI_RANGE_PAGES) {
> > + pages > MAX_TLBI_RANGE_PAGES) {
>
> As a further enhancement, I wonder if it might be better to test:
>
> pages * 4 / MAX_TLBI_RANGE_PAGES > MAX_DVM_OPS
>
> Then add an extra loop over __flush_tlb_range_op(), like KVM does.
>
> The math is trying to express that there are a maximum of 4 tlbi range
> instructions for MAX_TLBI_RANGE_PAGES pages (1 per scale) and we only need to
> fall back to flushing the whole mm if it could generate more than MAX_DVM_OPS ops.
That'd be a good enhancement indeed, although I wonder if that occurs
as often as we see it on the KVM side. But in any case, adding
consistency amongst the users of __flush_tlb_range_op() can only be
beneficial.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-04-10 8:50 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-05 3:58 [PATCH v3 0/3] arm64: tlb: Fix TLBI RANGE operand Gavin Shan
2024-04-05 3:58 ` [PATCH v3 1/3] " Gavin Shan
2024-04-05 17:10 ` Catalin Marinas
2024-04-08 8:29 ` Ryan Roberts
2024-04-10 8:45 ` Marc Zyngier
2024-04-11 9:59 ` Ryan Roberts
2024-04-10 7:55 ` Anshuman Khandual
2024-04-05 3:58 ` [PATCH v3 2/3] arm64: tlb: Improve __TLBI_VADDR_RANGE() Gavin Shan
2024-04-05 17:10 ` Catalin Marinas
2024-04-08 8:31 ` Ryan Roberts
2024-04-10 7:57 ` Anshuman Khandual
2024-04-05 3:58 ` [PATCH v3 3/3] arm64: tlb: Allow range operation for MAX_TLBI_RANGE_PAGES Gavin Shan
2024-04-05 17:12 ` Catalin Marinas
2024-04-08 8:43 ` Ryan Roberts
2024-04-10 8:50 ` Marc Zyngier [this message]
2024-04-11 10:44 ` Will Deacon
2024-04-10 7:58 ` Anshuman Khandual
2024-04-10 8:43 ` [PATCH v3 0/3] arm64: tlb: Fix TLBI RANGE operand Shaoqin Huang
2024-04-10 17:52 ` (subset) " Catalin Marinas
2024-04-12 16:06 ` Will Deacon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86v84psisz.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=catalin.marinas@arm.com \
--cc=gshan@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=oliver.upton@linux.dev \
--cc=rananta@google.com \
--cc=ryan.roberts@arm.com \
--cc=shahuang@redhat.com \
--cc=shan.gavin@gmail.com \
--cc=v-songbaohua@oppo.com \
--cc=will@kernel.org \
--cc=yangyicong@hisilicon.com \
--cc=yihyu@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).