Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2584919imm; Fri, 24 Aug 2018 01:39:07 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYTOa8AxsiLh8jlyXh4njfMtsrxQpoJZJtVGQPVL8LVbQlr4a5aBWI72K+XdYyHckb/drOD X-Received: by 2002:a62:198e:: with SMTP id 136-v6mr867227pfz.103.1535099947774; Fri, 24 Aug 2018 01:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535099947; cv=none; d=google.com; s=arc-20160816; b=WGQ5LIsj/Q+IfYAkWVYlabHwCY40EBv4qnvWIqvC5tROjvbeZm3YEMrGvErAPD5cPp 4eakURpHOJ79KXG6B5xfoY57PrJhje8BTZn3AiQT7mwfGGNLJiQP364SAr3DBdgzH2RW VO+ylXdV+IyPjLfN7C6fC3pB5u5AX5AoGMLEVsuCxiyAu7hjkP5oNh1ZId8eVZGXWLtA kpzZT8iN1La/rYPEW2zD7CV7h14hfTjmAnP+CAyNk5uCJwXEmAmis63jiTxy2X443Q5h UDD/lFjRy+Mn/PdisaJsObIovExOci+eD0UYEnxRqdXERDtjReKWbsicm1VPATu2+mbO RJ/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=RiyfP2A3uT1GKgZKfmASkqAbqk/qx69uq9oaSih1fSM=; b=Ij2otqWJAbxUEc78FrR34dIkYdh+qojOQeFlniEkolMx7qJQu4RtOovWpUBXJ9YZwq IQkP/eICj7a4q3MbVGlvjYzYtrxdLtEJFW0u8SOQA1zCf1Od70/tEXncJmQQJG5ClhKf Rdik6l517QgwPVU71CjZnDNJGVl9r3OGVNYDItrWbBzMoHJp8pg5PUpfsEUgCBGyI1+E 32RPAgFXfHy+hCY0K/X9Xpr6QJO1U2cITPwthNWzNfUQYzquJwvTwxXNaM11NlYgrO1Q jTwMfRNgdSrTeudIkRvosoVp0a5ROLtsYuIyY3ORtJXLxUsqDYTgcts9hl7X6+rBd1dc m3Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=26WdUqbc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5-v6si6132402plr.101.2018.08.24.01.38.51; Fri, 24 Aug 2018 01:39:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=26WdUqbc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726686AbeHXMKE (ORCPT + 99 others); Fri, 24 Aug 2018 08:10:04 -0400 Received: from merlin.infradead.org ([205.233.59.134]:38040 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726325AbeHXMKE (ORCPT ); Fri, 24 Aug 2018 08:10:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=RiyfP2A3uT1GKgZKfmASkqAbqk/qx69uq9oaSih1fSM=; b=26WdUqbcmAwWo2faMg8q5YTIX 35LPB4PF1LO7bVBpJiOhsPViU0DjZqzVn7OjQW7Z/0eU4UadHR0BGudGY/IckVhSlRJ5oJJL/hnqc le7y1nmqZZEMr6hVuC1r1EtbOEf42i+U9hDXUcRNkFlB4WUq9Ls4R7wKj0HAUxaIe92JePm8hMoYX 7fVYtx4XdtCVb9u/3UDrlSiWbSwfl1h1qVqbibXbGC8n0nDFws/bxAvQ9y7yNSSe8xdp5ysSyysOq TV4sse8SSRFkMVRU0jHFWgYkK2fJCZkNeV44dyZtpa7r/qAH0E5gcMGbSLVV7OH9iGJPCGNXhfCeM 9MRs997Lg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1ft7ZW-0007GS-5v; Fri, 24 Aug 2018 08:35:58 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C796D202E65E0; Fri, 24 Aug 2018 10:35:56 +0200 (CEST) Date: Fri, 24 Aug 2018 10:35:56 +0200 From: Peter Zijlstra To: Benjamin Herrenschmidt Cc: Linus Torvalds , Nick Piggin , Andrew Lutomirski , the arch/x86 maintainers , Borislav Petkov , Will Deacon , Rik van Riel , Jann Horn , Adin Scannell , Dave Hansen , Linux Kernel Mailing List , linux-mm , David Miller , Martin Schwidefsky , Michael Ellerman Subject: Re: [PATCH 3/4] mm/tlb, x86/mm: Support invalidating TLB caches for RCU_TABLE_FREE Message-ID: <20180824083556.GI24124@hirez.programming.kicks-ass.net> References: <20180822153012.173508681@infradead.org> <20180822154046.823850812@infradead.org> <20180822155527.GF24124@hirez.programming.kicks-ass.net> <20180823134525.5f12b0d3@roar.ozlabs.ibm.com> <776104d4c8e4fc680004d69e3a4c2594b638b6d1.camel@au1.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <776104d4c8e4fc680004d69e3a4c2594b638b6d1.camel@au1.ibm.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 23, 2018 at 02:54:20PM +1000, Benjamin Herrenschmidt wrote: > On Wed, 2018-08-22 at 20:59 -0700, Linus Torvalds wrote: > > The problem is that x86 _used_ to do this all correctly long long ago. > > > > And then we switched over to the "generic" table flushing (which > > harkens back to the powerpc code). > > Yes, we wrote it the RCU stuff to solve the races with SW walking, > which is completely orthogonal with HW walking & TLB content. We didn't > do the move to generic code though ;-) > > > Which actually turned out to be not generic at all, and did not flush > > the internal pages like x86 used to (back when x86 just used > > tlb_remove_page for everything). > > Well, having RCU do the flushing is rather generic, it makes sense > whenever there's somebody doing a SW walk *and* you don't have IPIs to > synchronize your flushes (ie, anybody with HW TLB invalidation > broadcast basically, so ARM and us). Right, so (many many years ago) I moved it over to generic code because Sparc-hash wanted fast_gup and I figured having multiple copies of this stuff wasn't ideal. Then ARM came along and used it because it does the invalidate broadcast. And then when we switched x86 over last year or so; because paravirt; I had long since forgotten all details and completely overlooked this. Worse; somewhere along the line we tried to get s390 on this and they ran into the exact problem being fixed now. That _should_ have been a big clue, but somehow I never got around to thinking about it properly and they went back to a private copy of all this. So double fail on me I suppose :-/ Anyway, its sorted now; although I'd like to write me a fairly big comment in asm-generic/tlb.h about things, before I forget again.