From patchwork Fri Jul 17 11:10:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 11669907 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 43F0A1392 for ; Fri, 17 Jul 2020 11:14:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 067CB2076A for ; Fri, 17 Jul 2020 11:14:44 +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="DJYHEvab" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 067CB2076A 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 F31558D0041; Fri, 17 Jul 2020 07:14:42 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id EDF0B8D0040; Fri, 17 Jul 2020 07:14:42 -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 DD0238D0041; Fri, 17 Jul 2020 07:14:42 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0007.hostedemail.com [216.40.44.7]) by kanga.kvack.org (Postfix) with ESMTP id C47A08D0040 for ; Fri, 17 Jul 2020 07:14:42 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 851AA1848B0BE for ; Fri, 17 Jul 2020 11:14:42 +0000 (UTC) X-FDA: 77047310004.28.coast48_430229126f0a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id ECB7C56778 for ; Fri, 17 Jul 2020 11:14:23 +0000 (UTC) X-Spam-Summary: 1,0,0,982a3d74f0c1a2cb,d41d8cd98f00b204,peterz@infradead.org,,RULES_HIT:41:152:355:379:800:960:965:966:968:973:988:989:1042:1183:1260:1261:1277:1313:1314:1345:1431:1437:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:1981:2194:2196:2198:2199:2200:2201:2393:2559:2562:2731:2903:3138:3139:3140:3141:3142:3352:3865:3867:3868:3871:3872:4250:4385:4390:4395:5007:6119:6261:6653:6742:8634:10004:10400:11026:11657:11658:11914:12043:12048:12296:12297:12438:12517:12519:13069:13311:13357:14181:14394:14659:14721:21080:21451:21627:21772:30003:30054:30055,0,RBL:205.233.59.134:@infradead.org:.lbl8.mailshell.net-64.201.201.201 62.8.55.100;04y8g11kdfh5p6tref8cudq6qez57op7qc59zypma6dsgpdyxizkti9njsxz7i8.rfmnpuork3yxnj5ixsrw8jbyz5qbqt643i1esgenay3tyohjcbu94s3oaa7eydn.e-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_SUMMARY:none X-HE-Tag: coast48_430229126f0a X-Filterd-Recvd-Size: 3855 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Fri, 17 Jul 2020 11:14:23 +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=lqUXsp1YoP1pMIfyAAamvA0e1hiYKdF5cDUHBRasd7E=; b=DJYHEvab2ej+if7sHNrHhPkAHQ dtX/b3zsSgVYJU7V5Dn3E9vuGr7oZGGGUJyrkLESLeIdfken09z/+Xmeoodj8j7J9Uk2bFnWw7QqD ED2Gj3xnfSJLH0AuDO2Dwk+yAsN1WzjUR+wGs7/dI39ZwLfCcluJFWHLyvtNIu04nk9BpMHOUh4qn Jmhq0K3zEMjJPwDa8SJxeMCF2hez8A5+YgdfCwXMhG+Dzv3FYYDbde19J4LCbtVi2XDdYJJi5rnr0 0QwwAPp770wRZZV9tISe/AAnO/4Sa2F6Q7Lm1yCiPKJzjQAPXpuMXMa+hL4mcj2yPlg+0sc+kKuKj 88FCPyug==; 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 1jwOJa-0001b0-H7; Fri, 17 Jul 2020 11:14:06 +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 82F35307488; Fri, 17 Jul 2020 13:14:04 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id C89A9203D4092; Fri, 17 Jul 2020 13:14:02 +0200 (CEST) Message-ID: <20200717111349.825172312@infradead.org> User-Agent: quilt/0.66 Date: Fri, 17 Jul 2020 13:10:13 +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 08/11] alpha/tlb: Fix __p*_free_tlb() References: <20200717111005.024867618@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: ECB7C56778 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: Just like regular pages, page directories need to observe the following order: 1) unhook 2) TLB invalidate 3) free to ensure it is safe against concurrent accesses. Since Alpha has page based PMDs, no software walkers and IPI based TLB invalidation, it can use the simple tlb_remove_page() based freeer. Signed-off-by: Peter Zijlstra (Intel) --- arch/alpha/include/asm/tlb.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) --- a/arch/alpha/include/asm/tlb.h +++ b/arch/alpha/include/asm/tlb.h @@ -4,7 +4,16 @@ #include -#define __pte_free_tlb(tlb, pte, address) pte_free((tlb)->mm, pte) -#define __pmd_free_tlb(tlb, pmd, address) pmd_free((tlb)->mm, pmd) +extern void ___pte_free_tlb(struct mmu_gather *tlb, pte_t *pte); +extern void ___pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd); + +#define __pte_free_tlb(tlb, pte, address) \ +do { \ + pgtable_pte_page_dtor(pte); \ + tlb_remove_table((tlb), (pte)); \ +} while (0) + +#define __pmd_free_tlb(tlb, pmd, address) \ + tlb_remove_table((tlb), virt_to_page(pmd)) #endif