From patchwork Mon Feb 16 11:24:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 5832091 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 9725ABF440 for ; Mon, 16 Feb 2015 11:25:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B2678201FA for ; Mon, 16 Feb 2015 11:25:19 +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 1B152201B9 for ; Mon, 16 Feb 2015 11:25:18 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DA73080F95; Mon, 16 Feb 2015 03:25:17 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mail-we0-x22a.google.com (mail-we0-x22a.google.com [IPv6:2a00:1450:400c:c03::22a]) (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 F1D0680F95 for ; Mon, 16 Feb 2015 03:25:16 -0800 (PST) Received: by mail-we0-f170.google.com with SMTP id q59so28667878wes.1 for ; Mon, 16 Feb 2015 03:24:30 -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=9JXpD7e9hjURNx2K2aj9D4I0p+sRTj48HzeBBF0fSP4=; b=SK3YvPT61jcazNQf1FLN1BGnMyMaypm17vrqxxv4H/BDgwizC8c1uoTDdbjuTsRMdS hvSa9FaOE9ktyiG6CUulwynPlmdFlVI9RKklxcVSr+vlvGZ66XiD9DQnzBYFaYFdqC13 jLiY0a447bTb3NfvYToy3tfusDXNH4a8Irt3TkzSN0BHf96HWB1v/Xz9IxtqF6RAWMl6 qIa69RafAoO5C+9Swq4hGdU8f7C8KT5libqokEJiwqROIiBA3+GLBTWha5DYbDw2gRKZ Hqj+aXto2s+b19aIHumGvbyQ3LfKLPnnr+5nH44++MuQabM8R53aufr/67xDDfGkYCGr OATQ== X-Gm-Message-State: ALoCoQlMR0P//s1NT553Ob2TCMg9XH3TXlO4Nb5QvGqCPMxKk2ilpO5Vm50ZVuWaP+PI7Ft2Y9Xn X-Received: by 10.194.19.197 with SMTP id h5mr35902614wje.109.1424085870445; Mon, 16 Feb 2015 03:24:30 -0800 (PST) Received: from [10.0.0.5] ([207.232.55.62]) by mx.google.com with ESMTPSA id bi9sm15224762wib.18.2015.02.16.03.24.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Feb 2015 03:24:29 -0800 (PST) Message-ID: <54E1D36B.4000905@plexistor.com> Date: Mon, 16 Feb 2015 13:24:27 +0200 From: Boaz Harrosh User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Ingo Molnar , Ross Zwisler , x86@kernel.org, linux-kernel , "Roger C. Pao" , Dan Williams , Thomas Gleixner , Linus Torvalds , linux-nvdimm References: <54E1CF5B.9020905@plexistor.com> In-Reply-To: <54E1CF5B.9020905@plexistor.com> Cc: "H. Peter Anvin" Subject: [Linux-nvdimm] [PATCH 3/3] pmem: Allow request_mem to fail, (CONFIG_BLK_DEV_PMEM_IGNORE_REQUEST_MEM_RET) 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 With old Kernels there was a bug in x86 where any unknown memory chip type would come up BUSY when calling request_mem_region_exclusive(). So for pmem to work with old Kernels and real NvDIMM chips we have a new Kconfig option CONFIG_BLK_DEV_PMEM_IGNORE_REQUEST_MEM_RET. People have been running with hacked up pmem that will ignore the return code from request_mem_region_exclusive. So here it is official Signed-off-by: Boaz Harrosh --- drivers/block/Kconfig | 12 ++++++++++++ drivers/block/pmem.c | 11 +++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index 3b3200f..10879b8 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig @@ -430,6 +430,18 @@ config BLK_DEV_PMEM_USE_PAGES to other devices in the system, then you must say "Yes" here. If unsure leave as Yes. +config BLK_DEV_PMEM_IGNORE_REQUEST_MEM_RET + bool "Ignore the return code from request_mem_region_exclusive" + depends on BLK_DEV_PMEM + help + In Old Kernels type-12 Memory type which is used by NvDIMM + chips Comes out busy when calling request_mem_region_exclusive, + because of a bug. + If this option is set to "yes". The pmem will ignore the + failure, and continue as usual. If you have an old Kernel and + a real NvDIMM chip you must say yes here. + (Ignored if BLK_DEV_PMEM_USE_PAGES=y) + config CDROM_PKTCDVD tristate "Packet writing on CD/DVD media" depends on !UML diff --git a/drivers/block/pmem.c b/drivers/block/pmem.c index 9eb7ffe..f84d033 100644 --- a/drivers/block/pmem.c +++ b/drivers/block/pmem.c @@ -197,10 +197,12 @@ int pmem_mapmem(struct pmem_device *pmem) res_mem = request_mem_region_exclusive(pmem->phys_addr, pmem->size, "pmem"); - if (!res_mem) { + if (unlikely(!res_mem)) { pr_warn("pmem: request_mem_region_exclusive phys=0x%llx size=0x%zx failed\n", - pmem->phys_addr, pmem->size); - return -EINVAL; + pmem->phys_addr, pmem->size); +#ifndef CONFIG_BLK_DEV_PMEM_IGNORE_REQUEST_MEM_RET + return -EBUSY; +#endif } pmem->virt_addr = ioremap_cache(pmem->phys_addr, pmem->size); @@ -211,7 +213,8 @@ int pmem_mapmem(struct pmem_device *pmem) return 0; out_release: - release_mem_region(pmem->phys_addr, pmem->size); + if (res_mem) + release_mem_region(pmem->phys_addr, pmem->size); return err; }