From patchwork Fri Jan 10 19:04:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prarit Bhargava X-Patchwork-Id: 3467731 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9221FC02DC for ; Fri, 10 Jan 2014 19:05:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 56D682013A for ; Fri, 10 Jan 2014 19:05:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 57CCD2012E for ; Fri, 10 Jan 2014 19:05:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751258AbaAJTFb (ORCPT ); Fri, 10 Jan 2014 14:05:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:63597 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751483AbaAJTFb (ORCPT ); Fri, 10 Jan 2014 14:05:31 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0AJ5AFP018078 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 10 Jan 2014 14:05:10 -0500 Received: from prarit.bos.redhat.com ([10.18.17.119]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s0AJ52Rw018246; Fri, 10 Jan 2014 14:05:08 -0500 From: Prarit Bhargava To: linux-kernel@vger.kernel.org Cc: Prarit Bhargava , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Len Brown , "Rafael J. Wysocki" , Linn Crosetto , Pekka Enberg , Yinghai Lu , Andrew Morton , Toshi Kani , Tang Chen , Wen Congyang , Vivek Goyal , kosaki.motohiro@gmail.com, dyoung@redhat.com, linux-acpi@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 2/2] x86, e820 disable ACPI Memory Hotplug if memory mapping is specified by user [v2] Date: Fri, 10 Jan 2014 14:04:58 -0500 Message-Id: <1389380698-19361-4-git-send-email-prarit@redhat.com> In-Reply-To: <1389380698-19361-1-git-send-email-prarit@redhat.com> References: <1389380698-19361-1-git-send-email-prarit@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP kdump uses memmap=exactmap and mem=X values to configure the memory mapping for the kdump kernel. If memory is hotadded during the boot of the kdump kernel it is possible that the page tables for the new memory cause the kdump kernel to run out of memory. Since the user has specified a specific mapping ACPI Memory Hotplug should be disabled in this case. [v2]: really add mem= Signed-off-by: Prarit Bhargava Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x86@kernel.org Cc: Len Brown Cc: "Rafael J. Wysocki" Cc: Linn Crosetto Cc: Pekka Enberg Cc: Yinghai Lu Cc: Andrew Morton Cc: Toshi Kani Cc: Tang Chen Cc: Wen Congyang Cc: Vivek Goyal Cc: kosaki.motohiro@gmail.com Cc: dyoung@redhat.com Cc: Toshi Kani Cc: linux-acpi@vger.kernel.org Cc: linux-mm@kvack.org --- arch/x86/kernel/e820.c | 10 +++++++++- drivers/acpi/acpi_memhotplug.c | 7 ++++++- include/linux/memory_hotplug.h | 3 +++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 174da5f..747f36a 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -834,6 +835,8 @@ static int __init parse_memopt(char *p) return -EINVAL; e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1); + set_acpi_no_memhotplug(); + return 0; } early_param("mem", parse_memopt); @@ -880,15 +883,20 @@ static int __init parse_memmap_one(char *p) return *p == '\0' ? 0 : -EINVAL; } + static int __init parse_memmap_opt(char *str) { + int ret; + while (str) { char *k = strchr(str, ','); if (k) *k++ = 0; - parse_memmap_one(str); + ret = parse_memmap_one(str); + if (!ret) + set_acpi_no_memhotplug(); str = k; } diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 4a0fa94..48b9267 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -363,6 +363,11 @@ static void acpi_memory_device_remove(struct acpi_device *device) static bool acpi_no_memhotplug; +void set_acpi_no_memhotplug(void) +{ + acpi_no_memhotplug = true; +} + void __init acpi_memory_hotplug_init(void) { if (acpi_no_memhotplug) @@ -373,7 +378,7 @@ void __init acpi_memory_hotplug_init(void) static int __init disable_acpi_memory_hotplug(char *str) { - acpi_no_memhotplug = true; + set_acpi_no_memhotplug(); return 1; } __setup("acpi_no_memhotplug", disable_acpi_memory_hotplug); diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 4ca3d95..80f5a23 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -12,6 +12,9 @@ struct pglist_data; struct mem_section; struct memory_block; +/* set flag to disable ACPI memory hotplug */ +extern void set_acpi_no_memhotplug(void); + #ifdef CONFIG_MEMORY_HOTPLUG /*