Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6414104imm; Wed, 27 Jun 2018 07:21:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpelt1ZMMGB/LzKPnCaBvB2dy3zw01ixss8DxE56s5cWNIbNyDRbxSagZc70JFo7Hel4BeqH X-Received: by 2002:a65:5205:: with SMTP id o5-v6mr4115720pgp.108.1530109291959; Wed, 27 Jun 2018 07:21:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530109291; cv=none; d=google.com; s=arc-20160816; b=odplStrV3a3XK4oaher3sdtQK/A2VAHCyK4qXziMA8CL1oHZ8kmuwwJ+FvC+OKM5F9 91DqBN/IS53J3BPMyc8cSu/5EPMAEKSYYpziSZCEcdkxi8MequvaFt4+qlMeYAS3fJdO eCi0eJWhkUnWEk+wEU4wHXGLUS24YukZEHYqnphXCsDH49suXKPhKQvuA65utJWp2Enj F7oLdItvvygy9sJa90mjCU+cFKiOZ1KasgCUd/eHrulPqA0kj6X2APXMSHyRf2Y6Y4Mq e/JGe9suzymzb3CpVZvXE/DiH64lA4qsJm/CmX3n7e8fg9nJ9BYPuIDXtCHMhAuaeHnq 5Kaw== 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=NtEqa/0IAn7zlq+dOhckd5Keidcp4beZ9Jgz1unaYbE=; b=z/uhA5JR5X/0gnpmF/AqgRlDNG+2pG72ivoj/QsoCZbwqEK9Sf52i8S0KBxTZZmmtF gGMpP4O+aWVkBYkzZ1S4nP/n+Q0fnSZZ8YyCa1sUw4tKAlgiqmXp1wwtad3c5YBtN6YF 4bCXqhn91djHp4SW/RgnymCGPZ6ldAyz6qMqhAG4pR00aiML91YN3g9LjJLmf4Bi2Gb1 DEJe5h+g14Jzf9JmPne2DOhL3236OOudTGcQpdBqS2NAyblwmDTaCVyE6dJN3rvP/vZa 5mKERgxs3dZD/rYiAJ9QL2yHx3/NCCE+ItLwzUTZO4/udXb6FAPaMjKLqueKLj9lkBQ1 0O/w== 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 q10-v6si3480925pgv.81.2018.06.27.07.21.17; Wed, 27 Jun 2018 07:21:31 -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 S965522AbeF0OQt (ORCPT + 99 others); Wed, 27 Jun 2018 10:16:49 -0400 Received: from g9t5009.houston.hpe.com ([15.241.48.73]:56418 "EHLO g9t5009.houston.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965214AbeF0OPu (ORCPT ); Wed, 27 Jun 2018 10:15:50 -0400 Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g9t5009.houston.hpe.com (Postfix) with ESMTP id E799F51; Wed, 27 Jun 2018 14:15:48 +0000 (UTC) Received: from misato.americas.hpqcorp.net (unknown [10.34.81.122]) by g4t3433.houston.hpecorp.net (Postfix) with ESMTP id 295AC47; Wed, 27 Jun 2018 14:15:48 +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 v4 1/3] x86/mm: disable ioremap free page handling on x86-PAE Date: Wed, 27 Jun 2018 08:13:46 -0600 Message-Id: <20180627141348.21777-2-toshi.kani@hpe.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180627141348.21777-1-toshi.kani@hpe.com> References: <20180627141348.21777-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 47b5951e592b..1aeb7a5dbce5 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c @@ -719,6 +719,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. @@ -766,4 +767,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 */