From patchwork Wed Jul 25 14:06:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 10544075 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 D00531805 for ; Wed, 25 Jul 2018 14:08:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD8112A0E0 for ; Wed, 25 Jul 2018 14:08:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1E022A0E3; Wed, 25 Jul 2018 14:08:00 +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=-0.4 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,SUSPICIOUS_RECIPS autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5CE272A0E0 for ; Wed, 25 Jul 2018 14:08:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=EfMuOistqsAlX1rj21a6hKMTCOmU1rja2ZjSzGUdq2g=; b=sYhmOpyWchlGAKs0SdnpAv9PaX b2OQV+10JX6g6wwNVrQqUJYFn1iJpTk4OtYer37mmeSJawS56S+b2vVWGsC1uPscPLDvYOmusHDac bfiLtO/WchRh8F8nAH3ynoshLKN9sTt4HevGVxFsdWmUvv3hVTYddnqtq7rW4HwUkmEICX93MslCc 6U4SnaIeA6xbX1QnLDlojM/gIhbh/Phxbt4pXheQQkB8YzM3/FbSGEC5zHxQ/m24BckluuXQflcl5 jxUNC5M/11u1KZiN0ohSQ3kNI1yN/kuSWfqCfEM4kw6BOHnS/MJSDrRP00PhOsEPFiff80qyEohnL g1xYmJ+g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fiKSH-0004SU-Hr; Wed, 25 Jul 2018 14:07:53 +0000 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fiKRc-0003r2-Qt for linux-arm-kernel@lists.infradead.org; Wed, 25 Jul 2018 14:07:28 +0000 Received: by mail-pl0-x242.google.com with SMTP id 6-v6so3360095plb.0 for ; Wed, 25 Jul 2018 07:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/jOJ/+W2JSaRGc382cEHsBJ4YMQ1luV4W/5/qP+a/jo=; b=AVI4jmNYjgqDSMI3WJjS/MJXnTw/tSu8EiFLIssrPgdZhTHZLaKvPOCoEpnbETjqS4 WHjd/x8OQXdeOlIJZUbPRVxOpMGMwrcDzsTehdv1ptJRS1/qcrW9aF1kTRIh0XLb0sib XV1qaHllNNEDcAI65jnDZZ7P3MreQAr0+cZP1hvfEyu+KAC9ZUfhPnMW50xPszAp0y3H C9/m8i+9xcJCwcTacvN8SqAkzeONsqUQeD9sYBf05f2IZuZh+RGeze6vtqjx0oYHku1A l/GAg75BAYlWzv78239VYONTyVhDgOtMQjcHuhGA10RhHYWoC4q1YscpehOQ/d52IXnC LYfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/jOJ/+W2JSaRGc382cEHsBJ4YMQ1luV4W/5/qP+a/jo=; b=sW1H3qme47K5BEH2MiKyxlDWMq1IrjgIimPiyyY3t2mxJfKNcguCOtOvoa2HSED7e1 HwIhuKt+7Qrj/94+sMMSziCvybtEhwELqW978lvmn29gGs97xJ/+SstWaBbkYpi6Z7YH Ty14pzMpTsvu0XEDSmtUiu8tuEAgh17xIRfizzSK0j3lGod20F28Dw1+Hjgfmqcx1i+W olvZ/ww/xKMJwwy758eU4AIuyyu4uX0p5qG+Igm4vlN7lsx58Z+puG3tTdaGw8Atzu/O xnaNW3aqFvjRxFhwMGxZW3c9C55VhBBjYUGKoCWDn6UiH2VMzEWuG/7/7n48AaUBD/fA AwFg== X-Gm-Message-State: AOUpUlEaaILmIxFu7MSfIPuCrxH4b/CV6Kp1awkbOwMfMwnRyxA+KGtW CZsBbuZF0YphJRKnryoyE8g= X-Google-Smtp-Source: AAOMgpdxnMOTaEEmTL31SXnAKEmdYiRjkCxG7VwMPoXvmtNuKHYh+0w2cwP9DLIdwrLmpng7F58Sfw== X-Received: by 2002:a17:902:8697:: with SMTP id g23-v6mr21137522plo.292.1532527622385; Wed, 25 Jul 2018 07:07:02 -0700 (PDT) Received: from roar.au.ibm.com ([61.69.188.107]) by smtp.gmail.com with ESMTPSA id d132-v6sm20923421pga.10.2018.07.25.07.06.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jul 2018 07:07:01 -0700 (PDT) From: Nicholas Piggin To: linux-mm@kvack.org Subject: [RFC PATCH 3/4] mm: allow arch to have tlb_flush caled on an empty TLB range Date: Thu, 26 Jul 2018 00:06:40 +1000 Message-Id: <20180725140641.30372-4-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180725140641.30372-1-npiggin@gmail.com> References: <20180725140641.30372-1-npiggin@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180725_070713_405552_C9159072 X-CRM114-Status: GOOD ( 13.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Nicholas Piggin MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP powerpc wants to de-couple page table caching structure flushes from TLB flushes, which will make it possible to have mmu_gather with freed page table pages but no TLB range. These must be sent to tlb_flush, so allow the arch to specify when mmu_gather with empty ranges should have tlb_flush called. Signed-off-by: Nicholas Piggin --- include/asm-generic/tlb.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index b3353e21f3b3..b320c0cc8996 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -139,14 +139,27 @@ static inline void __tlb_reset_range(struct mmu_gather *tlb) } } +/* + * arch_tlb_mustflush specifies if tlb_flush is to be called even if the + * TLB range is empty (this can be the case for freeing page table pages + * if the arch does not adjust TLB range to cover them). + */ +#ifndef arch_tlb_mustflush +#define arch_tlb_mustflush(tlb) false +#endif + static inline void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb) { - if (!tlb->end) + unsigned long start = tlb->start; + unsigned long end = tlb->end; + + if (!(end || arch_tlb_mustflush(tlb))) return; tlb_flush(tlb); - mmu_notifier_invalidate_range(tlb->mm, tlb->start, tlb->end); __tlb_reset_range(tlb); + if (end) + mmu_notifier_invalidate_range(tlb->mm, start, end); } static inline void tlb_remove_page_size(struct mmu_gather *tlb,