* [PATCHv2] NVMe: Disable admin queue on init failure @ 2013-11-15 17:47 Keith Busch 2013-12-16 17:54 ` Matthew Wilcox 0 siblings, 1 reply; 3+ messages in thread From: Keith Busch @ 2013-11-15 17:47 UTC (permalink / raw) Disable the admin queue if device fails during initialization so the queue's irq is freed. Signed-off-by: Keith Busch <keith.busch at intel.com> --- v1->v2: Moved the responsibilty of handling the admin queue to the funtion that set it up. This fixes the case where the controller is responsive but unable to handle io, so the cdev is still usable. Fixed my typo in commit message from the sad rush to post the patch yesterday. drivers/block/nvme-core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index da52092..145d621 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c @@ -1864,7 +1864,11 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) return 0; free_queues: - nvme_free_queues(dev); + for (i = dev->queue_count - 1; i > 0; i--) { + nvme_free_queue(dev->queues[i]); + dev->queue_count--; + dev->queues[i] = NULL; + } return result; } @@ -2141,6 +2145,7 @@ static int nvme_dev_start(struct nvme_dev *dev) return result; disable: + nvme_disable_queue(dev, 0); spin_lock(&dev_list_lock); list_del_init(&dev->node); spin_unlock(&dev_list_lock); -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCHv2] NVMe: Disable admin queue on init failure 2013-11-15 17:47 [PATCHv2] NVMe: Disable admin queue on init failure Keith Busch @ 2013-12-16 17:54 ` Matthew Wilcox 2013-12-16 18:43 ` Keith Busch 0 siblings, 1 reply; 3+ messages in thread From: Matthew Wilcox @ 2013-12-16 17:54 UTC (permalink / raw) On Fri, Nov 15, 2013@10:47:10AM -0700, Keith Busch wrote: > Disable the admin queue if device fails during initialization so the > queue's irq is freed. > > Signed-off-by: Keith Busch <keith.busch at intel.com> > --- > v1->v2: > Moved the responsibilty of handling the admin queue to the funtion that > set it up. This fixes the case where the controller is responsive but > unable to handle io, so the cdev is still usable. > > Fixed my typo in commit message from the sad rush to post the patch > yesterday. > > drivers/block/nvme-core.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c > index da52092..145d621 100644 > --- a/drivers/block/nvme-core.c > +++ b/drivers/block/nvme-core.c > @@ -1864,7 +1864,11 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) > return 0; > > free_queues: > - nvme_free_queues(dev); > + for (i = dev->queue_count - 1; i > 0; i--) { > + nvme_free_queue(dev->queues[i]); > + dev->queue_count--; > + dev->queues[i] = NULL; > + } I don't really like duplicating the guts of nvme_free_queues here. How about this? diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index ca0222d..3f5d67a 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c @@ -1151,11 +1151,11 @@ static void nvme_free_queue(struct nvme_queue *nvmeq) kfree(nvmeq); } -static void nvme_free_queues(struct nvme_dev *dev) +static void nvme_free_queues(struct nvme_dev *dev, int lowest) { int i; - for (i = dev->queue_count - 1; i >= 0; i--) { + for (i = dev->queue_count - 1; i >= lowest; i--) { nvme_free_queue(dev->queues[i]); dev->queue_count--; dev->queues[i] = NULL; @@ -1985,7 +1985,7 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) return 0; free_queues: - nvme_free_queues(dev); + nvme_free_queues(dev, 1); return result; } @@ -2405,6 +2405,7 @@ static int nvme_dev_start(struct nvme_dev *dev) return result; disable: + nvme_disable_queue(dev, 0); spin_lock(&dev_list_lock); list_del_init(&dev->node); spin_unlock(&dev_list_lock); @@ -2536,7 +2537,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) shutdown: nvme_dev_shutdown(dev); release_pools: - nvme_free_queues(dev); + nvme_free_queues(dev, 0); nvme_release_prp_pools(dev); release: nvme_release_instance(dev); @@ -2560,7 +2561,7 @@ static void nvme_remove(struct pci_dev *pdev) misc_deregister(&dev->miscdev); nvme_dev_remove(dev); nvme_dev_shutdown(dev); - nvme_free_queues(dev); + nvme_free_queues(dev, 0); nvme_release_instance(dev); nvme_release_prp_pools(dev); kref_put(&dev->kref, nvme_free_dev); ^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCHv2] NVMe: Disable admin queue on init failure 2013-12-16 17:54 ` Matthew Wilcox @ 2013-12-16 18:43 ` Keith Busch 0 siblings, 0 replies; 3+ messages in thread From: Keith Busch @ 2013-12-16 18:43 UTC (permalink / raw) On Mon, 16 Dec 2013, Matthew Wilcox wrote: > On Fri, Nov 15, 2013@10:47:10AM -0700, Keith Busch wrote: >> Disable the admin queue if device fails during initialization so the >> queue's irq is freed. >> >> Signed-off-by: Keith Busch <keith.busch at intel.com> >> --- >> v1->v2: >> Moved the responsibilty of handling the admin queue to the funtion that >> set it up. This fixes the case where the controller is responsive but >> unable to handle io, so the cdev is still usable. >> >> Fixed my typo in commit message from the sad rush to post the patch >> yesterday. >> >> drivers/block/nvme-core.c | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c >> index da52092..145d621 100644 >> --- a/drivers/block/nvme-core.c >> +++ b/drivers/block/nvme-core.c >> @@ -1864,7 +1864,11 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) >> return 0; >> >> free_queues: >> - nvme_free_queues(dev); >> + for (i = dev->queue_count - 1; i > 0; i--) { >> + nvme_free_queue(dev->queues[i]); >> + dev->queue_count--; >> + dev->queues[i] = NULL; >> + } > > I don't really like duplicating the guts of nvme_free_queues here. > How about this? Lovely, I like that much better too. Thanks! > diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c > index ca0222d..3f5d67a 100644 > --- a/drivers/block/nvme-core.c > +++ b/drivers/block/nvme-core.c > @@ -1151,11 +1151,11 @@ static void nvme_free_queue(struct nvme_queue *nvmeq) > kfree(nvmeq); > } > > -static void nvme_free_queues(struct nvme_dev *dev) > +static void nvme_free_queues(struct nvme_dev *dev, int lowest) > { > int i; > > - for (i = dev->queue_count - 1; i >= 0; i--) { > + for (i = dev->queue_count - 1; i >= lowest; i--) { > nvme_free_queue(dev->queues[i]); > dev->queue_count--; > dev->queues[i] = NULL; > @@ -1985,7 +1985,7 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) > return 0; > > free_queues: > - nvme_free_queues(dev); > + nvme_free_queues(dev, 1); > return result; > } > > @@ -2405,6 +2405,7 @@ static int nvme_dev_start(struct nvme_dev *dev) > return result; > > disable: > + nvme_disable_queue(dev, 0); > spin_lock(&dev_list_lock); > list_del_init(&dev->node); > spin_unlock(&dev_list_lock); > @@ -2536,7 +2537,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) > shutdown: > nvme_dev_shutdown(dev); > release_pools: > - nvme_free_queues(dev); > + nvme_free_queues(dev, 0); > nvme_release_prp_pools(dev); > release: > nvme_release_instance(dev); > @@ -2560,7 +2561,7 @@ static void nvme_remove(struct pci_dev *pdev) > misc_deregister(&dev->miscdev); > nvme_dev_remove(dev); > nvme_dev_shutdown(dev); > - nvme_free_queues(dev); > + nvme_free_queues(dev, 0); > nvme_release_instance(dev); > nvme_release_prp_pools(dev); > kref_put(&dev->kref, nvme_free_dev); > ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-16 18:43 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-11-15 17:47 [PATCHv2] NVMe: Disable admin queue on init failure Keith Busch 2013-12-16 17:54 ` Matthew Wilcox 2013-12-16 18:43 ` Keith Busch
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.