Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1188028imm; Wed, 22 Aug 2018 21:35:53 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxqbMFPmT69acUXeC7tzyl221QkkWWHVDGbK1gQ/+tPWcrT6bt8Tv6QfoIb4hnQF6B814rV X-Received: by 2002:a65:478b:: with SMTP id e11-v6mr10388416pgs.98.1534998953357; Wed, 22 Aug 2018 21:35:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534998953; cv=none; d=google.com; s=arc-20160816; b=CbXyOitByVKn9Aw7rGo0qVfMC8kxfc8uzlAmsITOV8xZNafqzyZdUcbToaxRHC1mVT +yXKDz13ESs6JqX19OQY1ge0nbu0VHmoM5dkpMUp+aYiEoOPWZVvUDHYyRSUf+gbWgIs 8yJf/Ev1zCrZK1zsDMMiC0ZC7k0Io9PHmMgPqL3bRjtidQG/LKKh0bZ/bLV1YI3tCadW vi6qiC6Irl7MRSkcqUfiZoQ60ruNMgytMvDDs0EW8+oXlDamUdh87n14KR//QzmKwenw maVENE+HIzCbdUJ4h0oV7ieNZlTuSfUeJb7McGtPbIPifYJ+l+XbG5p/P4j8mkkj+Edu cyoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=FxmGWFvzn13ZKYIZBlUvKf3weRov/2Ro69wqFF/OzAo=; b=jRUHjlOr0UY95PKjWLWC5vEJ7tvx84+5+2RZsRhA39SDIFLVZaBSNGUJQ07niJ+MFF C32Jdu1YxL2C1nh1RUdWSD08v00AxuGo9x1T0D6MprD78KfN2gj7iXk2mjaKFphG2NSM CtyTz9jMYxcoyaCKgNtukMTe3oVx+oBreGpHwjlnz/iG07EqAJtAP7MDM5ESYxZhI/Ba Z5i+uQcSRQ3YlweO+I/+e3pPKvbsWoRaSISl9Hh5fvcQKpswVf1/a4j/9QnlEBuj+TKP n+jTkOAY9m98/5IeJ68X+MWojpA147yu+fqovXlvW8/4olr7IU97ew+mgAN+aCW0QH3z Un6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CLyjIWuw; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b129-v6si3674505pfa.12.2018.08.22.21.35.38; Wed, 22 Aug 2018 21:35:53 -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=pass header.i=@gmail.com header.s=20161025 header.b=CLyjIWuw; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728505AbeHWIBm (ORCPT + 99 others); Thu, 23 Aug 2018 04:01:42 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:39349 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728073AbeHWIBm (ORCPT ); Thu, 23 Aug 2018 04:01:42 -0400 Received: by mail-pf1-f196.google.com with SMTP id j8-v6so2037120pff.6 for ; Wed, 22 Aug 2018 21:33:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FxmGWFvzn13ZKYIZBlUvKf3weRov/2Ro69wqFF/OzAo=; b=CLyjIWuwBZm/7fekVBc35vYAdFRClRcu1XoGgJuGojsHCsqJvbapM8Z/zN66IPP+mI lRkDzFCCNPzK/Jgzl01j2+I9p5nS4Wei8QQ/JIrP8qrh9jnfsRrf61GVAMF+gqdUyEdu yhHouJaptL+mwyeSp6FNWF3DQwCaHeml2HcBExGw5ohnXDQ2XsPAGHHCfpKN8M0gS45N IHHvJUU/5eiT6Cmhbeqyb0u5ZTJ/9xRMrmveV8odl1Lx+wMyddufD4AH18Baz0mhoUe5 L5jz3hwC1jjZDLGB/AJAR62B0514R5cI1mljEEJhnlgW3NMXB6a/6teCucJlvhLjqmzu bpAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FxmGWFvzn13ZKYIZBlUvKf3weRov/2Ro69wqFF/OzAo=; b=pS57vO5xce7jqcIZfwI7A/9vmQmbeaOrYEFKvxvMHC1cootNmsYXFlLVDdi7Q+c2Kw jDXpQPKrqnfux72yyw6LOP7jeqoEygSgGV6k3XJcoVeuLXt3dBy+4dZgmuNHhC1JSCpf 3mQfjCINUFIv2DCvodynLNWR/P28VYFtRYbamQ1uiyq1FfOEFESB4SWkRLV3cPVnLkXw rrspUdIPR+PEHNPjIxeoyJ/w9pHBozvgZX81mlinIL0hxyxd4KoeChSKiU7yMIeatURZ qHnqNJcysCrE5Y/8cwb4oAhfxHbQadpBf0WbuZZud1V9bitG4rmVBnjJLBmWgteqkdL/ Qkzg== X-Gm-Message-State: AOUpUlFhpdfDHaddbG+CWK6dnYtqh8kyrIyPxtidp1+BJT2S+ZHH6Y7T LIORV2WAT0eMntoSiNLx2Fl/7HFB X-Received: by 2002:a63:5055:: with SMTP id q21-v6mr53175208pgl.397.1534998837675; Wed, 22 Aug 2018 21:33:57 -0700 (PDT) Received: from roar.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id s75-v6sm8929033pfd.0.2018.08.22.21.33.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 22 Aug 2018 21:33:57 -0700 (PDT) Date: Thu, 23 Aug 2018 14:33:49 +1000 From: Nicholas Piggin To: Linus Torvalds Cc: Peter Zijlstra , 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: <20180823143349.65cb0da0@roar.ozlabs.ibm.com> In-Reply-To: References: <20180822153012.173508681@infradead.org> <20180822154046.823850812@infradead.org> <20180822155527.GF24124@hirez.programming.kicks-ass.net> <20180823134525.5f12b0d3@roar.ozlabs.ibm.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 22 Aug 2018 20:59:46 -0700 Linus Torvalds wrote: > On Wed, Aug 22, 2018 at 8:45 PM Nicholas Piggin wrote: > > > > powerpc/radix has no such issue, it already does this tracking. > > Yeah, I now realize that this was why you wanted to add that hacky > thing to the generic code, so that you can add the tlb_flush_pgtable() > call. > > I thought it was because powerpc had some special flush instruction > for it, and the regular tlb flush didn't do it. But no. powerpc/radix does have a special instruction for it, that is why I posted the patch :) > It was because > the regular code had lost the tlb flush _entirely_, because powerpc > didn't want it. I think that was long before I started looking at the code. powerpc/hash hardware has no idea about the page tables so yeah they don't need it. > > > We were discussing this a couple of months ago, I wasn't aware of ARM's > > issue but I suggested x86 could go the same way as powerpc. > > 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). > > 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). > > So as a result, x86 had unintentionally lost the TLB flush we used to > have, because tlb_remove_table() had lost the tlb flushing because of > a powerpc quirk. > > You then added it back as a hacky per-architecture hook (apparently > having realized that you never did it at all), which didn't fix the I think it was quite well understood and fixed here, a145abf12c9 but again that was before I really started looking at it. The hooks I added recently are for a different reason, and it's actaully the opposite problem -- to work around the hacky generic code that x86 foisted on other archs. > unintentional lack of flushing on x86. > > So now we're going to do it right. No more "oh, powerpc didn't need > to flush because the hash tables weren't in the tlb at all" thing in > the generic code that then others need to work around. I don't really understand what the issue you have with powerpc here. powerpc hash has the page table flushing accessors which are just no-ops, it's the generic code that fails to call them properly. Surely there was no powerpc patch that removed those calls from generic code? powerpc/radix yes it does some arch specific things to do its page walk cache flushing, but it is a better design than the hacks x86 has in generic code, surely. I thought you basically agreed and thought x86 / generic code could move to that kind of model. Thanks, Nick