From patchwork Fri May 2 15:20:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Salter X-Patchwork-Id: 4102391 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 61309BFF02 for ; Fri, 2 May 2014 15:23:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4B17220375 for ; Fri, 2 May 2014 15:23:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 660D220155 for ; Fri, 2 May 2014 15:23:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WgFH3-0002sT-24; Fri, 02 May 2014 15:21:17 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WgFGu-0002jv-KQ for linux-arm-kernel@lists.infradead.org; Fri, 02 May 2014 15:21:09 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s42FKidw025778 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 2 May 2014 11:20:44 -0400 Received: from deneb.redhat.com (ovpn-113-147.phx2.redhat.com [10.3.113.147]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s42FKhJP018333; Fri, 2 May 2014 11:20:44 -0400 From: Mark Salter To: Catalin Marinas , Will Deacon Subject: [PATCH 1/2] arm64: fix unnecessary tlb flushes Date: Fri, 2 May 2014 11:20:34 -0400 Message-Id: <1399044035-11274-2-git-send-email-msalter@redhat.com> In-Reply-To: <1399044035-11274-1-git-send-email-msalter@redhat.com> References: <1399044035-11274-1-git-send-email-msalter@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140502_082108_719830_A9FA384D X-CRM114-Status: GOOD ( 12.05 ) X-Spam-Score: -5.7 (-----) Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mark Salter X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The __cpu_flush_user_tlb_range() and __cpu_flush_user_tlb_range() functions loop through an address range by page to flush tlb entries. However, these functions assume a 4K page size. If the kernel is configured for 64k page sizes, these functions would execute the tlbi instruction 16 times per page rather than once. This patch uses the PAGE_SHIFT definition to ensure one tlb flush for any given page in the range. Signed-off-by: Mark Salter --- arch/arm64/mm/tlb.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/mm/tlb.S b/arch/arm64/mm/tlb.S index 19da91e..b818073 100644 --- a/arch/arm64/mm/tlb.S +++ b/arch/arm64/mm/tlb.S @@ -42,7 +42,7 @@ ENTRY(__cpu_flush_user_tlb_range) bfi x0, x3, #48, #16 // start VA and ASID bfi x1, x3, #48, #16 // end VA and ASID 1: tlbi vae1is, x0 // TLB invalidate by address and ASID - add x0, x0, #1 + add x0, x0, #(1 << (PAGE_SHIFT - 12)) cmp x0, x1 b.lo 1b dsb sy @@ -62,7 +62,7 @@ ENTRY(__cpu_flush_kern_tlb_range) lsr x0, x0, #12 // align address lsr x1, x1, #12 1: tlbi vaae1is, x0 // TLB invalidate by address - add x0, x0, #1 + add x0, x0, #(1 << (PAGE_SHIFT - 12)) cmp x0, x1 b.lo 1b dsb sy