From patchwork Thu Aug 16 18:45:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10568025 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 99FCD13B4 for ; Thu, 16 Aug 2018 18:47:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 989F428C13 for ; Thu, 16 Aug 2018 18:47:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C6BF2A9CD; Thu, 16 Aug 2018 18:47:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1237228C13 for ; Thu, 16 Aug 2018 18:47:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2392D6B032B; Thu, 16 Aug 2018 14:47:41 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1E8AB6B032D; Thu, 16 Aug 2018 14:47:41 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D84E6B032E; Thu, 16 Aug 2018 14:47:41 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by kanga.kvack.org (Postfix) with ESMTP id C051C6B032B for ; Thu, 16 Aug 2018 14:47:40 -0400 (EDT) Received: by mail-pf1-f200.google.com with SMTP id q21-v6so2471622pff.21 for ; Thu, 16 Aug 2018 11:47:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:user-agent :mime-version; bh=69U65qnpJWSCcihjZSI4J/uGYRNeTlo0DkH4NAVujYU=; b=TSU6DKyoPoru6TdjK9bs+7DWM/ZMuPaftSo0lq6tPsKBPYkXQ/K3q53oq8ZsyqJN6M LTD/tXGKkXckIxB4WOo6mdYukdSNjzafKwg2a5HDrcFnz3AS4eITEAmN2L3Jde1W8v/C e4X8jlf6/Knw7vja9eNwobeYPrLFwX4wUMdjnDyWqzKkpX+QkpzNs2/oonkdstYkzuU7 e75SEeMOvlyTsU/mai/32QjrvlT83pHMdlW9nfb9lr3DmVwBsl4l4j+OdIKiJs3LW5cK pN+Qg58kgNJOaSMgjgvsqlcgaYh3yB1yDDnL0kZPoWNfO92NQiZxbzAUhrGxzWb3fCNC cWbw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of gregkh@linuxfoundation.org designates 140.211.169.12 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org X-Gm-Message-State: AOUpUlErPSdVahnd6YimO45l+ZLoYxHbSoBztQ2saYimMWm3IN06kzp8 3rsj+x2UAP99H5VKoKs3VwcjEiCJlnVoDRPZBuVxTuWlIMNRxQlgHnyZqEP+isMB49FEghnTb2U ATWLLFAmGut2awDbngWBOroXXZliFJ49XpADp1S2dznXNBfwhBJWXHsOkmkcUmZnJzQ== X-Received: by 2002:a63:c60:: with SMTP id 32-v6mr30235623pgm.155.1534445260464; Thu, 16 Aug 2018 11:47:40 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzJTCUiGs0DI3iC0SMhJOqhCzEp7DeYegoRvRTLT84POpStuyMZmZ2YKjRtY5ITCcA56uBP X-Received: by 2002:a63:c60:: with SMTP id 32-v6mr30235591pgm.155.1534445259845; Thu, 16 Aug 2018 11:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534445259; cv=none; d=google.com; s=arc-20160816; b=CoMFrphS+1gKNxMVDu8g9CLJGlbMPm5GTksCjRwkq34ReVcH6mj2RiSpvz6UWpUocQ HiSWnYvR7HhmAc3oZqnii1JfeJ6/Ln4hjwB2sz4eE0zvWFwc7Axy4Z4L02+NNzD4rZ6G XTwo3PA/vqNR172fSZ5kMNjZrZskydoIgl5rEoybVT/tmoLaS0aN850wAKoj0TFyQ2Qz ZspWP7d26/zzlxP6p0oRQ7E5P1TWu2r6WTlAlzsFkSUOyR1pXmz5t56sXIWMknFanfXo p2mwubc0caG9cngVB36fNr5LtO3auR8LEt8+5coB9kfEDHHjTAyyPF1LdBuRIXi6fdsA i+rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=69U65qnpJWSCcihjZSI4J/uGYRNeTlo0DkH4NAVujYU=; b=r2+ellPd6e53oyigbOHSxm3sv9oMLUodku9MD9miwzgg59xtiU5wUGwsAklVSKjVFq xxZ08aHv00iER+L+caNbGZGTt2zLwHQD05FmcMVb0ToLjfmpvAiBgMZun+b3eIWRRLhF hsHoqp/G9aSJJxuh7YrQ1NUwQEq0FPKMNsc7d3aKmbHof+5ccoVzht1lmWwqOBnD5RaC BbpJ40b3UkpgWE6c44glwtjPUG7Q+7/PBxJpp2npcbgNuk+NlCJimQG5CrVUJE7rMLzn uYEUQwyIo2ngV4O3/kfIKVqec+z0vMqtmMoZ+1smwdm+fa2sptR34d2w7dqkjYXqTTIa 9hwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gregkh@linuxfoundation.org designates 140.211.169.12 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org. [140.211.169.12]) by mx.google.com with ESMTPS id v34-v6si29864plg.491.2018.08.16.11.47.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Aug 2018 11:47:39 -0700 (PDT) Received-SPF: pass (google.com: domain of gregkh@linuxfoundation.org designates 140.211.169.12 as permitted sender) client-ip=140.211.169.12; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gregkh@linuxfoundation.org designates 140.211.169.12 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Received: from localhost (unknown [194.244.16.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 015D2D3B; Thu, 16 Aug 2018 18:47:39 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joerg Roedel , Toshi Kani , Thomas Gleixner , mhocko@suse.com, akpm@linux-foundation.org, hpa@zytor.com, cpandya@codeaurora.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 4.17 06/21] x86/mm: Disable ioremap free page handling on x86-PAE Date: Thu, 16 Aug 2018 20:45:16 +0200 Message-Id: <20180816171612.669302985@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180816171612.136242278@linuxfoundation.org> References: <20180816171612.136242278@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 4.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Toshi Kani commit f967db0b9ed44ec3057a28f3b28efc51df51b835 upstream. ioremap() supports pmd mappings on x86-PAE. However, kernel's pmd tables are not shared among processes on x86-PAE. Therefore, any update to sync'd pmd entries need re-syncing. Freeing a pte page also leads to a vmalloc fault and hits the BUG_ON in vmalloc_sync_one(). Disable free page handling on x86-PAE. pud_free_pmd_page() and pmd_free_pte_page() simply return 0 if a given pud/pmd entry is present. This assures that ioremap() does not update sync'd pmd entries at the cost of falling back to pte mappings. Fixes: 28ee90fe6048 ("x86/mm: implement free pmd/pte page interfaces") Reported-by: Joerg Roedel Signed-off-by: Toshi Kani Signed-off-by: Thomas Gleixner Cc: mhocko@suse.com Cc: akpm@linux-foundation.org Cc: hpa@zytor.com Cc: cpandya@codeaurora.org Cc: linux-mm@kvack.org Cc: linux-arm-kernel@lists.infradead.org Cc: stable@vger.kernel.org Cc: Andrew Morton Cc: Michal Hocko Cc: "H. Peter Anvin" Cc: Link: https://lkml.kernel.org/r/20180627141348.21777-2-toshi.kani@hpe.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/mm/pgtable.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c @@ -715,6 +715,7 @@ int pmd_clear_huge(pmd_t *pmd) return 0; } +#ifdef CONFIG_X86_64 /** * pud_free_pmd_page - Clear pud entry and free pmd page. * @pud: Pointer to a PUD. @@ -762,4 +763,22 @@ int pmd_free_pte_page(pmd_t *pmd) return 1; } + +#else /* !CONFIG_X86_64 */ + +int pud_free_pmd_page(pud_t *pud) +{ + return pud_none(*pud); +} + +/* + * Disable free page handling on x86-PAE. This assures that ioremap() + * does not update sync'd pmd entries. See vmalloc_sync_one(). + */ +int pmd_free_pte_page(pmd_t *pmd) +{ + return pmd_none(*pmd); +} + +#endif /* CONFIG_X86_64 */ #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */