All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "[PATCH 033/135] NVMe: fix build with CONFIG_NVM enabled" has been added to the 4.4-stable tree
@ 2016-09-09 13:37 gregkh
  2016-09-09 14:00 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: gregkh @ 2016-09-09 13:37 UTC (permalink / raw)
  To: hch, alexander.levin, axboe, gregkh, ww.tao0320; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    [PATCH 033/135] NVMe: fix build with CONFIG_NVM enabled

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     0033-NVMe-fix-build-with-CONFIG_NVM-enabled.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 949e31ee7225602105e4129b9a093d3fc546f701 Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Thu, 3 Dec 2015 09:52:05 -0700
Subject: [PATCH 033/135] NVMe: fix build with CONFIG_NVM enabled

[ Upstream commit ac02dddec63385ffef1397d3f56cec4108bcafe9 ]

Looks like I didn't test with CONFIG_NVM enabled, and neither did
the build bot.

Most of this is really weird crazy shit in the lighnvm support, though.

Struct nvme_ns is a structure for the NVM I/O command set, and it has
no business poking into it.  Second this commit:

commit 47b3115ae7b799be8b77b0f024215ad4f68d6460
Author: Wenwei Tao <ww.tao0320@gmail.com>
Date:   Fri Nov 20 13:47:55 2015 +0100

    nvme: lightnvm: use admin queues for admin cmds

Does even more crazy stuff.  If a function gets a request_queue parameter
passed it'd better use that and not look for another one.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/nvme/host/lightnvm.c |   35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -274,7 +274,6 @@ static int init_grps(struct nvm_id *nvm_
 static int nvme_nvm_identity(struct nvm_dev *nvmdev, struct nvm_id *nvm_id)
 {
 	struct nvme_ns *ns = nvmdev->q->queuedata;
-	struct nvme_dev *dev = ns->dev;
 	struct nvme_nvm_id *nvme_nvm_id;
 	struct nvme_nvm_command c = {};
 	int ret;
@@ -287,7 +286,7 @@ static int nvme_nvm_identity(struct nvm_
 	if (!nvme_nvm_id)
 		return -ENOMEM;
 
-	ret = nvme_submit_sync_cmd(dev->admin_q, (struct nvme_command *)&c,
+	ret = nvme_submit_sync_cmd(ns->ctrl->admin_q, (struct nvme_command *)&c,
 				nvme_nvm_id, sizeof(struct nvme_nvm_id));
 	if (ret) {
 		ret = -EIO;
@@ -312,9 +311,8 @@ static int nvme_nvm_get_l2p_tbl(struct n
 				nvm_l2p_update_fn *update_l2p, void *priv)
 {
 	struct nvme_ns *ns = nvmdev->q->queuedata;
-	struct nvme_dev *dev = ns->dev;
 	struct nvme_nvm_command c = {};
-	u32 len = queue_max_hw_sectors(dev->admin_q) << 9;
+	u32 len = queue_max_hw_sectors(ns->ctrl->admin_q) << 9;
 	u32 nlb_pr_rq = len / sizeof(u64);
 	u64 cmd_slba = slba;
 	void *entries;
@@ -332,10 +330,10 @@ static int nvme_nvm_get_l2p_tbl(struct n
 		c.l2p.slba = cpu_to_le64(cmd_slba);
 		c.l2p.nlb = cpu_to_le32(cmd_nlb);
 
-		ret = nvme_submit_sync_cmd(dev->admin_q,
+		ret = nvme_submit_sync_cmd(ns->ctrl->admin_q,
 				(struct nvme_command *)&c, entries, len);
 		if (ret) {
-			dev_err(dev->dev, "L2P table transfer failed (%d)\n",
+			dev_err(ns->ctrl->dev, "L2P table transfer failed (%d)\n",
 									ret);
 			ret = -EIO;
 			goto out;
@@ -361,7 +359,7 @@ static int nvme_nvm_get_bb_tbl(struct nv
 {
 	struct request_queue *q = nvmdev->q;
 	struct nvme_ns *ns = q->queuedata;
-	struct nvme_dev *dev = ns->dev;
+	struct nvme_ctrl *ctrl = ns->ctrl;
 	struct nvme_nvm_command c = {};
 	struct nvme_nvm_bb_tbl *bb_tbl;
 	int tblsz = sizeof(struct nvme_nvm_bb_tbl) + nr_blocks;
@@ -375,30 +373,30 @@ static int nvme_nvm_get_bb_tbl(struct nv
 	if (!bb_tbl)
 		return -ENOMEM;
 
-	ret = nvme_submit_sync_cmd(dev->admin_q, (struct nvme_command *)&c,
+	ret = nvme_submit_sync_cmd(ctrl->admin_q, (struct nvme_command *)&c,
 								bb_tbl, tblsz);
 	if (ret) {
-		dev_err(dev->dev, "get bad block table failed (%d)\n", ret);
+		dev_err(ctrl->dev, "get bad block table failed (%d)\n", ret);
 		ret = -EIO;
 		goto out;
 	}
 
 	if (bb_tbl->tblid[0] != 'B' || bb_tbl->tblid[1] != 'B' ||
 		bb_tbl->tblid[2] != 'L' || bb_tbl->tblid[3] != 'T') {
-		dev_err(dev->dev, "bbt format mismatch\n");
+		dev_err(ctrl->dev, "bbt format mismatch\n");
 		ret = -EINVAL;
 		goto out;
 	}
 
 	if (le16_to_cpu(bb_tbl->verid) != 1) {
 		ret = -EINVAL;
-		dev_err(dev->dev, "bbt version not supported\n");
+		dev_err(ctrl->dev, "bbt version not supported\n");
 		goto out;
 	}
 
 	if (le32_to_cpu(bb_tbl->tblks) != nr_blocks) {
 		ret = -EINVAL;
-		dev_err(dev->dev, "bbt unsuspected blocks returned (%u!=%u)",
+		dev_err(ctrl->dev, "bbt unsuspected blocks returned (%u!=%u)",
 					le32_to_cpu(bb_tbl->tblks), nr_blocks);
 		goto out;
 	}
@@ -419,7 +417,6 @@ static int nvme_nvm_set_bb_tbl(struct nv
 								int type)
 {
 	struct nvme_ns *ns = nvmdev->q->queuedata;
-	struct nvme_dev *dev = ns->dev;
 	struct nvme_nvm_command c = {};
 	int ret = 0;
 
@@ -429,10 +426,10 @@ static int nvme_nvm_set_bb_tbl(struct nv
 	c.set_bb.nlb = cpu_to_le16(rqd->nr_pages - 1);
 	c.set_bb.value = type;
 
-	ret = nvme_submit_sync_cmd(dev->admin_q, (struct nvme_command *)&c,
+	ret = nvme_submit_sync_cmd(ns->ctrl->admin_q, (struct nvme_command *)&c,
 								NULL, 0);
 	if (ret)
-		dev_err(dev->dev, "set bad block table failed (%d)\n", ret);
+		dev_err(ns->ctrl->dev, "set bad block table failed (%d)\n", ret);
 	return ret;
 }
 
@@ -520,9 +517,8 @@ static int nvme_nvm_erase_block(struct n
 static void *nvme_nvm_create_dma_pool(struct nvm_dev *nvmdev, char *name)
 {
 	struct nvme_ns *ns = nvmdev->q->queuedata;
-	struct nvme_dev *dev = ns->dev;
 
-	return dma_pool_create(name, dev->dev, PAGE_SIZE, PAGE_SIZE, 0);
+	return dma_pool_create(name, ns->ctrl->dev, PAGE_SIZE, PAGE_SIZE, 0);
 }
 
 static void nvme_nvm_destroy_dma_pool(void *pool)
@@ -580,8 +576,9 @@ void nvme_nvm_unregister(struct request_
 
 int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id)
 {
-	struct nvme_dev *dev = ns->dev;
-	struct pci_dev *pdev = to_pci_dev(dev->dev);
+	struct nvme_ctrl *ctrl = ns->ctrl;
+	/* XXX: this is poking into PCI structures from generic code! */
+	struct pci_dev *pdev = to_pci_dev(ctrl->dev);
 
 	/* QEMU NVMe simulator - PCI ID + Vendor specific bit */
 	if (pdev->vendor == PCI_VENDOR_ID_CNEX &&


Patches currently in stable-queue which might be from hch@lst.de are

queue-4.4/0120-block-fix-blk_rq_get_max_sectors-for-driver-private-.patch
queue-4.4/0033-NVMe-fix-build-with-CONFIG_NVM-enabled.patch
queue-4.4/0116-blk-mq-End-unstarted-requests-on-dying-queue.patch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch "[PATCH 033/135] NVMe: fix build with CONFIG_NVM enabled" has been added to the 4.4-stable tree
  2016-09-09 13:37 Patch "[PATCH 033/135] NVMe: fix build with CONFIG_NVM enabled" has been added to the 4.4-stable tree gregkh
@ 2016-09-09 14:00 ` Greg KH
       [not found]   ` <20160910041331.GA3606@sasha-lappy>
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2016-09-09 14:00 UTC (permalink / raw)
  To: hch, alexander.levin, axboe, ww.tao0320; +Cc: stable, stable-commits

Nope, this broke the build :(

Sasha, what happened?  Why is this working for you?

I'm dropping this now...

thanks,

greg k-h


On Fri, Sep 09, 2016 at 03:37:59PM +0200, gregkh@linuxfoundation.org wrote:
> 
> This is a note to let you know that I've just added the patch titled
> 
>     [PATCH 033/135] NVMe: fix build with CONFIG_NVM enabled
> 
> to the 4.4-stable tree which can be found at:
>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> 
> The filename of the patch is:
>      0033-NVMe-fix-build-with-CONFIG_NVM-enabled.patch
> and it can be found in the queue-4.4 subdirectory.
> 
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable@vger.kernel.org> know about it.
> 
> 
> >From 949e31ee7225602105e4129b9a093d3fc546f701 Mon Sep 17 00:00:00 2001
> From: Christoph Hellwig <hch@lst.de>
> Date: Thu, 3 Dec 2015 09:52:05 -0700
> Subject: [PATCH 033/135] NVMe: fix build with CONFIG_NVM enabled
> 
> [ Upstream commit ac02dddec63385ffef1397d3f56cec4108bcafe9 ]
> 
> Looks like I didn't test with CONFIG_NVM enabled, and neither did
> the build bot.
> 
> Most of this is really weird crazy shit in the lighnvm support, though.
> 
> Struct nvme_ns is a structure for the NVM I/O command set, and it has
> no business poking into it.  Second this commit:
> 
> commit 47b3115ae7b799be8b77b0f024215ad4f68d6460
> Author: Wenwei Tao <ww.tao0320@gmail.com>
> Date:   Fri Nov 20 13:47:55 2015 +0100
> 
>     nvme: lightnvm: use admin queues for admin cmds
> 
> Does even more crazy stuff.  If a function gets a request_queue parameter
> passed it'd better use that and not look for another one.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Jens Axboe <axboe@fb.com>
> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/nvme/host/lightnvm.c |   35 ++++++++++++++++-------------------
>  1 file changed, 16 insertions(+), 19 deletions(-)
> 
> --- a/drivers/nvme/host/lightnvm.c
> +++ b/drivers/nvme/host/lightnvm.c
> @@ -274,7 +274,6 @@ static int init_grps(struct nvm_id *nvm_
>  static int nvme_nvm_identity(struct nvm_dev *nvmdev, struct nvm_id *nvm_id)
>  {
>  	struct nvme_ns *ns = nvmdev->q->queuedata;
> -	struct nvme_dev *dev = ns->dev;
>  	struct nvme_nvm_id *nvme_nvm_id;
>  	struct nvme_nvm_command c = {};
>  	int ret;
> @@ -287,7 +286,7 @@ static int nvme_nvm_identity(struct nvm_
>  	if (!nvme_nvm_id)
>  		return -ENOMEM;
>  
> -	ret = nvme_submit_sync_cmd(dev->admin_q, (struct nvme_command *)&c,
> +	ret = nvme_submit_sync_cmd(ns->ctrl->admin_q, (struct nvme_command *)&c,
>  				nvme_nvm_id, sizeof(struct nvme_nvm_id));
>  	if (ret) {
>  		ret = -EIO;
> @@ -312,9 +311,8 @@ static int nvme_nvm_get_l2p_tbl(struct n
>  				nvm_l2p_update_fn *update_l2p, void *priv)
>  {
>  	struct nvme_ns *ns = nvmdev->q->queuedata;
> -	struct nvme_dev *dev = ns->dev;
>  	struct nvme_nvm_command c = {};
> -	u32 len = queue_max_hw_sectors(dev->admin_q) << 9;
> +	u32 len = queue_max_hw_sectors(ns->ctrl->admin_q) << 9;
>  	u32 nlb_pr_rq = len / sizeof(u64);
>  	u64 cmd_slba = slba;
>  	void *entries;
> @@ -332,10 +330,10 @@ static int nvme_nvm_get_l2p_tbl(struct n
>  		c.l2p.slba = cpu_to_le64(cmd_slba);
>  		c.l2p.nlb = cpu_to_le32(cmd_nlb);
>  
> -		ret = nvme_submit_sync_cmd(dev->admin_q,
> +		ret = nvme_submit_sync_cmd(ns->ctrl->admin_q,
>  				(struct nvme_command *)&c, entries, len);
>  		if (ret) {
> -			dev_err(dev->dev, "L2P table transfer failed (%d)\n",
> +			dev_err(ns->ctrl->dev, "L2P table transfer failed (%d)\n",
>  									ret);
>  			ret = -EIO;
>  			goto out;
> @@ -361,7 +359,7 @@ static int nvme_nvm_get_bb_tbl(struct nv
>  {
>  	struct request_queue *q = nvmdev->q;
>  	struct nvme_ns *ns = q->queuedata;
> -	struct nvme_dev *dev = ns->dev;
> +	struct nvme_ctrl *ctrl = ns->ctrl;
>  	struct nvme_nvm_command c = {};
>  	struct nvme_nvm_bb_tbl *bb_tbl;
>  	int tblsz = sizeof(struct nvme_nvm_bb_tbl) + nr_blocks;
> @@ -375,30 +373,30 @@ static int nvme_nvm_get_bb_tbl(struct nv
>  	if (!bb_tbl)
>  		return -ENOMEM;
>  
> -	ret = nvme_submit_sync_cmd(dev->admin_q, (struct nvme_command *)&c,
> +	ret = nvme_submit_sync_cmd(ctrl->admin_q, (struct nvme_command *)&c,
>  								bb_tbl, tblsz);
>  	if (ret) {
> -		dev_err(dev->dev, "get bad block table failed (%d)\n", ret);
> +		dev_err(ctrl->dev, "get bad block table failed (%d)\n", ret);
>  		ret = -EIO;
>  		goto out;
>  	}
>  
>  	if (bb_tbl->tblid[0] != 'B' || bb_tbl->tblid[1] != 'B' ||
>  		bb_tbl->tblid[2] != 'L' || bb_tbl->tblid[3] != 'T') {
> -		dev_err(dev->dev, "bbt format mismatch\n");
> +		dev_err(ctrl->dev, "bbt format mismatch\n");
>  		ret = -EINVAL;
>  		goto out;
>  	}
>  
>  	if (le16_to_cpu(bb_tbl->verid) != 1) {
>  		ret = -EINVAL;
> -		dev_err(dev->dev, "bbt version not supported\n");
> +		dev_err(ctrl->dev, "bbt version not supported\n");
>  		goto out;
>  	}
>  
>  	if (le32_to_cpu(bb_tbl->tblks) != nr_blocks) {
>  		ret = -EINVAL;
> -		dev_err(dev->dev, "bbt unsuspected blocks returned (%u!=%u)",
> +		dev_err(ctrl->dev, "bbt unsuspected blocks returned (%u!=%u)",
>  					le32_to_cpu(bb_tbl->tblks), nr_blocks);
>  		goto out;
>  	}
> @@ -419,7 +417,6 @@ static int nvme_nvm_set_bb_tbl(struct nv
>  								int type)
>  {
>  	struct nvme_ns *ns = nvmdev->q->queuedata;
> -	struct nvme_dev *dev = ns->dev;
>  	struct nvme_nvm_command c = {};
>  	int ret = 0;
>  
> @@ -429,10 +426,10 @@ static int nvme_nvm_set_bb_tbl(struct nv
>  	c.set_bb.nlb = cpu_to_le16(rqd->nr_pages - 1);
>  	c.set_bb.value = type;
>  
> -	ret = nvme_submit_sync_cmd(dev->admin_q, (struct nvme_command *)&c,
> +	ret = nvme_submit_sync_cmd(ns->ctrl->admin_q, (struct nvme_command *)&c,
>  								NULL, 0);
>  	if (ret)
> -		dev_err(dev->dev, "set bad block table failed (%d)\n", ret);
> +		dev_err(ns->ctrl->dev, "set bad block table failed (%d)\n", ret);
>  	return ret;
>  }
>  
> @@ -520,9 +517,8 @@ static int nvme_nvm_erase_block(struct n
>  static void *nvme_nvm_create_dma_pool(struct nvm_dev *nvmdev, char *name)
>  {
>  	struct nvme_ns *ns = nvmdev->q->queuedata;
> -	struct nvme_dev *dev = ns->dev;
>  
> -	return dma_pool_create(name, dev->dev, PAGE_SIZE, PAGE_SIZE, 0);
> +	return dma_pool_create(name, ns->ctrl->dev, PAGE_SIZE, PAGE_SIZE, 0);
>  }
>  
>  static void nvme_nvm_destroy_dma_pool(void *pool)
> @@ -580,8 +576,9 @@ void nvme_nvm_unregister(struct request_
>  
>  int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id)
>  {
> -	struct nvme_dev *dev = ns->dev;
> -	struct pci_dev *pdev = to_pci_dev(dev->dev);
> +	struct nvme_ctrl *ctrl = ns->ctrl;
> +	/* XXX: this is poking into PCI structures from generic code! */
> +	struct pci_dev *pdev = to_pci_dev(ctrl->dev);
>  
>  	/* QEMU NVMe simulator - PCI ID + Vendor specific bit */
>  	if (pdev->vendor == PCI_VENDOR_ID_CNEX &&
> 
> 
> Patches currently in stable-queue which might be from hch@lst.de are
> 
> queue-4.4/0120-block-fix-blk_rq_get_max_sectors-for-driver-private-.patch
> queue-4.4/0033-NVMe-fix-build-with-CONFIG_NVM-enabled.patch
> queue-4.4/0116-blk-mq-End-unstarted-requests-on-dying-queue.patch
> --
> To unsubscribe from this list: send the line "unsubscribe stable" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch "[PATCH 033/135] NVMe: fix build with CONFIG_NVM enabled" has been added to the 4.4-stable tree
       [not found]   ` <20160910041331.GA3606@sasha-lappy>
@ 2016-09-10  7:32     ` Greg KH
       [not found]       ` <20160910143031.GC3606@sasha-lappy>
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2016-09-10  7:32 UTC (permalink / raw)
  To: Levin, Alexander; +Cc: hch, axboe, ww.tao0320, stable, stable-commits

On Sat, Sep 10, 2016 at 12:13:31AM -0400, Levin, Alexander wrote:
> On Fri, Sep 09, 2016 at 04:00:01PM +0200, Greg KH wrote:
> > Nope, this broke the build :(
> > 
> > Sasha, what happened?  Why is this working for you?
> 
> Hm, what build errors are you seeing? And what's your config?

It was in a nvme driver, and the .config file I use can be found here:
	https://github.com/gregkh/gregkh-linux/blob/master/stable/configs/4.4.y

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch "[PATCH 033/135] NVMe: fix build with CONFIG_NVM enabled" has been added to the 4.4-stable tree
       [not found]       ` <20160910143031.GC3606@sasha-lappy>
@ 2016-09-10 15:15         ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2016-09-10 15:15 UTC (permalink / raw)
  To: Levin, Alexander; +Cc: hch, axboe, ww.tao0320, stable, stable-commits

On Sat, Sep 10, 2016 at 10:30:31AM -0400, Levin, Alexander wrote:
> On Sat, Sep 10, 2016 at 03:32:30AM -0400, Greg KH wrote:
> > Sep 10, 2016 at 12:13:31AM -0400, Levin, Alexander wrote:
> > > On Fri, Sep 09, 2016 at 04:00:01PM +0200, Greg KH wrote:
> > > > Nope, this broke the build :(
> > > > 
> > > > Sasha, what happened?  Why is this working for you?
> > > 
> > > Hm, what build errors are you seeing? And what's your config?
> > 
> > It was in a nvme driver, and the .config file I use can be found here:
> > 	https://github.com/gregkh/gregkh-linux/blob/master/stable/configs/4.4.y
> 
> Yeah, it was the two extra commits in the branch you pulled that weren't in the mail series I've sent.

Ah, in the middle, messy :)

> If there's a problem with mail filters I can just do git pulls from now on.

That might be easier, for large numbers of patches like this.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-09-10 15:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-09 13:37 Patch "[PATCH 033/135] NVMe: fix build with CONFIG_NVM enabled" has been added to the 4.4-stable tree gregkh
2016-09-09 14:00 ` Greg KH
     [not found]   ` <20160910041331.GA3606@sasha-lappy>
2016-09-10  7:32     ` Greg KH
     [not found]       ` <20160910143031.GC3606@sasha-lappy>
2016-09-10 15:15         ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.