From patchwork Thu Mar 5 10:21:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 5944521 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 52BEABF440 for ; Thu, 5 Mar 2015 10:22:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6B3E2202F8 for ; Thu, 5 Mar 2015 10:21:59 +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 72EF92037B for ; Thu, 5 Mar 2015 10:21:58 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 68AD781193; Thu, 5 Mar 2015 02:21:58 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BB1C581193 for ; Thu, 5 Mar 2015 02:21:56 -0800 (PST) Received: by widem10 with SMTP id em10so37173921wid.5 for ; Thu, 05 Mar 2015 02:21:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=vw3FA3VyWjY5WfL7KUfh0/+cXD+5Vm2tiUQleG5UCp4=; b=LSV+70NJNwKT/E8LIBDmHeMtB2k6QELSrtoJrL3L+Kyhh+2jO7V8XKPIZNKjRfQGtH h0+aXQlcnhXcHmPD0Z5oPf2nWoTkfKTvzm2vjIIvMRFHwl3eJDQzgewn9r9XBKm3Lewc HYPTFVtd3KBosQMt5ViuHEudhdHMKh5Llxhael/HxCC0cVG/QYRCi8imFDuAtTPlKQxP UDRhHOpUCzIi1UD8aAiuAA6PQc9YbOt3aWVCrSaja/ojKUkH1m27TvbdWu/412tIay8k WlHm6SZLy9DX7lgvv5SG9JgwIIjm+LXaZLGZ/oP+8GKBOAeuEtTe/EpzI5T1m23CpbOb oHQw== X-Gm-Message-State: ALoCoQnqaTgXfNOHMKiHLfAChAx4vxUlrlyaU8QNBH38/5FrFynMGOgKQdcQhZATlpjNdzb3Ejuj X-Received: by 10.194.8.99 with SMTP id q3mr17425173wja.88.1425550915350; Thu, 05 Mar 2015 02:21:55 -0800 (PST) Received: from [10.0.0.5] ([207.232.55.62]) by mx.google.com with ESMTPSA id y14sm9820397wjr.39.2015.03.05.02.21.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Mar 2015 02:21:54 -0800 (PST) Message-ID: <54F82E41.9050203@plexistor.com> Date: Thu, 05 Mar 2015 12:21:53 +0200 From: Boaz Harrosh User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Ingo Molnar , x86@kernel.org, linux-kernel , "Roger C. Pao" , Dan Williams , Thomas Gleixner , linux-nvdimm , "H. Peter Anvin" , Matthew Wilcox , Andy Lutomirski , Christoph Hellwig References: <54F82CE0.4040502@plexistor.com> In-Reply-To: <54F82CE0.4040502@plexistor.com> Subject: [Linux-nvdimm] [PATCH 2/3] resource: Add new flag IORESOURCE_MEM_WARN 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 memory resource providers set this flag if they want that request_region will print a warning in dmesg if this particular memory resource is locked by a driver. Thous acting as a Protocol Police about experimental devices that did not pass a committee approval. The Only user of this flag is x86/kernel/e820.c that wants to WARN about UNKNOWN memory types. NOTE: It would be preferred if I defined a general flag say IORESOURCE_WARN, where any kind of resource provider can WARN on use, but we have run out of flags in the 32bit long systems. So I defined a free bit from the resource specific flags for mem resources. This is why I need to check if this is a memory resource first so not to conflict with other resource specific flags. (Though actually no one is using this specific bit) CC: Thomas Gleixner CC: Ingo Molnar CC: "H. Peter Anvin" CC: x86@kernel.org CC: Dan Williams CC: Andrew Morton CC: Bjorn Helgaas CC: Vivek Goyal Signed-off-by: Boaz Harrosh --- arch/x86/kernel/e820.c | 3 +++ include/linux/ioport.h | 1 + kernel/resource.c | 11 ++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index c3a11cd..c2f2da2 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -961,6 +961,9 @@ void __init e820_reserve_resources(void) res->flags = IORESOURCE_MEM; + if (_is_unknown_type(e820.map[i].type)) + res->flags |= IORESOURCE_MEM_WARN; + /* * don't register the region that could be conflicted with * pci device BAR resource and insert them later in diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 2c525022..f78972b 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -90,6 +90,7 @@ struct resource { #define IORESOURCE_MEM_32BIT (3<<3) #define IORESOURCE_MEM_SHADOWABLE (1<<5) /* dup: IORESOURCE_SHADOWABLE */ #define IORESOURCE_MEM_EXPANSIONROM (1<<6) +#define IORESOURCE_MEM_WARN (1<<7) /* WARN if requested by driver */ /* PnP I/O specific bits (IORESOURCE_BITS) */ #define IORESOURCE_IO_16BIT_ADDR (1<<0) diff --git a/kernel/resource.c b/kernel/resource.c index 19f2357..f886666 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -1075,8 +1075,17 @@ struct resource * __request_region(struct resource *parent, break; if (conflict != parent) { parent = conflict; - if (!(conflict->flags & IORESOURCE_BUSY)) + if (!(conflict->flags & IORESOURCE_BUSY)) { + if ((resource_type(conflict) == IORESOURCE_MEM) + && (conflict->flags & IORESOURCE_MEM_WARN)) { + add_taint(TAINT_FIRMWARE_WORKAROUND, + LOCKDEP_STILL_OK); + pr_warn("%s requested an unknown memory type [mem %#010llx-%#010llx] %s\n", + name, conflict->start, + conflict->end, conflict->name); + } continue; + } } if (conflict->flags & flags & IORESOURCE_MUXED) { add_wait_queue(&muxed_resource_wait, &wait);