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 192FBCD128A for ; Mon, 8 Apr 2024 08:44:06 +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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=h41C29Ueg82mBa6z1Wj14EbQeE3RZqakNiCTQ599gEs=; b=4PVgMixa+4NUOs K1aopdHJKxKXr4TUKT0zyXZHYzV8IeBn/ACEqPr+RT29kE/HLiQJE3hhU6kvsJcaodOae1vg8PzOe lZm0n8h1P/vFR2yh9ZBRiaPcU+WVUnGpStK1tzD345zGbs4K7fPeCe5G6Kjpgt0WLpZWTIPMUNMQ3 obcMlZ0aLm8/CNOeCuIXZcuzV1a92ZrQg49HiH2GQwUQyEscZ5vAvFgzYmRut1AfpMyHinvOMqZlB Ku12XBND0LHH0ZXo5GYkjUk+FnQ6xbTzqnvthbMYINfx5PnMGPMUgxidX4SKdRw0Nc1ki7roj0XBV SCGrs2xYHC5Os6DQsoxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rtkbd-0000000EwNA-0ytT; Mon, 08 Apr 2024 08:43:57 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rtkba-0000000EwMQ-1nOg for linux-arm-kernel@lists.infradead.org; Mon, 08 Apr 2024 08:43:55 +0000 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 05A9C1007; Mon, 8 Apr 2024 01:44:19 -0700 (PDT) Received: from [10.57.73.169] (unknown [10.57.73.169]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6C0F03F766; Mon, 8 Apr 2024 01:43:46 -0700 (PDT) Message-ID: <27718d41-32cb-4976-b50e-e9237da7aedf@arm.com> Date: Mon, 8 Apr 2024 09:43:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 3/3] arm64: tlb: Allow range operation for MAX_TLBI_RANGE_PAGES Content-Language: en-GB To: Gavin Shan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, akpm@linux-foundation.org, maz@kernel.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 References: <20240405035852.1532010-1-gshan@redhat.com> <20240405035852.1532010-4-gshan@redhat.com> From: Ryan Roberts In-Reply-To: <20240405035852.1532010-4-gshan@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240408_014354_557945_F0552BA6 X-CRM114-Status: GOOD ( 15.34 ) 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 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. > flush_tlb_mm(vma->vm_mm); > return; > } _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel