Received: by 10.192.165.148 with SMTP id m20csp4061733imm; Mon, 30 Apr 2018 11:00:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoC8uiszIjd+wyAW5IEm1KPq8xWCcxzqA7vuiK7Sr/W+w16T3NtPneaFmFjMxkj+Aswg42e X-Received: by 2002:a63:91c4:: with SMTP id l187-v6mr10684762pge.261.1525111256881; Mon, 30 Apr 2018 11:00:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525111256; cv=none; d=google.com; s=arc-20160816; b=BmhIw3wGhXcXjQjOiHUO3KHUuHvh1ptpzunR//inWDFqAnVOig8/o32iKyuixI7dJg i4UKouEsMF1OYUcthFs3lGC1d3Ur4fGlENS6DQ5dqyKuwvFPl8chdKIwLeunH4byFZHo TTdjo9iHtFCrtL7d8xUkM5TisIHsii8cdQLOHHzYT99nhnJqsiTPFgHiync+ll2qYaVi wTNY9Kxkcmqed+F5RC9AqXujFmGpLNZQOyjQvB3qUVd22yXyHbRHZgnukiMsMnPHGD5G SfaWq8S/KtitHFaXZRwSkmDkCliQjwuarTKO7tfs2Nz0gtpaQI3UxUxKH/mDmH17SwOB MrqA== 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=JACx8uszIeyr4Q+P6VWxvRtd34v4ySj8+HGX/htHoU4=; b=H3ulQi66UGY1PRDa7Ks4EjbWM1C5x6DpzLnKEEef2tvXY4IAMPrZRx+Jo7siac8hIK 0DtaTGeZvre121/qCDP6rrMDbI7wqsVuszTqd8w2AUMxJMXW+H+u1AmgfO8oaUGymk77 aU1pso2CqS7Jk3cDFPcOdyoTaRGt7D9EjLfFUL03OwXNUjZXopeLj2pcmIQXeo4945Yi NWG/xPc6tmXv++rFaczjpFrkFShPY4qdoDtSRlGn43GFtSLkXO/liVcMwbc57M/OUlTb kjkKWH+Uc8hBTjm0sduAQE7MpBm9W5V4t7+HCOw7C1Pw0TqFJwP94tRfP/QM6TrM9A71 fc0w== 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 b2-v6si6576867pgc.275.2018.04.30.11.00.42; Mon, 30 Apr 2018 11:00:56 -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 S1754366AbeD3SAa (ORCPT + 99 others); Mon, 30 Apr 2018 14:00:30 -0400 Received: from g9t5009.houston.hpe.com ([15.241.48.73]:56104 "EHLO g9t5009.houston.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753885AbeD3SA1 (ORCPT ); Mon, 30 Apr 2018 14:00:27 -0400 Received: from g9t2301.houston.hpecorp.net (g9t2301.houston.hpecorp.net [16.220.97.129]) by g9t5009.houston.hpe.com (Postfix) with ESMTP id A7AB563; Mon, 30 Apr 2018 18:00:26 +0000 (UTC) Received: from misato.americas.hpqcorp.net (misato.americas.hpqcorp.net [10.34.81.122]) by g9t2301.houston.hpecorp.net (Postfix) with ESMTP id B8A566BF; Mon, 30 Apr 2018 18:00:25 +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 3/3] x86/mm: disable ioremap free page handling on x86-PAE Date: Mon, 30 Apr 2018 11:59:25 -0600 Message-Id: <20180430175925.2657-4-toshi.kani@hpe.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180430175925.2657-1-toshi.kani@hpe.com> References: <20180430175925.2657-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 816fd41ee854..809115150d8b 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. @@ -784,4 +785,22 @@ int pmd_free_pte_page(pmd_t *pmd, unsigned long addr) 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 */