From patchwork Thu Mar 5 12:01:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 5945211 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 4E3ED9F318 for ; Thu, 5 Mar 2015 12:01:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 77BE620383 for ; Thu, 5 Mar 2015 12:01:27 +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 939D92034A for ; Thu, 5 Mar 2015 12:01:23 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 89F1C8118F; Thu, 5 Mar 2015 04:01:23 -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 397418118F for ; Thu, 5 Mar 2015 04:01:22 -0800 (PST) Received: by widem10 with SMTP id em10so35604235wid.0 for ; Thu, 05 Mar 2015 04:01:20 -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=K3FwyJStPNXwrdktWZjEPoQ8E44jb8D0VA3TkYEoEmY=; b=JbrKuYvQY5rj1QDkTa1rGjwxAmcbBVbmOAnmAdnWy6RwzFTIjkRU91m160GL5TZaEM qz3yPyLOJy8woA3mTwFIH/oN25yYTeTS7ZmSjwCCSiypCRyj5ikvg5tkTJB8jVfgCDsB P7Y8jVchb7iivS9L4vtEe50/52vDtmKIcuGDqQNt5qP91Am4hF9R1434P588p8eq9RK2 Y1U4v8fey8FPPaShLjIbxQG9+GXxaO3Yq3YIOTZqj6nJoN24gZV+1yPlFlRZtveVarn5 i2ZZDTrDZteopz9DOzU8Hev1yUMdagDh6txlOfSuUHEGyPvYNhrR96UtbpLagRCPpF8P VeOg== X-Gm-Message-State: ALoCoQm/KxkC6pznMz1q7PqcoPiiXC2p/aUnJNugKEGlrJ+7TVmSANXf1m6/n/+cqW0PtNWj+KY5 X-Received: by 10.194.134.105 with SMTP id pj9mr16960682wjb.143.1425556880576; Thu, 05 Mar 2015 04:01:20 -0800 (PST) Received: from [10.0.0.5] ([207.232.55.62]) by mx.google.com with ESMTPSA id lb6sm10210182wjb.22.2015.03.05.04.01.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Mar 2015 04:01:20 -0800 (PST) Message-ID: <54F8458E.2060202@plexistor.com> Date: Thu, 05 Mar 2015 14:01:18 +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> <54F830D4.7030205@plexistor.com> In-Reply-To: <54F830D4.7030205@plexistor.com> Subject: [Linux-nvdimm] [PATCH 8/8] OUT-OF-TREE: pmem: Allow request_mem to fail (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 | 9 ++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index 635fa6a..58a2c69 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig @@ -435,6 +435,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 d0c80f4..ba1167c 100644 --- a/drivers/block/pmem.c +++ b/drivers/block/pmem.c @@ -172,8 +172,10 @@ int pmem_mapmem(struct pmem_device *pmem) "pmem"); 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); @@ -184,7 +186,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; }