Received: by 10.192.165.148 with SMTP id m20csp2406501imm; Thu, 26 Apr 2018 10:25:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx48LWNVPaKGVXkYmdXfrX0oACwWR2RjnPgwplSxIrcPJY3vzmJ2bZqC+WvEUO6J5K43A7h44 X-Received: by 10.98.155.87 with SMTP id r84mr28772592pfd.109.1524763523948; Thu, 26 Apr 2018 10:25:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524763523; cv=none; d=google.com; s=arc-20160816; b=LeI/eWlUTzJe/9AcYuZRdDhTWYG9q+wxglvcyk1xuJPd012CK+RF1EfAhguAJ/wUfC UnE4pKN0HyFQhvOsu03UA0sNluewJfsg584hd8UheylaCD7ROGqfVFzJ0T66BzFjaSEJ x1AmbmvZjQJeblbd5tuixJ9Fk9g11b2gocnkEn+xK1IcQypIzw4M8bUihfc20/X8er1u WQPJaictYpl0MIYjj+EYj0KtIp5/sbQN7GdediYTKZgKIBVaSGybMuPWHJ+Nvxg/iQfU WGV4szoy7bTnOVqdr2UDcqLKfjZ6dq0vZkBG7ESMti+qWAUZVA1cAxTuczv1w9+x+0cO czHA== 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=X/ag1XGVKJf1Rc/ljk3uVrN9gWCXnneu94B22U2P2Mk=; b=bB/GYIq/qCGhh8YXBQtDIyKq31QCh6ZoKAVt4s4cifEwupAYc61HMZ41ixdArU5HBe O8QRmENXQ5ZQrePu00nLVRZmT3rGQlsTR3QBTgsO5MmiXnrVx8GF1yRUQJ15gbpE1Hf4 SznkW2ax8RdI2ZixVjFslubqK6BBGVqye4wRLGAltFBCuUWu7hls3q8XRRIxsz6Y3gZo uzCxkB59KLoMcW09tgj9X86e6ydPkzFQTCyDSRZfWqMdHf1GyPG5kgap1drYqga6Bjgg V7Rv7OTt8ucv24cgj6mDIuWZ+bituaw67AsrPWoc0aq5qOD34oTxxkwFYanVQEN2GWes kATg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@8bytes.org header.s=mail-1 header.b=FVXebS1V; 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=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j21si1303699pgn.334.2018.04.26.10.25.09; Thu, 26 Apr 2018 10:25:23 -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 (test mode) header.i=@8bytes.org header.s=mail-1 header.b=FVXebS1V; 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=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756879AbeDZRXe (ORCPT + 99 others); Thu, 26 Apr 2018 13:23:34 -0400 Received: from 8bytes.org ([81.169.241.247]:53510 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753282AbeDZRX3 (ORCPT ); Thu, 26 Apr 2018 13:23:29 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id 38253134; Thu, 26 Apr 2018 19:23:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1524763408; bh=m3pjLbuXlRN6F+hO+06mfoo0zb+MuTFzOHrFzXBw1ns=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FVXebS1V+aP22+s6V3thgzT6p7+UkOIOCR08HQoz7cRuYdz3YF1eKYOchkGpJcl3H nGUjbwmwkrv3l5ddwjtwxPWxBUgXJVgFWYuE+F81ZAS9Z3TOGnjR14Fl2aG5TckrWL aVZJwRD9mmezDRKovCS9pFOgkcnSALTV5dnwBcwsEEabzqqD6urFHjZwpy7P9ILfCe 3o2x/QkonhigqnhEfkiIlEe0+YfqR28Fm7elMR625etJsLH+vdfDSAdXTcZuk3IxGr kFiV6TCbWXmW18zP6nmU5+8AZFl4jkaKVZsjbKKcukXEAQo/u49Y70UcZHrtKE9pul wgz9CPTF5uVUw== Date: Thu, 26 Apr 2018 19:23:28 +0200 From: "joro@8bytes.org" To: "Kani, Toshi" Cc: "linux-kernel@vger.kernel.org" , "bp@suse.de" , "tglx@linutronix.de" , "guohanjun@huawei.com" , "willy@infradead.org" , "wxf.wang@hisilicon.com" , "stable@vger.kernel.org" , "linux-mm@kvack.org" , "x86@kernel.org" , "akpm@linux-foundation.org" , "hpa@zytor.com" , "catalin.marinas@arm.com" , "mingo@redhat.com" , "will.deacon@arm.com" , "Hocko, Michal" , "cpandya@codeaurora.org" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH v2 2/2] x86/mm: implement free pmd/pte page interfaces Message-ID: <20180426172327.GQ15462@8bytes.org> References: <20180314180155.19492-1-toshi.kani@hpe.com> <20180314180155.19492-3-toshi.kani@hpe.com> <20180426141926.GN15462@8bytes.org> <1524759629.2693.465.camel@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1524759629.2693.465.camel@hpe.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 26, 2018 at 04:21:19PM +0000, Kani, Toshi wrote: > All pages under the pmd had been unmapped and then lazy TLB purged with > INVLPG before coming to this code path. Speculation is not allowed to > pages without mapping. CPUs have not only TLBs, but also page-walk caches which cache intermediary results of page-table walks and which is flushed together with the TLB. So the PMD entry you clear can still be in a page-walk cache and this needs to be flushed too before you can free the PTE page. Otherwise page-walks might still go to the page you just freed. That is especially bad when the page is already reallocated and filled with other data. > > Further this needs synchronization with other page-tables in the system > > when the kernel PMDs are not shared between processes. In x86-32 with > > PAE this causes a BUG_ON() being triggered at arch/x86/mm/fault.c:268 > > because the page-tables are not correctly synchronized. > > I think this is an issue with pmd mapping support on x86-32-PAE, not > with this patch. I think the code needed to be updated to sync at the > pud level. It is an issue with this patch, because this patch is for x86 and on x86 every change to the kernel page-tables potentially needs to by synchronized to the other page-tables. And this patch doesn't implement it, which triggers a BUG_ON() under certain conditions. Regards, Joerg