From patchwork Tue Feb 24 04:22:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 5869541 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C612D9F37F for ; Tue, 24 Feb 2015 04:22:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9F3672062D for ; Tue, 24 Feb 2015 04:22:54 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AF90320635 for ; Tue, 24 Feb 2015 04:22:53 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 674808122A; Mon, 23 Feb 2015 20:22:53 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by ml01.01.org (Postfix) with ESMTP id D0CB08122A for ; Mon, 23 Feb 2015 20:22:51 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 23 Feb 2015 20:22:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,636,1418112000"; d="scan'208";a="670589545" Received: from dwillia2-mobl3.amr.corp.intel.com ([10.255.71.148]) by fmsmga001.fm.intel.com with ESMTP; 23 Feb 2015 20:22:49 -0800 Message-ID: <1424751767.9050.4.camel@intel.com> From: Dan Williams To: Boaz Harrosh Date: Mon, 23 Feb 2015 20:22:47 -0800 In-Reply-To: <54EB1E03.4010306@plexistor.com> References: <54EB1D33.3050107@plexistor.com> <54EB1E03.4010306@plexistor.com> X-Mailer: Evolution 3.12.10 (3.12.10-1.fc21) Mime-Version: 1.0 Cc: linux-nvdimm , x86@kernel.org, linux-kernel , Andy Lutomirski , Christoph Hellwig , Ingo Molnar , "H. Peter Anvin" , Linus Torvalds , Thomas Gleixner Subject: Re: [Linux-nvdimm] [PATCH 1/3] e820: Don't let unknown DIMM type come out BUSY X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_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 On Mon, 2015-02-23 at 14:33 +0200, Boaz Harrosh wrote: > There is something not very nice (Gentlemen nice) In current > e820.c code. > > At Multiple places for example like (@ memblock_x86_fill()) it will > add the different memory resources *except the E820_RESERVED type* > > Then at e820_reserve_resources() it will mark all !E820_RESERVED > as busy. > > This is all fine when we have only the known types one of: > E820_RESERVED_KERN: > E820_RAM: > E820_ACPI: > E820_NVS: > E820_UNUSABLE: > E820_RESERVED: > > But if the system encounters a brand new memory type it will > not add it to any memory list, But will proceed to mark it > BUSY. So now any other Driver in the system that does know > how to deal with this new type, is not able to call > request_mem_region_exclusive() on this new type because it is > hard coded BUSY even though nothing really uses it. > > So make any unknown type behave like E820_RESERVED memory, > it will show up as available to first caller of > request_mem_region_exclusive(). > > I Also change the string representation of an unknown type > from "reserved" (So to not confuse with memmap "reserved" > region). And call it "reserved-unknown" > I wish I could return "reserved-type-X" But this is not possible > because one must return a constant, code-segment, string. > > (NOTE: These unknown-types where called "reserved" in > /proc/iomem and in dmesg but behaved differently. What this > patch does is name them differently but let them behave > the same) > > By Popular demand An Extra WARNING message is printed if > an "UNKNOWN" is found. It will look like this: > e820: WARNING [mem 0x100000000-0x1ffffffff] is unknown type 12 I don't think we need to warn that an unknown range was published, just warn if it is consumed. Something like these incremental changes. I don't see the need for patch 2 or either version of patch 3. diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 1afa5518baa6..2e755a92d84f 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -134,11 +134,6 @@ static void __init __e820_add_region(struct e820map *e820x, u64 start, u64 size, return; } - if (unlikely(_is_unknown_type(type))) - pr_warn("e820: WARNING [mem %#010llx-%#010llx] is unknown type %d\n", - (unsigned long long) start, - (unsigned long long) (start + size - 1), type); - e820x->map[x].addr = start; e820x->map[x].size = size; e820x->map[x].type = type; @@ -938,7 +933,7 @@ static inline const char *e820_type_to_string(int e820_type) case E820_NVS: return "ACPI Non-volatile Storage"; case E820_UNUSABLE: return "Unusable memory"; case E820_RESERVED: return "reserved"; - default: return "reserved-unkown"; + default: return iomem_unknown_resource_name; } } diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 2c5250222278..d857e79b4bf2 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -194,6 +194,9 @@ extern struct resource * __request_region(struct resource *, resource_size_t n, const char *name, int flags); +/* For uniquely tagging unknown memory so we can warn when it is consumed */ +extern const char iomem_unknown_resource_name[]; + /* Compatibility cruft */ #define release_region(start,n) __release_region(&ioport_resource, (start), (n)) #define check_mem_region(start,n) __check_region(&iomem_resource, (start), (n)) diff --git a/kernel/resource.c b/kernel/resource.c index 0bcebffc4e77..38b36c212a48 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -1040,6 +1040,8 @@ resource_size_t resource_alignment(struct resource *res) static DECLARE_WAIT_QUEUE_HEAD(muxed_resource_wait); +const char iomem_unknown_resource_name[] = { "reserved-unknown" }; + /** * __request_region - create a new busy resource region * @parent: parent resource descriptor @@ -1092,6 +1094,15 @@ struct resource * __request_region(struct resource *parent, break; } write_unlock(&resource_lock); + + if (res && res->parent + && res->parent->name == iomem_unknown_resource_name) { + add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); + pr_warn("request unknown region [mem %#010llx-%#010llx] %s\n", + res->start, res->end, + res->name); + } + return res; } EXPORT_SYMBOL(__request_region);