From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 680ACC43463 for ; Mon, 21 Sep 2020 12:02:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DE7A62151B for ; Mon, 21 Sep 2020 12:02:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="MZhdFO9O" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE7A62151B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6ED77900046; Mon, 21 Sep 2020 08:02:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 69B4D6B00AD; Mon, 21 Sep 2020 08:02:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 589F8900046; Mon, 21 Sep 2020 08:02:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0065.hostedemail.com [216.40.44.65]) by kanga.kvack.org (Postfix) with ESMTP id 3DB8A6B00AC for ; Mon, 21 Sep 2020 08:02:04 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id F1C731EE6 for ; Mon, 21 Sep 2020 12:02:03 +0000 (UTC) X-FDA: 77286930126.01.bee95_3b01fed27144 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id 808A1100480A0 for ; Mon, 21 Sep 2020 12:02:03 +0000 (UTC) X-HE-Tag: bee95_3b01fed27144 X-Filterd-Recvd-Size: 4497 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Mon, 21 Sep 2020 12:02:02 +0000 (UTC) Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D76AD214F1; Mon, 21 Sep 2020 12:01:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600689721; bh=VD2smVeL5fKzX8/5BW6movD+/oc7j4uKpSXeujhYnzY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MZhdFO9OycCcCUBnjfiGyIy/JaxKFEtv5Bu/qnbA6rGtTbl+Md/fDkO9tkdYlWS2x Ue0I4niE9CV0W6Ce/vSgHT+BGftRGHA91zmiGR1w4XdB8dStZDOoXbL9hWRe+kgmcg i69yLg7xhanQ5ee4QdS1Rk2Oj3rGOcpj3SLcfY48= Date: Mon, 21 Sep 2020 13:01:54 +0100 From: Will Deacon To: Peter Zijlstra Cc: "Aneesh Kumar K.V" , Andrew Morton , Nick Piggin , linux-arch@vger.kernel.org, linux-sh@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yoshinori Sato , Rich Felker , "David S. Miller" , Helge Deller , Geert Uytterhoeven , Paul Burton , Tony Luck , Richard Henderson , Nick Hu , Paul Walmsley , John Paul Adrian Glaubitz , Christoph Hellwig Subject: Re: [PATCH v2 01/11] asm-generic/tlb: Fix MMU_GATHER_TABLE_FREE Message-ID: <20200921120153.GE2139@willie-the-truck> References: <20200717111005.024867618@infradead.org> <20200717111349.417688532@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200717111349.417688532@infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) 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: On Fri, Jul 17, 2020 at 01:10:06PM +0200, Peter Zijlstra wrote: > The first MMU_GATHER_TABLE_FREE user showed a logic error in the > tlb_needs_table_invalidate() definition. Make sure any TABLE_FREE has > it defined. Could you elaborate on the logic error, please? It's difficult to see through all of the #ifdefs, but afaict we #error if tlb_needs_table_invalidate() is defined but not CONFIG_MMU_GATHER_RCU_TABLE_FREE with and without this patch. In other words, I'm failing to see what this patch changes! > Fixes: 0d6e24d430ef ("asm-generic/tlb: provide MMU_GATHER_TABLE_FREE") > Signed-off-by: Peter Zijlstra (Intel) > --- > include/asm-generic/tlb.h | 35 +++++++++++++++++++---------------- > 1 file changed, 19 insertions(+), 16 deletions(-) > > --- a/include/asm-generic/tlb.h > +++ b/include/asm-generic/tlb.h > @@ -172,6 +172,18 @@ > * various ptep_get_and_clear() functions. > */ > > +#ifndef CONFIG_MMU_GATHER_RCU_TABLE_FREE > + > +/* > + * Only RCU table free can override this; otherwise the TLBI is needed to > + * provide existence guarantees for software walkers. > + */ > +#ifdef tlb_needs_table_invalidate > +#error tlb_needs_table_invalidate() requires MMU_GATHER_RCU_TABLE_FREE > +#endif > + > +#endif /* CONFIG_MMU_GATHER_RCU_TABLE_FREE */ > + > #ifdef CONFIG_MMU_GATHER_TABLE_FREE > > struct mmu_table_batch { > @@ -187,17 +199,6 @@ struct mmu_table_batch { > > extern void tlb_remove_table(struct mmu_gather *tlb, void *table); > > -#else /* !CONFIG_MMU_GATHER_HAVE_TABLE_FREE */ > - > -/* > - * Without MMU_GATHER_TABLE_FREE the architecture is assumed to have page based > - * page directories and we can use the normal page batching to free them. > - */ > -#define tlb_remove_table(tlb, page) tlb_remove_page((tlb), (page)) > - > -#endif /* CONFIG_MMU_GATHER_TABLE_FREE */ > - > -#ifdef CONFIG_MMU_GATHER_RCU_TABLE_FREE > /* > * This allows an architecture that does not use the linux page-tables for > * hardware to skip the TLBI when freeing page tables. > @@ -206,13 +207,15 @@ extern void tlb_remove_table(struct mmu_ > #define tlb_needs_table_invalidate() (true) > #endif > > -#else > +#else /* !CONFIG_MMU_GATHER_HAVE_TABLE_FREE */ While you're at it, this comment can be fixed to refer to CONFIG_MMU_GATHER_RCU_TABLE_FREE. Will