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 A8F2ECD1284 for ; Thu, 11 Apr 2024 10:45:27 +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=Un6Hz9hP1tb7J9q1Vw0chZjDHGsR+BcE6WAP7k6CyVA=; b=abdwlQ7GJp/3T7 ueS/dBkmYzt19ZaVgyqBEJHdMiaXiLzhACoxUuGjfATjCjZvroC6tbfI5S0O6RU95yjw+OsluvOs3 BioG9c4TrG3JhdMY23Z3bNwjT4fdJPGFPNdImY/Cd1KHO2D9Z5QNambLEYweN+ABKSyQJ53NrDl9Q M+5B+4goo3RHQlXLIYQasCC3UpcRmPTlWI1+q6RDuKT6+Gxp8BcpUcViB8351LQUUcRp9K8QLhv26 4J3UsMnU6M9ZKLrnifhymCGbXd6M2Jg6Fm2y7GSRAQk/xSZ3eTCKLnNaD/pf3hb77x9kO6zEGsBEg Jcs7wpX7EVCwvG+GO8gA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rurva-0000000BZrv-43Ww; Thu, 11 Apr 2024 10:45:10 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rurvX-0000000BZrF-1Hmp for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2024 10:45:09 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id C81F16203A; Thu, 11 Apr 2024 10:45:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86122C433C7; Thu, 11 Apr 2024 10:45:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712832305; bh=zOZhCyofInF5tJbvL/B8olmi0NZALP0fLW9K93F807s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OOEcasxUTg6Pr2luRZ2/mV3+jf37n8Rpxs4riV2P4Iy5kIE25//PUqixha9xn+1vj usPjbZ3z3J69PWNXoY2BOVEaGUR3mO82gtprhkca/cUMZAO7TVyXZ50C1wxWy9jBa4 gy3LelbrSGfCWu+pGsY3KmGX2cashZxalVApJHIwLGl3EY1rAhCQNRwsi6W0+nF2s9 P0zwq+0MKxP4EeHRdqvEfXVhZTOEAmrpsjAV3RPzsRpq7nfbauI13M8JQxGWnVAKuJ /eG4EBxk2Gw6tU0Tde8hG7lymliNPFVhZPzPoEL4Wa0r3pzsLX1iuBBcux5uUJm3T2 9pQk3HWSM7nHA== Date: Thu, 11 Apr 2024 11:44:58 +0100 From: Will Deacon To: Marc Zyngier Cc: Ryan Roberts , Gavin Shan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, 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 Message-ID: <20240411104458.GA26265@willie-the-truck> References: <20240405035852.1532010-1-gshan@redhat.com> <20240405035852.1532010-4-gshan@redhat.com> <27718d41-32cb-4976-b50e-e9237da7aedf@arm.com> <86v84psisz.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <86v84psisz.wl-maz@kernel.org> 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-20240411_034507_544284_C8AFDA9E X-CRM114-Status: GOOD ( 24.98 ) 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 Wed, Apr 10, 2024 at 09:50:20AM +0100, Marc Zyngier wrote: > On Mon, 08 Apr 2024 09:43:44 +0100, > Ryan Roberts 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 > > > Signed-off-by: Gavin Shan > > > > Reviewed-by: Ryan Roberts > > > > > --- > > > 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. I'll pick patches 2 & 3 up for 6.10, but feel free to send stuff on top if you want to tweak this. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel