Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp766357ybl; Fri, 31 Jan 2020 07:38:48 -0800 (PST) X-Google-Smtp-Source: APXvYqw1y9EnePVVR48LdLyUc+TzRDIman+NL2YtDgjnPG6i0HA+xLk78BYLbiNjf4T7uuqZI9C4 X-Received: by 2002:a05:6830:22ca:: with SMTP id q10mr8771607otc.280.1580485127861; Fri, 31 Jan 2020 07:38:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580485127; cv=none; d=google.com; s=arc-20160816; b=O9bdsotDkL8JaRJasJrNr859+19+mwNwdC4/clEbULQrHiB46O3YdiSHCEJRMIvYYQ vcC4KoahuofueTvrYotcq1j1BE9lSsnAankCEQOEUlRqvoFhfKFthQjUTfr0twtblh4I ieXSuoDPPEzjO7h5TP2as8rovDIXbVP+D7KhIvvA5/AbtpZl4YdPN/NjHC5xLdQdpL/3 9OBVtwwfDIxCu4n4E4T1HZzB8aoDbgF/2DfUxKmPDcv/BaTy1TN9JWeGtYKKGN2ubGut 0v6WpUdwD+QQ2f+Zm3DnNkY89PvS4o8moBsr6Xhv6UAmVD2ZTccECzrOyaV1p3LquTpm v5Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:message-id :dkim-signature; bh=rwibZjUuY57oEQV4vttL8T5XPDBQagD/WKxnULqhffM=; b=brdYhoyZT3XXUbCULGyB8Pwn9+duAY8nn/zLO6ZF022g8Qqx69Cf9MrcW0kypkFtFX AcIDE3oZlj74c252mkoP143Z5ol+peFt9IOiRsabkL54xifHH7CuDewk835+Li6dNJLA 9Slk2OLhqVDtAi1ksbtJi7aYtUJfNS3LtCxys5RcvjxL5wqZ/zgRUFvFR97PM1/OTCyl n+qYslrBzc2lXHn/NgtKjGTVI+RRFQe1EXcM7Q2xdrKmQFkuDzAKnWuKj/5PWygXNQFB uIDM62rq/GcCo90jcTwW998Rc0RIp/EJ/v8gWhoMupP1D+LJXs+t7WoRttJ5bbL7tLwq tYGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=amAps2lu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q131si4169381oig.203.2020.01.31.07.38.35; Fri, 31 Jan 2020 07:38:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=amAps2lu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729171AbgAaPhh (ORCPT + 99 others); Fri, 31 Jan 2020 10:37:37 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:39133 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729004AbgAaPhh (ORCPT ); Fri, 31 Jan 2020 10:37:37 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 488LvK75YVz9vBLm; Fri, 31 Jan 2020 16:37:33 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=amAps2lu; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id 1Zr0D3p_eBNz; Fri, 31 Jan 2020 16:37:33 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 488LvK6366z9vBL4; Fri, 31 Jan 2020 16:37:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1580485053; bh=rwibZjUuY57oEQV4vttL8T5XPDBQagD/WKxnULqhffM=; h=From:Subject:To:Cc:Date:From; b=amAps2luD9CY/AyDhuukwxNmDJo9InG+AgrqpVbn+FSyUyZ/Aq0Lmk2GEz5Ocb+8s kgkdhI2FExbkFe22ScmUkb4z2arjQ4AvOhv+wG5phhY/FYyxIGhHmGTN5eUlTAojaJ 4s4qiroibsIysfGSqfHMGQBgEwYmjmprkXALr77k= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 601B68B8B6; Fri, 31 Jan 2020 16:37:35 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id R76Xz6559bST; Fri, 31 Jan 2020 16:37:35 +0100 (CET) Received: from po14934vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 29FC38B8B4; Fri, 31 Jan 2020 16:37:35 +0100 (CET) Received: by po14934vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 2DF716528B; Fri, 31 Jan 2020 15:37:35 +0000 (UTC) Message-Id: <8cc8c64755ae63a6ef2b9808c1874664cdff8869.1580485010.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH] powerpc/nohash: Don't flush all TLBs when flushing one page To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Fri, 31 Jan 2020 15:37:35 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When flushing a range, the flushing function flushes all TLBs. When the range is a single page, do a page flush instead. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/nohash/tlb.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/mm/nohash/tlb.c b/arch/powerpc/mm/nohash/tlb.c index 696f568253a0..3d05d70c54dc 100644 --- a/arch/powerpc/mm/nohash/tlb.c +++ b/arch/powerpc/mm/nohash/tlb.c @@ -362,13 +362,32 @@ void __init early_init_mmu_47x(void) */ void flush_tlb_kernel_range(unsigned long start, unsigned long end) { + int tsize = mmu_get_tsize(mmu_virtual_psize); + #ifdef CONFIG_SMP preempt_disable(); - smp_call_function(do_flush_tlb_mm_ipi, NULL, 1); - _tlbil_pid(0); +#endif + start = ALIGN_DOWN(start, PAGE_SIZE); + end = ALIGN(end, PAGE_SIZE); + if (end - start == PAGE_SIZE) { +#ifdef CONFIG_SMP + struct tlb_flush_param p = { + .pid = 0, + .addr = start, + .tsize = tsize, + .ind = 0, + }; + smp_call_function(do_flush_tlb_page_ipi, &p, 1); +#endif + _tlbil_va(start, 0, tsize, 0); + } else { +#ifdef CONFIG_SMP + smp_call_function(do_flush_tlb_mm_ipi, NULL, 1); +#endif + _tlbil_pid(0); + } +#ifdef CONFIG_SMP preempt_enable(); -#else - _tlbil_pid(0); #endif } EXPORT_SYMBOL(flush_tlb_kernel_range); -- 2.25.0