From patchwork Wed Feb 4 22:00:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Zwisler X-Patchwork-Id: 5779711 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 F1C8EBF440 for ; Wed, 4 Feb 2015 22:00:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 09C2020155 for ; Wed, 4 Feb 2015 22:00:55 +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 F167C201EC for ; Wed, 4 Feb 2015 22:00:53 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D0506812FC; Wed, 4 Feb 2015 14:00: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 AA0A2812FC for ; Wed, 4 Feb 2015 14:00:52 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 04 Feb 2015 14:00:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="449918104" Received: from theros.lm.intel.com (HELO [10.232.112.168]) ([10.232.112.168]) by FMSMGA003.fm.intel.com with ESMTP; 04 Feb 2015 13:46:23 -0800 Message-ID: <1423087236.22217.11.camel@theros.lm.intel.com> From: Ross Zwisler To: "Roger C. Pao (Enmotus)" Date: Wed, 04 Feb 2015 15:00:36 -0700 In-Reply-To: References: <54D27060.7020102@plexistor.com> X-Mailer: Evolution 3.10.4 (3.10.4-4.fc20.rez) Mime-Version: 1.0 Cc: linux-nvdimm@lists.01.org Subject: Re: [Linux-nvdimm] modprobe: ERROR: could not insert 'pmem': Invalid argument 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 Wed, 2015-02-04 at 13:45 -0800, Roger C. Pao (Enmotus) wrote: > [rcpao@test27 pmem]$ sudo modprobe pmem map=4G@18G > modprobe: ERROR: could not insert 'pmem': Invalid argument > > > From dmesg: > > [ 125.343206] add_persistent_memory: request_mem_region_exclusive > phys=0x480000000 size=0x100000000 failed > > > occurs even if I add mapmem=4G$18G to the kernel line. I originally > tried without it. > > [rcpao@test27 pmem]$ cat /proc/cmdline > BOOT_IMAGE=/vmlinuz-3.19.0-rc3+ root=/dev/mapper/fedora-root ro > rd.lvm.lv=fedora/swap rd.lvm.lv=fedora/root mapmem=4G$18G > > > Note: /etc/default/grub requires \\\ to escape \ and $: > GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/swap rd.lvm.lv=fedora/root > mapmem=4G\\\$18G" Ah, yep, I've seen this issue as well I think. The request_mem_region_exclusive() fails when you aren't dealing with kernel usable memory - and yours isn't because it's marked as type 12 in the e820 table. Here, try this patch (compile tested only against my tree): ------------------------- From 9dbd5ae0b7369862e71d28e465372b75cd363e9c Mon Sep 17 00:00:00 2001 From: Ross Zwisler Date: Wed, 4 Feb 2015 14:58:43 -0700 Subject: [PATCH] TEST pmem: Skip memory reservation for PMEM region Skip the memory reservation step for the memory consumed by PMEM. This is a quick workaround for systems that have real NVDIMMs that don't show up as kernel usable in the e820 table. Compile tested only. Signed-off-by: Ross Zwisler --- drivers/block/pmem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/block/pmem.c b/drivers/block/pmem.c index 1bd9ab0..078ad09 100644 --- a/drivers/block/pmem.c +++ b/drivers/block/pmem.c @@ -238,6 +238,7 @@ int pmem_mapmem(struct pmem_device *pmem) struct resource *res_mem; int err; + /* res_mem = request_mem_region_exclusive(pmem->phys_addr, pmem->size, "pmem"); if (!res_mem) { @@ -245,6 +246,7 @@ int pmem_mapmem(struct pmem_device *pmem) pmem->phys_addr, pmem->size); return -EINVAL; } + */ pmem->virt_addr = ioremap_cache(pmem->phys_addr, pmem->size); if (unlikely(!pmem->virt_addr)) { @@ -254,7 +256,7 @@ int pmem_mapmem(struct pmem_device *pmem) return 0; out_release: - release_mem_region(pmem->phys_addr, pmem->size); +// release_mem_region(pmem->phys_addr, pmem->size); return err; } @@ -264,7 +266,7 @@ void pmem_unmapmem(struct pmem_device *pmem) return; iounmap(pmem->virt_addr); - release_mem_region(pmem->phys_addr, pmem->size); +// release_mem_region(pmem->phys_addr, pmem->size); pmem->virt_addr = NULL; }