From patchwork Wed Sep 26 11:36:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 10615823 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65DC214BD for ; Wed, 26 Sep 2018 11:55:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57A002A987 for ; Wed, 26 Sep 2018 11:55:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A5BD2A992; Wed, 26 Sep 2018 11:55:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 570762A98A for ; Wed, 26 Sep 2018 11:55:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7A0C48E0017; Wed, 26 Sep 2018 07:55:29 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 752D28E000F; Wed, 26 Sep 2018 07:55:29 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5CBB28E0017; Wed, 26 Sep 2018 07:55:29 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by kanga.kvack.org (Postfix) with ESMTP id 18C478E000F for ; Wed, 26 Sep 2018 07:55:29 -0400 (EDT) Received: by mail-pl1-f200.google.com with SMTP id m3-v6so10680709plt.9 for ; Wed, 26 Sep 2018 04:55:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:message-id:user-agent:date:from :to:cc:subject:references:mime-version; bh=aaiTxqjuwEt1CjB6UBF0EKgCYMTbvgoKK5cB1HwCicU=; b=gY9K+bQlfXNJLYg8qWrbk5fslVn+/2UZI9AmMiwLXYhI9xs8ze6sdstrGg8WlmQTqE +es2SIQVzRSzb6NeL82T7/lqJ5BX/FiaYn7cbSmLAkx7oP0SMqwZXE+XZbYNicWLLTGa qlrgo9jO7IsCo8WsVsdFMtVYUf8Nsi2HWKe8OwbdQPdSkmQmo5NRf4gOQD44iqJiRZ+o ZHK1CCAu26WNq1VeH48ytegxRM3g3bB9vwLYcZ5aJd2k5hXmyqQcmfnOx6AQqKK+/yNB s4yKi1FljdenNK6yXceW1XO8XGH3zu45805s24aRbPV+C/Hvk4o50RmCPE57RQMo70RV RYMw== X-Gm-Message-State: ABuFfogLQkokiXbf36JbLXJfSdyTsavoMJzBGtkidnM8xn+SdAWX5WBM DahXoDwVgIwwJ/N9HY4Dm2JBFqIjkGcrV82lr2kYXEWdwacrIqWO/MkpVUBeSp+JuJwHxBw/xxC h/bxgPg61z41PJP3e+Z0X5srQc7SI/zn+WBvYhIhZcsaGtJ4Op0Y+oZCAt6K6Hi0nLA== X-Received: by 2002:a62:63c2:: with SMTP id x185-v6mr5913932pfb.13.1537962928760; Wed, 26 Sep 2018 04:55:28 -0700 (PDT) X-Google-Smtp-Source: ACcGV63y8rWoGiAwIAXyakbTIoYjSsk8ilMloJTud1OBPWOfIKmal75GHgDYmtgpT/WKzJUALGGL X-Received: by 2002:a62:63c2:: with SMTP id x185-v6mr5913861pfb.13.1537962927673; Wed, 26 Sep 2018 04:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537962927; cv=none; d=google.com; s=arc-20160816; b=orcIUjBTLcEXk6sh+sKETxXx4SAThjaUSio/9pZzBWU+njpdXK5mIitce8woCNfo9f SjBey8xnTjJSmXSlF5ZsHvYdU9eDjjjoBl7PAonHTvvZXTZ1E7HVC3yHtQ/lrBGCek9z C4GReGjJFqkoci3W8Qx37EA2qE2WtdxjO7+PYNZqxYqGDoKQ9rd02xBOWBderyRDNDAK /yl//VPIh3k/lIcAwDLz+zDMGbNi0SE/Gyo4hwJ/APkdPMfmj5ev0ieQkyBmhJK40bCQ pOzzey6dlXV/6r0x7aMFL+zITBLWzbaCWwfxYH0dDDVqxpiZkCIulLnEWrqT8fkMmv+L KeuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:subject:cc:to:from:date:user-agent :message-id:dkim-signature; bh=aaiTxqjuwEt1CjB6UBF0EKgCYMTbvgoKK5cB1HwCicU=; b=n5Z93NBVXZ4XSy/4/OwICqjlHu7reIHOjajjhctVwv8rVGZrK/RQgrrJz7gEI8jSZu ctfy7IJKqMZ6quItBkQr+XwhcxlDCV3cb/HQeGfWaAUk7dvc7jIMhTGKkHSzeH+6JbLs BzZyXMx+5ifmYvV2Nl7IDnO80VoozcGI+G0K9w78uqmAno767VZ1ZKIO9fVgyMx7mMWe 2FJppC7AOj7VeTKLk0XFkKh4z19Hr68ME7LSr1uZZ3advlsT+9Afc7jk29a7UUDFJKer WUXUKac59hekF1/ZjVTd/LqhGedm1864hDmT23tNnunnecK2PB/Y4Oez2PlDPLVChDHu Sjrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=rE0laMPd; spf=pass (google.com: best guess record for domain of peterz@infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=peterz@infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id f6-v6si5113110plt.16.2018.09.26.04.55.27 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Sep 2018 04:55:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of peterz@infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=rE0laMPd; spf=pass (google.com: best guess record for domain of peterz@infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=peterz@infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=aaiTxqjuwEt1CjB6UBF0EKgCYMTbvgoKK5cB1HwCicU=; b=rE0laMPdZ+lJPFMsKUkkSf4cKT H5hNfTI1XW2vLuEVOK1kFsZpSiglLfxlJzl91+T/0H6I4VcwCELGeft8J/rLMxcwqcHMTYYFrUrFl RKtw+vgmNL+g5SrDgLw6QUxFMtxdh/7x96mJZcZadAGgV6T7Wyn2WTduILBUeSCjtmGSczlsW6ryq WI7zt+0btuCFpi6xxhrZeozLcc03hdA6bMXHGmwDHw7uN9V9XxQzBhXHh7YlcWZX96OngwiCwonKc 8tH4m7q0+FzssudKZSB5wVGSuQC1sDB36QHs2GL2RE6wMTMIIg2lruIMsdI2qXrSj+eq6iEPAZoXN LT9VsY4w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1g58Oc-000610-Kf; Wed, 26 Sep 2018 11:54:42 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 9281F206F1810; Wed, 26 Sep 2018 13:54:04 +0200 (CEST) Message-ID: <20180926114800.875099964@infradead.org> User-Agent: quilt/0.65 Date: Wed, 26 Sep 2018 13:36:30 +0200 From: Peter Zijlstra To: will.deacon@arm.com, aneesh.kumar@linux.vnet.ibm.com, akpm@linux-foundation.org, npiggin@gmail.com Cc: linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, peterz@infradead.org, linux@armlinux.org.uk, heiko.carstens@de.ibm.com, riel@surriel.com Subject: [PATCH 07/18] asm-generic/tlb: Invert HAVE_RCU_TABLE_INVALIDATE References: <20180926113623.863696043@infradead.org> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Make issuing a TLB invalidate for page-table pages the normal case. The reason is twofold: - too many invalidates is safer than too few, - most architectures use the linux page-tables natively and would thus require this. Make it an opt-out, instead of an opt-in. Acked-by: Will Deacon Signed-off-by: Peter Zijlstra (Intel) --- arch/Kconfig | 2 +- arch/arm64/Kconfig | 1 - arch/powerpc/Kconfig | 1 + arch/sparc/Kconfig | 1 + arch/x86/Kconfig | 1 - include/asm-generic/tlb.h | 9 +++++---- mm/mmu_gather.c | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) --- a/arch/Kconfig +++ b/arch/Kconfig @@ -362,7 +362,7 @@ config HAVE_ARCH_JUMP_LABEL config HAVE_RCU_TABLE_FREE bool -config HAVE_RCU_TABLE_INVALIDATE +config HAVE_RCU_TABLE_NO_INVALIDATE bool config HAVE_MMU_GATHER_PAGE_SIZE --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -142,7 +142,6 @@ config ARM64 select HAVE_PERF_USER_STACK_DUMP select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_RCU_TABLE_FREE - select HAVE_RCU_TABLE_INVALIDATE select HAVE_RSEQ select HAVE_STACKPROTECTOR select HAVE_SYSCALL_TRACEPOINTS --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -216,6 +216,7 @@ config PPC select HAVE_PERF_REGS select HAVE_PERF_USER_STACK_DUMP select HAVE_RCU_TABLE_FREE if SMP + select HAVE_RCU_TABLE_NO_INVALIDATE if HAVE_RCU_TABLE_FREE select HAVE_MMU_GATHER_PAGE_SIZE select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_RELIABLE_STACKTRACE if PPC64 && CPU_LITTLE_ENDIAN --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -64,6 +64,7 @@ config SPARC64 select HAVE_KRETPROBES select HAVE_KPROBES select HAVE_RCU_TABLE_FREE if SMP + select HAVE_RCU_TABLE_NO_INVALIDATE if HAVE_RCU_TABLE_FREE select HAVE_MEMBLOCK_NODE_MAP select HAVE_ARCH_TRANSPARENT_HUGEPAGE select HAVE_DYNAMIC_FTRACE --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -181,7 +181,6 @@ config X86 select HAVE_PERF_REGS select HAVE_PERF_USER_STACK_DUMP select HAVE_RCU_TABLE_FREE if PARAVIRT - select HAVE_RCU_TABLE_INVALIDATE if HAVE_RCU_TABLE_FREE select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_RELIABLE_STACKTRACE if X86_64 && (UNWINDER_FRAME_POINTER || UNWINDER_ORC) && STACK_VALIDATION select HAVE_STACKPROTECTOR if CC_HAS_SANE_STACKPROTECTOR --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -127,11 +127,12 @@ * When used, an architecture is expected to provide __tlb_remove_table() * which does the actual freeing of these pages. * - * HAVE_RCU_TABLE_INVALIDATE + * HAVE_RCU_TABLE_NO_INVALIDATE * - * This makes HAVE_RCU_TABLE_FREE call tlb_flush_mmu_tlbonly() before freeing - * the page-table pages. Required if you use HAVE_RCU_TABLE_FREE and your - * architecture uses the Linux page-tables natively. + * This makes HAVE_RCU_TABLE_FREE avoid calling tlb_flush_mmu_tlbonly() before + * freeing the page-table pages. This can be avoided if you use + * HAVE_RCU_TABLE_FREE and your architecture does _NOT_ use the Linux + * page-tables natively. * */ #define HAVE_GENERIC_MMU_GATHER --- a/mm/mmu_gather.c +++ b/mm/mmu_gather.c @@ -157,7 +157,7 @@ bool __tlb_remove_page_size(struct mmu_g */ static inline void tlb_table_invalidate(struct mmu_gather *tlb) { -#ifdef CONFIG_HAVE_RCU_TABLE_INVALIDATE +#ifndef CONFIG_HAVE_RCU_TABLE_NO_INVALIDATE /* * Invalidate page-table caches used by hardware walkers. Then we still * need to RCU-sched wait while freeing the pages because software