* [PATCH V2] nvme-pci: set cq_vector to -1 if io queue setup fails
@ 2018-02-15 11:13 Jianchao Wang
2018-02-24 9:04 ` jianchao.wang
2018-02-26 15:58 ` Keith Busch
0 siblings, 2 replies; 3+ messages in thread
From: Jianchao Wang @ 2018-02-15 11:13 UTC (permalink / raw)
To: keith.busch, axboe, hch, sagi; +Cc: linux-nvme, linux-kernel
nvme cq irq is freed based on queue_count. When the sq/cq creation
fails, irq will not be setup. free_irq will warn 'Try to free
already-free irq'.
To fix it, set the nvmeq->cq_vector to -1, then nvme_suspend_queue
will ignore it.
Change log:
V1 -> V2
- Follow Keith's suggestion, just set cq_vector to -1 if io queue setup
fails.
- Change patch name and comment
Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
---
drivers/nvme/host/pci.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 4a7c420..f4528ef 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1452,7 +1452,7 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid)
nvmeq->cq_vector = qid - 1;
result = adapter_alloc_cq(dev, qid, nvmeq);
if (result < 0)
- return result;
+ goto clean_cq_vector;
result = adapter_alloc_sq(dev, qid, nvmeq);
if (result < 0)
@@ -1461,14 +1461,17 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid)
nvme_init_queue(nvmeq, qid);
result = queue_request_irq(nvmeq);
if (result < 0)
- goto release_sq;
+ goto offline;
return result;
- release_sq:
+offline:
+ dev->online_queues--;
adapter_delete_sq(dev, qid);
- release_cq:
+release_cq:
adapter_delete_cq(dev, qid);
+clean_cq_vector:
+ nvmeq->cq_vector = -1;
return result;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2] nvme-pci: set cq_vector to -1 if io queue setup fails
2018-02-15 11:13 [PATCH V2] nvme-pci: set cq_vector to -1 if io queue setup fails Jianchao Wang
@ 2018-02-24 9:04 ` jianchao.wang
2018-02-26 15:58 ` Keith Busch
1 sibling, 0 replies; 3+ messages in thread
From: jianchao.wang @ 2018-02-24 9:04 UTC (permalink / raw)
To: keith.busch, axboe, hch, sagi; +Cc: linux-nvme, linux-kernel
Hi Keith
Can you take a review on this ?
Thanks in advance
Really appreciate
Jianchao
On 02/15/2018 07:13 PM, Jianchao Wang wrote:
> nvme cq irq is freed based on queue_count. When the sq/cq creation
> fails, irq will not be setup. free_irq will warn 'Try to free
> already-free irq'.
>
> To fix it, set the nvmeq->cq_vector to -1, then nvme_suspend_queue
> will ignore it.
>
> Change log:
> V1 -> V2
> - Follow Keith's suggestion, just set cq_vector to -1 if io queue setup
> fails.
> - Change patch name and comment
>
> Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
> ---
> drivers/nvme/host/pci.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 4a7c420..f4528ef 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -1452,7 +1452,7 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid)
> nvmeq->cq_vector = qid - 1;
> result = adapter_alloc_cq(dev, qid, nvmeq);
> if (result < 0)
> - return result;
> + goto clean_cq_vector;
>
> result = adapter_alloc_sq(dev, qid, nvmeq);
> if (result < 0)
> @@ -1461,14 +1461,17 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid)
> nvme_init_queue(nvmeq, qid);
> result = queue_request_irq(nvmeq);
> if (result < 0)
> - goto release_sq;
> + goto offline;
>
> return result;
>
> - release_sq:
> +offline:
> + dev->online_queues--;
> adapter_delete_sq(dev, qid);
> - release_cq:
> +release_cq:
> adapter_delete_cq(dev, qid);
> +clean_cq_vector:
> + nvmeq->cq_vector = -1;
> return result;
> }
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH V2] nvme-pci: set cq_vector to -1 if io queue setup fails
2018-02-15 11:13 [PATCH V2] nvme-pci: set cq_vector to -1 if io queue setup fails Jianchao Wang
2018-02-24 9:04 ` jianchao.wang
@ 2018-02-26 15:58 ` Keith Busch
1 sibling, 0 replies; 3+ messages in thread
From: Keith Busch @ 2018-02-26 15:58 UTC (permalink / raw)
To: Jianchao Wang; +Cc: axboe, hch, sagi, linux-nvme, linux-kernel
On Thu, Feb 15, 2018 at 07:13:41PM +0800, Jianchao Wang wrote:
> nvme cq irq is freed based on queue_count. When the sq/cq creation
> fails, irq will not be setup. free_irq will warn 'Try to free
> already-free irq'.
>
> To fix it, set the nvmeq->cq_vector to -1, then nvme_suspend_queue
> will ignore it.
Applied with updates to change log and removing the miscellaneous white
space changes.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-02-26 15:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-15 11:13 [PATCH V2] nvme-pci: set cq_vector to -1 if io queue setup fails Jianchao Wang
2018-02-24 9:04 ` jianchao.wang
2018-02-26 15:58 ` Keith Busch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).