Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1326855 > unrolled thread

[PATCH v2 0/5] LightNVM updates for next 4.5-rc

Started byMatias Bjørling <m@bjorling.me>
First post2016-02-04 15:20 +0100
Last post2016-02-04 17:30 +0100
Articles 6 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/5] LightNVM updates for next 4.5-rc Matias Bjørling <m@bjorling.me> - 2016-02-04 15:20 +0100
    [PATCH 5/5] lightnvm: allow to force mm initialization Matias Bjørling <m@bjorling.me> - 2016-02-04 15:20 +0100
    [PATCH 3/5] lightnvm: fix request intersection locking in rrpc Matias Bjørling <m@bjorling.me> - 2016-02-04 15:20 +0100
    [PATCH 4/5] lightnvm: check overflow and correct mlc pairs Matias Bjørling <m@bjorling.me> - 2016-02-04 15:20 +0100
    [PATCH 2/5] lightnvm: warn if irqs are disabled in lock laddr Matias Bjørling <m@bjorling.me> - 2016-02-04 15:20 +0100
    Re: [PATCH v2 0/5] LightNVM updates for next 4.5-rc Jens Axboe <axboe@fb.com> - 2016-02-04 17:30 +0100

#1326855 — [PATCH v2 0/5] LightNVM updates for next 4.5-rc

FromMatias Bjørling <m@bjorling.me>
Date2016-02-04 15:20 +0100
Subject[PATCH v2 0/5] LightNVM updates for next 4.5-rc
Message-ID<qYsVj-1nc-9@gated-at.bofh.it>
Hi Jens,

(Sorry for double post. Missed Signed-off-by)

A couple of patches to fix a couple of bugs.

One patch from Javier that fixes intersection locking after multi page
functionality was added and another that adds a warning if interrupts
are disabled during address locking.

A patch from Wenwei that makes sure we return bio if mempool allocation
fails.

Two patches from me. One that fixes calculation of MLC memory pairs for
lower page table and another that allows the null_blk to have a media
manager added without having a storage backend.

Please pick up when convenient.

Thanks,
Matias

Javier González (2):
  lightnvm: warn if irqs are disabled in lock laddr
  lightnvm: fix request intersection locking in rrpc

Matias Bjørling (2):
  lightnvm: check overflow and correct mlc pairs
  lightnvm: allow to force mm initialization

Wenwei Tao (1):
  lightnvm: put bio before return

 drivers/block/null_blk.c     |  2 +-
 drivers/lightnvm/core.c      | 25 ++++++++++++++++---------
 drivers/lightnvm/rrpc.c      |  4 +++-
 drivers/lightnvm/rrpc.h      |  5 +++--
 drivers/nvme/host/lightnvm.c | 12 +++++++++---
 include/linux/lightnvm.h     |  4 ++++
 6 files changed, 36 insertions(+), 16 deletions(-)

-- 
2.1.4

[toc] | [next] | [standalone]


#1326856 — [PATCH 5/5] lightnvm: allow to force mm initialization

FromMatias Bjørling <m@bjorling.me>
Date2016-02-04 15:20 +0100
Subject[PATCH 5/5] lightnvm: allow to force mm initialization
Message-ID<qYsVk-1nc-19@gated-at.bofh.it>
In reply to#1326855
System block allows the device to initialize with its configured media
manager. The system blocks is written to disk, and read again when media
manager is determined. For this to work, the backend must store the
data. Device drivers, such as null_blk, does not have any backend
storage. This patch allows the media manager to be initialized without a
storage backend.

It also fix incorrect configuration of capabilities in null_blk, as it
does not support get/set bad block interface.

Signed-off-by: Matias Bjørling <m@bjorling.me>
---
 drivers/block/null_blk.c |  2 +-
 drivers/lightnvm/core.c  | 25 ++++++++++++++++---------
 include/linux/lightnvm.h |  4 ++++
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index 8ba1e97..ae05d31 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -478,7 +478,7 @@ static int null_lnvm_id(struct nvm_dev *dev, struct nvm_id *id)
 	id->ver_id = 0x1;
 	id->vmnt = 0;
 	id->cgrps = 1;
-	id->cap = 0x3;
+	id->cap = 0x2;
 	id->dom = 0x1;
 
 	id->ppaf.blk_offset = 0;
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index 5471cc5..c3d4b54 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -568,11 +568,13 @@ int nvm_register(struct request_queue *q, char *disk_name,
 		}
 	}
 
-	ret = nvm_get_sysblock(dev, &dev->sb);
-	if (!ret)
-		pr_err("nvm: device not initialized.\n");
-	else if (ret < 0)
-		pr_err("nvm: err (%d) on device initialization\n", ret);
+	if (dev->identity.cap & NVM_ID_DCAP_BBLKMGMT) {
+		ret = nvm_get_sysblock(dev, &dev->sb);
+		if (!ret)
+			pr_err("nvm: device not initialized.\n");
+		else if (ret < 0)
+			pr_err("nvm: err (%d) on device initialization\n", ret);
+	}
 
 	/* register device with a supported media manager */
 	down_write(&nvm_lock);
@@ -1051,9 +1053,11 @@ static long __nvm_ioctl_dev_init(struct nvm_ioctl_dev_init *init)
 	strncpy(info.mmtype, init->mmtype, NVM_MMTYPE_LEN);
 	info.fs_ppa.ppa = -1;
 
-	ret = nvm_init_sysblock(dev, &info);
-	if (ret)
-		return ret;
+	if (dev->identity.cap & NVM_ID_DCAP_BBLKMGMT) {
+		ret = nvm_init_sysblock(dev, &info);
+		if (ret)
+			return ret;
+	}
 
 	memcpy(&dev->sb, &info, sizeof(struct nvm_sb_info));
 
@@ -1113,7 +1117,10 @@ static long nvm_ioctl_dev_factory(struct file *file, void __user *arg)
 		dev->mt = NULL;
 	}
 
-	return nvm_dev_factory(dev, fact.flags);
+	if (dev->identity.cap & NVM_ID_DCAP_BBLKMGMT)
+		return nvm_dev_factory(dev, fact.flags);
+
+	return 0;
 }
 
 static long nvm_ctl_ioctl(struct file *file, uint cmd, unsigned long arg)
diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h
index b94f2d5..08c1e14 100644
--- a/include/linux/lightnvm.h
+++ b/include/linux/lightnvm.h
@@ -135,6 +135,10 @@ enum {
 	/* Memory types */
 	NVM_ID_FMTYPE_SLC	= 0,
 	NVM_ID_FMTYPE_MLC	= 1,
+
+	/* Device capabilities */
+	NVM_ID_DCAP_BBLKMGMT	= 0x1,
+	NVM_UD_DCAP_ECC		= 0x2,
 };
 
 struct nvm_id_lp_mlc {
-- 
2.1.4

[toc] | [prev] | [next] | [standalone]


#1326857 — [PATCH 3/5] lightnvm: fix request intersection locking in rrpc

FromMatias Bjørling <m@bjorling.me>
Date2016-02-04 15:20 +0100
Subject[PATCH 3/5] lightnvm: fix request intersection locking in rrpc
Message-ID<qYsVk-1nc-23@gated-at.bofh.it>
In reply to#1326855
From: Javier González <jg@lightnvm.io>

This patch fixes an error on the calculation of intersecting logical
addresses; it contemplates the case where a new request including
several addresses intersects with a single locked address. This case is
typical when multiple pages are sent in a new request, while GC - which
at the moment sends one address at the time - is running.

Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
---
 drivers/lightnvm/rrpc.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/lightnvm/rrpc.h b/drivers/lightnvm/rrpc.h
index c27283a..3989d65 100644
--- a/drivers/lightnvm/rrpc.h
+++ b/drivers/lightnvm/rrpc.h
@@ -174,8 +174,7 @@ static inline sector_t rrpc_get_sector(sector_t laddr)
 static inline int request_intersects(struct rrpc_inflight_rq *r,
 				sector_t laddr_start, sector_t laddr_end)
 {
-	return (laddr_end >= r->l_start && laddr_end <= r->l_end) &&
-		(laddr_start >= r->l_start && laddr_start <= r->l_end);
+	return (laddr_end >= r->l_start) && (laddr_start <= r->l_end);
 }
 
 static int __rrpc_lock_laddr(struct rrpc *rrpc, sector_t laddr,
-- 
2.1.4

[toc] | [prev] | [next] | [standalone]


#1326865 — [PATCH 4/5] lightnvm: check overflow and correct mlc pairs

FromMatias Bjørling <m@bjorling.me>
Date2016-02-04 15:20 +0100
Subject[PATCH 4/5] lightnvm: check overflow and correct mlc pairs
Message-ID<qYsVl-1nc-39@gated-at.bofh.it>
In reply to#1326855
The specification currently limits the number of MLC pairs to 886. Make
sure that a device is unable to be instantiate if more is configured.

Also, previously the patch had the wrong math for copying MLC pairs, as
it only copied half of the actual entries.

Fixes: ca5927e7ab53 "lightnvm: introduce mlc lower page table mappings"
Signed-off-by: Matias Bjørling <m@bjorling.me>
---
 drivers/nvme/host/lightnvm.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 0f0864f..55dab93 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -146,9 +146,10 @@ struct nvme_nvm_command {
 	};
 };
 
+#define NVME_NVM_LP_MLC_PAIRS 886
 struct nvme_nvm_lp_mlc {
 	__u16			num_pairs;
-	__u8			pairs[886];
+	__u8			pairs[NVME_NVM_LP_MLC_PAIRS];
 };
 
 struct nvme_nvm_lp_tbl {
@@ -282,9 +283,14 @@ static int init_grps(struct nvm_id *nvm_id, struct nvme_nvm_id *nvme_nvm_id)
 			memcpy(dst->lptbl.id, src->lptbl.id, 8);
 			dst->lptbl.mlc.num_pairs =
 					le16_to_cpu(src->lptbl.mlc.num_pairs);
-			/* 4 bits per pair */
+
+			if (dst->lptbl.mlc.num_pairs > NVME_NVM_LP_MLC_PAIRS) {
+				pr_err("nvm: number of MLC pairs not supported\n");
+				return -EINVAL;
+			}
+
 			memcpy(dst->lptbl.mlc.pairs, src->lptbl.mlc.pairs,
-						dst->lptbl.mlc.num_pairs >> 1);
+						dst->lptbl.mlc.num_pairs);
 		}
 	}
 
-- 
2.1.4

[toc] | [prev] | [next] | [standalone]


#1326866 — [PATCH 2/5] lightnvm: warn if irqs are disabled in lock laddr

FromMatias Bjørling <m@bjorling.me>
Date2016-02-04 15:20 +0100
Subject[PATCH 2/5] lightnvm: warn if irqs are disabled in lock laddr
Message-ID<qYsVl-1nc-45@gated-at.bofh.it>
In reply to#1326855
From: Javier González <jg@lightnvm.io>

Add a warning if irqs are disabled when locking a new address in rrpc.
The typical path to a new request does not disable irqs, but this is not
guaranteed in the future.

Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
---
 drivers/lightnvm/rrpc.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/lightnvm/rrpc.h b/drivers/lightnvm/rrpc.h
index dfca5c4..c27283a 100644
--- a/drivers/lightnvm/rrpc.h
+++ b/drivers/lightnvm/rrpc.h
@@ -184,6 +184,8 @@ static int __rrpc_lock_laddr(struct rrpc *rrpc, sector_t laddr,
 	sector_t laddr_end = laddr + pages - 1;
 	struct rrpc_inflight_rq *rtmp;
 
+	WARN_ON(irqs_disabled());
+
 	spin_lock_irq(&rrpc->inflights.lock);
 	list_for_each_entry(rtmp, &rrpc->inflights.reqs, list) {
 		if (unlikely(request_intersects(rtmp, laddr, laddr_end))) {
-- 
2.1.4

[toc] | [prev] | [next] | [standalone]


#1326963

FromJens Axboe <axboe@fb.com>
Date2016-02-04 17:30 +0100
Message-ID<qYuX8-4mU-13@gated-at.bofh.it>
In reply to#1326855
On 02/04/2016 07:13 AM, Matias Bjørling wrote:
> Hi Jens,
>
> (Sorry for double post. Missed Signed-off-by)
>
> A couple of patches to fix a couple of bugs.
>
> One patch from Javier that fixes intersection locking after multi page
> functionality was added and another that adds a warning if interrupts
> are disabled during address locking.
>
> A patch from Wenwei that makes sure we return bio if mempool allocation
> fails.
>
> Two patches from me. One that fixes calculation of MLC memory pairs for
> lower page table and another that allows the null_blk to have a media
> manager added without having a storage backend.
>
> Please pick up when convenient.

Applied, thanks.

-- 
Jens Axboe

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web