Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1150419imm; Tue, 15 May 2018 14:41:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrOfO2MBM8hwrFNCBPtJX7Z15ZRtJ2U3t76dvTKIJEYxNUzbzYwiOjO/RKO5vxNeJqNFtzT X-Received: by 2002:a17:902:22cc:: with SMTP id o12-v6mr16643276plg.38.1526420500738; Tue, 15 May 2018 14:41:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526420500; cv=none; d=google.com; s=arc-20160816; b=x5YbWycTeQzmcQiYu9Q+G0q1dqKmQ1NbiUz79M6qoxmbhZoVzvY164tZ4E/R57fyRR Gxxbd8O3uzpAPUA2OtSUsJRsCpdfDMXmzXJ3qLidhSpE0XHPuF+17bMjZO32H5/Yaa4o z4ig6hBygKRW3rkHbtSht+fRsIBkMiZd8LAnafoDmdIcY+1zCHXIufUgz9Aw0cw1Xnrc C/pb2lbTokwMJRPWaNd7fOrIOjHSqXhqUXoI0MzddEpV/DnKJXfhE9MTl3AYN32/UYri Z1WbqW8dTJgXMWWwo1P3nhOp68ewnaJsC+CcdQJHrBaVbFwpgmgvqUhOPQvq8GjcB4Ac 5gDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=vAYomrBaZpFCkduE/qt5BTwZT2JNh7Y9a+ci7lxNNsU=; b=oEq+xtZ85koEzYlcaxlJ18FeBPOop8wSg+ivD98+58wbdcsy8l2bRLh6tCo1oCNV10 BmJn55VSgNe0ulKvLm2YQuBNIqfYlq4yBFY7LNqsElE+t8KfyH1ZhVpZn3+SeXPRqfxk j2czkFHA/PXrIS16xefoOHN2B5j9LAT6iolZqbFKbewqg4J61gvwM/a8DmF96yIypWWQ APg8l6KbQ2i9T+r0h85IeMFfpffDZqH9aTueFcJXdErE+rBOZsF6aiBynDust1GfqbS2 PcreQ+uuLp1fgsxxr3OHavdDuySABPcrTGUa/JWz+jrSdiuvE0lvVvF9+7Y329nRiWXS nWnA== 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 b78-v6si998329pfj.2.2018.05.15.14.41.26; Tue, 15 May 2018 14:41:40 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752240AbeEOVkv (ORCPT + 99 others); Tue, 15 May 2018 17:40:51 -0400 Received: from g2t2354.austin.hpe.com ([15.233.44.27]:3418 "EHLO g2t2354.austin.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752112AbeEOVks (ORCPT ); Tue, 15 May 2018 17:40:48 -0400 Received: from g2t2360.austin.hpecorp.net (g2t2360.austin.hpecorp.net [16.196.225.135]) by g2t2354.austin.hpe.com (Postfix) with ESMTP id C1581C8; Tue, 15 May 2018 21:40:47 +0000 (UTC) Received: from misato.americas.hpqcorp.net (unknown [10.34.81.122]) by g2t2360.austin.hpecorp.net (Postfix) with ESMTP id EE96036; Tue, 15 May 2018 21:40:44 +0000 (UTC) From: Toshi Kani To: mhocko@suse.com, akpm@linux-foundation.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com Cc: cpandya@codeaurora.org, linux-mm@kvack.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Toshi Kani , Joerg Roedel , stable@vger.kernel.org Subject: [PATCH v2 1/3] x86/mm: disable ioremap free page handling on x86-PAE Date: Tue, 15 May 2018 15:39:29 -0600 Message-Id: <20180515213931.23885-2-toshi.kani@hpe.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180515213931.23885-1-toshi.kani@hpe.com> References: <20180515213931.23885-1-toshi.kani@hpe.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Andrew Morton Cc: Michal Hocko Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Joerg Roedel Cc: --- arch/x86/mm/pgtable.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index ffc8c13c50e4..08cdd7c13619 100644 --- 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, unsigned long addr) +{ + 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, unsigned long addr) +{ + return pmd_none(*pmd); +} + +#endif /* CONFIG_X86_64 */ #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */