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: 10544067 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 965021805 for ; Wed, 25 Jul 2018 14:07:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 859352022C for ; Wed, 25 Jul 2018 14:07:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79692206E2; Wed, 25 Jul 2018 14:07:06 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, SUSPICIOUS_RECIPS autolearn=no 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 1BE182022C for ; Wed, 25 Jul 2018 14:07:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B6616B02BA; Wed, 25 Jul 2018 10:07:04 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 365B76B02BC; Wed, 25 Jul 2018 10:07:04 -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 20B2B6B02BD; Wed, 25 Jul 2018 10:07:04 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by kanga.kvack.org (Postfix) with ESMTP id CCC0C6B02BA for ; Wed, 25 Jul 2018 10:07:03 -0400 (EDT) Received: by mail-pg1-f197.google.com with SMTP id q12-v6so4891866pgp.6 for ; Wed, 25 Jul 2018 07:07:03 -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:from:to:cc:subject:date :message-id:in-reply-to:references; bh=/jOJ/+W2JSaRGc382cEHsBJ4YMQ1luV4W/5/qP+a/jo=; b=iqLeHHCkwlZPC+0aMc154dwdQ2SJAcr1R492FcMYcdxBd2woS1EdoJI+iefg42FwGa P7Zqgw0GGyWlR8NBV9ReysgjbFUnjrsUA/ry7GID729l5kqS6WWlISX2m+HKbHv9ElAY S+NblY4L3CL7lu+pMfBd48XADk74ttjImtOJP9djWBlOlsBQl6p+jibHWq3fnfO8yeCa 3nqxprrY9yxUmkZHdlFDVOgdhmaZQQvopTpWmjJEwcXNdogEGczEmS3AVBxBuVuBvBOZ oAY32awMd1PMYlUt67nSCSTXU/fFBxOL2LKnxHcLWYVJQpdn272sh6AoZlFXgSyI+Sa7 C71Q== X-Gm-Message-State: AOUpUlGAatAbPFkekKjxKbtbuW7WjDqfCO6faXg5U/HK9B3MDzwrqJVB R1oeHgxCvvea8iVCfqDA952M+2HuvIWmcGElfwcLyCMEAsGtIW45cFAxbwyuBzxyHLaUG34Uw49 uH6ityEP9MrYKMl5BDw2Ex6Fu22Gfw6f6NaZVG3NUbOEH289halDjs92HhdyYdntdSJ0A4qCsdT YB1UmMfdAXtLwA4YmFIts5Sja80/Dy0MBYLAj8XZJROp3SfnL5WI96AJqPI86z7VOaZjPUT44XZ bF06z/fG0bW99FBzj8g3w7JOUpXx8d1RE6SafQ02QLK7ix4hI97oYWJlpqXpwL3llKPGK7l+do+ fesGiEfEmMQlYQGnQbk8gMizaEuKMhru6zCWFvwiSvHRfBXutlf+TYkjk6AICB/ejGJpwWIKV3e f X-Received: by 2002:a17:902:5281:: with SMTP id a1-v6mr21047496pli.73.1532527623519; Wed, 25 Jul 2018 07:07:03 -0700 (PDT) X-Received: by 2002:a17:902:5281:: with SMTP id a1-v6mr21047454pli.73.1532527622780; Wed, 25 Jul 2018 07:07:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532527622; cv=none; d=google.com; s=arc-20160816; b=YryJ/uic3qya3MmicwfCzoJA33gqj/vn2RTBvqWxj7a6f/DnfBLFdgqwqnJzHsZCiX 0Hnz1YqwPjNCiFgCH6A4ZMJhqBGvBLxkzVMSaBnDhJnvgDEEkRnEuZ4BeTHBCxDID9O6 0saaSv7R5Zkc/NeZQ58zI5Up5LBgjgANauLsk4tmRjxsHMs3V0EBd/Zx+Y6BkGvxJfKC n+VZef4rgG0ENzVtzm9+6Wf+fQFcPSzFL4fBWD27MR3yOFikAKdndMlXJgx17KAtoCfv 52PNrgef3wi4K8QBCwZOoYwpckBHIqBekNPrqaNebIYSKfLNsVjgmk+AOeKPmR3pVOJa 4Bpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=/jOJ/+W2JSaRGc382cEHsBJ4YMQ1luV4W/5/qP+a/jo=; b=lsZ2wVxEw2BoJ3Ohd0zABS4FPzpcxZw2W9lfmjHtbMpVjBxceI8lnmVBYRcz33JV71 euDnRXV9IbeaCv00swD0syvE+CwhXvvrHTNeCfUPBK4NU9o9QIcN+aa+WdFL47sNNKBe jxMZC6ZiZsLe8CjvDCnkXWwdSyJq4c4eGeSXEweFXjhlgD68tutazy0nzzhq+XkkaTRY NI3px8ibVz/1+ahACjo01/fEcArrMTSveoHx3FuJO7SyuYLNXDcLdvCJO7ZXFyPYZbih FfKty8kdN0E8zUfYyxgQ02BBrKJORlh4lEvAa9VrrUtUaOuOIC34TARnPfvoKo/7414F 7lDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AVI4jmNY; spf=pass (google.com: domain of npiggin@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=npiggin@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id x13-v6sor4435317pll.106.2018.07.25.07.07.02 for (Google Transport Security); Wed, 25 Jul 2018 07:07:02 -0700 (PDT) Received-SPF: pass (google.com: domain of npiggin@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AVI4jmNY; spf=pass (google.com: domain of npiggin@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=npiggin@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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-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 Cc: Nicholas Piggin , linuxppc-dev@lists.ozlabs.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.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-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 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,