Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1200888imm; Wed, 22 Aug 2018 21:56:03 -0700 (PDT) X-Google-Smtp-Source: AA+uWPye4TgWXmF+cmcBSx0DK1nGtD3RsaAMbTjbIw6M7uAFf+Hej6eGPOJtsP4i643OTa33WsBh X-Received: by 2002:a17:902:33c2:: with SMTP id b60-v6mr56692428plc.11.1535000163812; Wed, 22 Aug 2018 21:56:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535000163; cv=none; d=google.com; s=arc-20160816; b=K/QJ36GCl492nVmKGNFM+RSlrm3Sb/vnNsyBjGZRT4EJEfanEPDAHBwYGTh6i+28T9 lcLK08XOSCtLE021jhyej6tdTtlEn9gIic7Wp/2qVVrequhyzF5ion/mJX3ZH7bwv958 yZnX9Eg28qwoC9pYoddZ2yA+Y+KtKxllnFc6pgOwzVHsibRUcjqBbA7duv0YVNiKqfUE ngtFByl58UPu5RWi/ob9OIUDxqM5Fmg29kBOB+KVGXc2PvvZnv3hZKJabAM+ke5ZMhb2 tCdia6k7cc2M40OoUZ/IUHJT9uIzkCM3QquoU0PZysCFATMFIBXRGqfuw+uZph/P4VKv BhZw== 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:message-id :mime-version:organization:references:in-reply-to:date:cc:to :reply-to:from:subject:arc-authentication-results; bh=oCa9VjThHhsieDU/6QRSL8Vn3Rhjam55b4rPmUYZf6Y=; b=SWj02vGzkZXpU8LCCPx0xOBG0KIZC7EjrQSE4wrLY2ufMfiJ523b5VygTwlfVcCo+x 3fIuu1Q0ebXDWC+BALGlyXzwbXZ1zLt5VGQGn4lUZpHLR6JYGxwTDJbv+e8IH5vEknaW 4Ps7QaRsIaj7I3C4MCSOD99ojzU4GNTbT18+KjCsi+zoIVJFMPPpIZcSxXcJ5srqOLJw /amWIrOQ/XIWT2lw5+pI0UFb3WkRn69u75EcXkuBey0EMJC4vxeRGYALwwRyAKFQ5XJC joFYuDHZeos2DOf3m5Sh6yvui0ph23DrpKOvSrjM+1KCNsCSUdF23NKz53meDz6MI8d0 4mHA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3-v6si3294483plb.418.2018.08.22.21.55.45; Wed, 22 Aug 2018 21:56:03 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728382AbeHWIWW (ORCPT + 99 others); Thu, 23 Aug 2018 04:22:22 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:43900 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726204AbeHWIWW (ORCPT ); Thu, 23 Aug 2018 04:22:22 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w7N4nIgW037972 for ; Thu, 23 Aug 2018 00:54:32 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2m1krkd0p2-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 23 Aug 2018 00:54:32 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 23 Aug 2018 05:54:31 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 23 Aug 2018 05:54:25 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w7N4sOlx29360220 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 23 Aug 2018 04:54:24 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AB2C952065; Thu, 23 Aug 2018 07:54:23 +0100 (BST) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 08EFB52057; Thu, 23 Aug 2018 07:54:23 +0100 (BST) Received: from pasglop.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id E35E9A020A; Thu, 23 Aug 2018 14:54:19 +1000 (AEST) Subject: Re: [PATCH 3/4] mm/tlb, x86/mm: Support invalidating TLB caches for RCU_TABLE_FREE From: Benjamin Herrenschmidt Reply-To: benh@au1.ibm.com To: Linus Torvalds , Nick Piggin 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 Date: Thu, 23 Aug 2018 14:54:20 +1000 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> Organization: IBM Australia X-Mailer: Evolution 3.28.5 (3.28.5-1.fc28) Mime-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18082304-4275-0000-0000-000002ADF27B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18082304-4276-0000-0000-000037B6F984 Message-Id: <776104d4c8e4fc680004d69e3a4c2594b638b6d1.camel@au1.ibm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-23_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808230050 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2018-08-22 at 20:59 -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. It was because > the regular code had lost the tlb flush _entirely_, because powerpc > didn't want it. Heh :-) Well, back on hash we didn't (we do now with Radix) but I wouldn't blame us for the generic code being broken ... the RCU table freeing was in arch/powerpc at the time :-) I don't think it was us making it generic :) > > 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). 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). > 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. This is a somewhat odd way of putting the "blame" :-) But yeah ok... > 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 > 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. So we do need a different flush instruction for the page tables vs. the normal TLB pages. Cheers, Ben.