Received: by 10.223.185.116 with SMTP id b49csp5606233wrg; Wed, 7 Mar 2018 14:57:34 -0800 (PST) X-Google-Smtp-Source: AG47ELs1OlMZJGQQualtCH7CoKjr8SNU+xZAfwP08WqwgJrI62xkDdVQtLS1j6asy6DMbaQegSgu X-Received: by 10.167.131.29 with SMTP id t29mr24419500pfm.116.1520463453982; Wed, 07 Mar 2018 14:57:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520463453; cv=none; d=google.com; s=arc-20160816; b=sFKd5s7NRHf8goAC8FStYZs6L1Bv/UMQDVBletuKuKfeuVMcUlnp/RWv9XUsatZKts dhyCEMGCX9SOaXkyegZS+sTO2qv9VfRGWFuF2f1DIWZ82vKOm2d7PRJVWpsRdIbSadAj L8IiAZCmbNkjWZTonvZ00MLn7R/u0qHA4r5DKVeA5g4E3Weqv1iJXFyLnLgTviWgQgRS 3Ioq28GvzUUaKrL5OQ5DI3P2lcKnZYp6rvQxVtZqKCR9AJvViw2FEEQinwnE52EdZfUG H79UgYK61trq9FsgBFbXnyC6IgMl9v+/0xdPWmsPJ3Dusj86Hac7yKute+91BRDsQkXr 13hg== 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 :arc-authentication-results; bh=02xTLlvRItq5IFTB9Vt2IXyWD8y40JVN9aAlcd1aAG8=; b=KteShK4JXeTItb1R+kggk/N+pfAkTI3uXURaJzENYPTIehi0zo8gMgTyaDks7jU9Y5 yIkBdUPSdUXaw4wjjTJDVd/HGv5l/wo6UKBKAJhyRTsa34RGmWZ7uJpD3UDX95MgnGY0 9KeS3gGSBiwKlfY2G9aAJW4io3GvNV1XW7fppKomsoW6QuiE+rZf3YrGkjcotWMH675O mx/jdkkUGysMDucSbBMUsGY6Y5HY8W0OKgdV+90xoK3ICFWBYsI3m49M23mBT+A4iw64 XYtk2pE2YeHUt2ru94k1zwQMbCHDEv/S39Kru4SnjUhdUfEe1Ut2eFLWFVpMYOwgsqIh qx4A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o3-v6si10517223pld.815.2018.03.07.14.57.18; Wed, 07 Mar 2018 14:57:33 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934448AbeCGWzr (ORCPT + 99 others); Wed, 7 Mar 2018 17:55:47 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:38556 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933533AbeCGWzq (ORCPT ); Wed, 7 Mar 2018 17:55:46 -0500 Received: from akpm3.svl.corp.google.com (unknown [104.133.9.71]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B52DE1077; Wed, 7 Mar 2018 22:55:45 +0000 (UTC) Date: Wed, 7 Mar 2018 14:55:44 -0800 From: Andrew Morton To: Toshi Kani Cc: mhocko@suse.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, bp@suse.de, catalin.marinas@arm.com, guohanjun@huawei.com, will.deacon@arm.com, wxf.wang@hisilicon.com, linux-mm@kvack.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] mm/vmalloc: Add interfaces to free unused page table Message-Id: <20180307145544.b4199a0d5631012a92d625e4@linux-foundation.org> In-Reply-To: <20180307183227.17983-2-toshi.kani@hpe.com> References: <20180307183227.17983-1-toshi.kani@hpe.com> <20180307183227.17983-2-toshi.kani@hpe.com> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; 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, 7 Mar 2018 11:32:26 -0700 Toshi Kani wrote: > On architectures with CONFIG_HAVE_ARCH_HUGE_VMAP set, ioremap() > may create pud/pmd mappings. Kernel panic was observed on arm64 > systems with Cortex-A75 in the following steps as described by > Hanjun Guo. > > 1. ioremap a 4K size, valid page table will build, > 2. iounmap it, pte0 will set to 0; > 3. ioremap the same address with 2M size, pgd/pmd is unchanged, > then set the a new value for pmd; > 4. pte0 is leaked; > 5. CPU may meet exception because the old pmd is still in TLB, > which will lead to kernel panic. > > This panic is not reproducible on x86. INVLPG, called from iounmap, > purges all levels of entries associated with purged address on x86. > x86 still has memory leak. > > Add two interfaces, pud_free_pmd_page() and pmd_free_pte_page(), > which clear a given pud/pmd entry and free up a page for the lower > level entries. > > This patch implements their stub functions on x86 and arm64, which > work as workaround. Also, as this fixes an arm64 kernel panic, should we be using cc:stable?