From patchwork Fri Jul 17 11:10:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 11669909 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2D4B514E3 for ; Fri, 17 Jul 2020 11:14:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ED2B22076A for ; Fri, 17 Jul 2020 11:14:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="nyyWe7Al" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ED2B22076A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2D4C08D0047; Fri, 17 Jul 2020 07:14:53 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2838C8D0040; Fri, 17 Jul 2020 07:14:53 -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 14BDF8D0047; Fri, 17 Jul 2020 07:14:53 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0216.hostedemail.com [216.40.44.216]) by kanga.kvack.org (Postfix) with ESMTP id EF2FA8D0040 for ; Fri, 17 Jul 2020 07:14:52 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id ADD338248047 for ; Fri, 17 Jul 2020 11:14:52 +0000 (UTC) X-FDA: 77047310424.10.jam89_151270226f0a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 1C6B15C4C9 for ; Fri, 17 Jul 2020 11:14:26 +0000 (UTC) X-Spam-Summary: 10,1,0,3803341a8631814b,d41d8cd98f00b204,peterz@infradead.org,,RULES_HIT:41:69:152:355:379:404:800:960:965:966:968:973:988:989:1042:1183:1260:1261:1277:1313:1314:1345:1437:1516:1518:1535:1542:1593:1594:1711:1730:1747:1777:1792:1978:1981:2194:2196:2199:2200:2393:2559:2562:3138:3139:3140:3141:3142:3353:3865:3867:3868:3870:3871:3872:3874:4250:4385:4390:4395:5007:6261:6653:6742:8634:9592:10004:10400:11026:11473:11658:11914:12043:12048:12114:12296:12297:12438:12517:12519:12679:12683:13161:13229:14096:14097:14110:14181:14394:14659:14721:21080:21451:21627:21772:21795:30051:30054:30055,0,RBL:205.233.59.134:@infradead.org:.lbl8.mailshell.net-64.201.201.201 62.8.55.100;04yr1kcnah9ssb5phm6nyef3k85x8ypxo74kgpkm1aubd1w6q5mm7bwe9wxxbt1.xt6bhkh6con6c1ub9784t147i8jstwjc6ts885stprtwpbxqg3odb5t3j7kpccn.q-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMA RY:none X-HE-Tag: jam89_151270226f0a X-Filterd-Recvd-Size: 5022 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Fri, 17 Jul 2020 11:14:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=FUm1Ir3tUJJdB8qdXiVgRoT6pMrHP/Au+B6bLpG9yBA=; b=nyyWe7AlZtYdYSw49Sonwdxz2r KoQtTILVvXgJriLvasWk1Jh78FRgv6TwvxgW9OfTZnHOfpDdp0XRGhHkROr9M0rS8EE1ZWERqEZCb B4aLODSSNLN9BuP9VeeCsJRd1lCzDfSXB1o9kJN9xYbsbwUPyglN+NaEeeHEdZoR+6xv56usNBrAg E4M1ALbe2VwlUOwGw0TtgdLJDkOPtGYvMUB7f/nq3raSnihsty8lX4VKZGHH7eb7vSNthUAW4d0m3 ClYXcabVNTdqUwUgL5MxtmMU6aZva1lf7kQ0POZDK3bIv1gmVVtN3QMYW68wBEeJlpSJOR+/z2oJT H3PPqaIA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jwOJZ-0001Zl-Hw; Fri, 17 Jul 2020 11:14:05 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 1525F305E21; Fri, 17 Jul 2020 13:14:02 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id A9E9E203D408E; Fri, 17 Jul 2020 13:14:02 +0200 (CEST) Message-ID: <20200717111349.417688532@infradead.org> User-Agent: quilt/0.66 Date: Fri, 17 Jul 2020 13:10:06 +0200 From: Peter Zijlstra To: Will Deacon , "Aneesh Kumar K.V" , Andrew Morton , Nick Piggin , Peter Zijlstra Cc: 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: [PATCH v2 01/11] asm-generic/tlb: Fix MMU_GATHER_TABLE_FREE References: <20200717111005.024867618@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 1C6B15C4C9 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: 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. 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 */ -#ifdef tlb_needs_table_invalidate -#error tlb_needs_table_invalidate() requires MMU_GATHER_RCU_TABLE_FREE -#endif +/* + * 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_RCU_TABLE_FREE */ +#endif /* CONFIG_MMU_GATHER_TABLE_FREE */ #ifndef CONFIG_MMU_GATHER_NO_GATHER