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 1796FC77B75 for ; Tue, 16 May 2023 08:45:44 +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=dzhZp0HD7Q7Ww5qO6Mh2Rl+y44V15OTYsZHr0xy2XwU=; b=qbdY5WabXNqWkK BmSwmKSBlldHYV08P5F68BkeNpco6PlSJguWsHOzmnZznlHREvf4y4g9jfWqw0lGamgKiZqPTyxlF nAoV42hEPmlxoZEBOkYDEMUPd9vVwte1SPQXs3yPwNFIdOOdnO6O81vdDOBEHir8eQniVnti2objz gNnYyS+SsiinncRLiyn727avS0+preGc2WlPJ8xarK6z0bvPjdt9/VniDox5TORRIc+p/E1LtAyY7 xTQHUwa0gbFjcMnZkaoDxq1EHpFLIoUOg2Xd/Mx2ilK0AFgC7CSKEIh9Ud1auEHQ3aIQk5ki+8Gqj RJKzygPVcTO8NHKfiVMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pyqJ8-004uHX-0A; Tue, 16 May 2023 08:45:22 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pyqJ3-004uEl-2z for linux-arm-kernel@lists.infradead.org; Tue, 16 May 2023 08:45:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=9JGvtPYX7dIVVK6xaFykrwaQ9dd2AjCgm6XmSZLNI7c=; b=IaVfY1l/lKxu3ag81OENShxcF6 I1sbAy/X7tF7FhfPGr36AM2zTu+6+pgpKxm7mGOp6aXgGDEHMdzQeq/isETgSfIHtqKlFF+izD9kP QVj+DCaPB6uAg6bjDZjfbuId0NMwyasmzT0Uvvs6mx+ifmlEE6B4ihYx2vN85G+aWoIZJIJpB0+xY EpfaIN9jBED/47W6jZSe+rt0svQG50BkOdtX+AclXzfKknCS3f/Gfnm6O/euThUrf197M9Zft9Zxg r0g+nhIDgZpnEQNAWc+7pyDzyvccTZXRb1puUblzo8sYjmyOMj3c5UTqpPFrUjNSCXoTgbZNb9MDp vf0+RD4Q==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:41390) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pyqIx-0005OL-A4; Tue, 16 May 2023 09:45:11 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pyqIu-0000fR-Cq; Tue, 16 May 2023 09:45:08 +0100 Date: Tue, 16 May 2023 09:45:08 +0100 From: "Russell King (Oracle)" To: Baoquan He Cc: Thomas Gleixner , Uladzislau Rezki , Andrew Morton , linux-mm@kvack.org, Christoph Hellwig , Lorenzo Stoakes , Peter Zijlstra , John Ogness , linux-arm-kernel@lists.infradead.org, Mark Rutland , Marc Zyngier Subject: Re: Excessive TLB flush ranges Message-ID: References: <87a5y5a6kj.ffs@tglx> <87o7mk93tc.ffs@tglx> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230516_014517_968628_2BF4B89A X-CRM114-Status: GOOD ( 26.68 ) 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 Tue, May 16, 2023 at 04:07:17PM +0800, Baoquan He wrote: > On 05/16/23 at 08:40am, Thomas Gleixner wrote: > > On Tue, May 16 2023 at 10:26, Baoquan He wrote: > > > On 05/15/23 at 08:17pm, Uladzislau Rezki wrote: > > >> For systems which lack a full TLB flush and to flush a long range is > > >> a problem(it takes time), probably we can flush VA one by one. Because > > >> currently we calculate a flush range [min:max] and that range includes > > >> the space that might not be mapped at all. Like below: > > > > > > It's fine if we only calculate a flush range of [min:max] with VA. In > > > vm_reset_perms(), it calculates the flush range with the impacted direct > > > mapping range, then merge it with VA's range. That looks really strange > > > and surprising. If the vm->pages[] are got from a lower part of physical > > > memory, the final merged flush will span tremendous range. Wondering why > > > we need merge the direct map range with VA range, then do flush. Not > > > sure if I misunderstand it. > > > > So what happens on this BPF teardown is: > > > > The vfree(8k) ends up flushing 3 entries. The actual vmalloc part (2) and > > one extra which is in the direct map. I haven't verified that yet, but I > > assume it's the alias of one of the vmalloc'ed pages. > > It looks like the reason. As Uladzislau pointed out, ARCH-es may > have full TLB flush, so won't get trouble from the merged flush > in the calculated [min:max] way, e.g arm64 and x86's flush_tlb_kernel_range(). > However, arm32 seems lacking the ability of full TLB flash. If agreed, I > can make a draft patch to do the flush for direct map and VA seperately, > see if it works. The question IMHO is not so much whether there's a full-TLB flush available, but whether it is appropriate to use it. If we're only wanting to flush a small number of TLB entries but over a sparse range (which seems to be Thomas' situation), does it make any sense to flush all TLB entries? I don't think it does, but it depends how often this occurs. If we're doing it on a regular basis because of some workload, then that workload suffers. If it's a rare event then maybe that's okay to do. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel