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


Groups > linux.kernel > #1650318 > unrolled thread

Re: [PATCH V2 1/1] nvme: fix multiple ctrl removal scheduling

Started byChristoph Hellwig <hch@lst.de>
First post2017-05-25 10:40 +0200
Last post2017-05-26 22:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH V2 1/1] nvme: fix multiple ctrl removal scheduling Christoph Hellwig <hch@lst.de> - 2017-05-25 10:40 +0200
    Re: [PATCH V2 1/1] nvme: fix multiple ctrl removal scheduling Rakesh Pandit <rakesh@tuxera.com> - 2017-05-26 22:20 +0200

#1650318 — Re: [PATCH V2 1/1] nvme: fix multiple ctrl removal scheduling

FromChristoph Hellwig <hch@lst.de>
Date2017-05-25 10:40 +0200
SubjectRe: [PATCH V2 1/1] nvme: fix multiple ctrl removal scheduling
Message-ID<tKWtk-5Qx-27@gated-at.bofh.it>
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 4c2ff2b..ba54e2a 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -1903,9 +1903,6 @@ static void nvme_reset_work(struct work_struct *work)
>  	bool was_suspend = !!(dev->ctrl.ctrl_config & NVME_CC_SHN_NORMAL);
>  	int result = -ENODEV;
>  
> -	if (WARN_ON(dev->ctrl.state == NVME_CTRL_RESETTING))
> -		goto out;

Can we keep a

	WARN_ON(dev->ctrl.state != NVME_CTRL_RESETTING))

here?

>  		goto out;
> @@ -2009,8 +2003,8 @@ static int nvme_reset(struct nvme_dev *dev)
>  {
>  	if (!dev->ctrl.admin_q || blk_queue_dying(dev->ctrl.admin_q))
>  		return -ENODEV;
> -	if (work_busy(&dev->reset_work))
> -		return -ENODEV;
> +	if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING))
> +		return -EBUSY;
>  	if (!queue_work(nvme_workq, &dev->reset_work))
>  		return -EBUSY;

nvme_probe will also have to set the state to NVME_CTRL_RESETTING to
keep the old behavior, which had some error handling implications.

Also we can replace the work_busy(&dev->reset_work) check in
nvme_should_reset with a check for the NVME_CTRL_RESETTING state now.

[toc] | [next] | [standalone]


#1651602

FromRakesh Pandit <rakesh@tuxera.com>
Date2017-05-26 22:20 +0200
Message-ID<tLtSi-1ZN-3@gated-at.bofh.it>
In reply to#1650318
On Thu, May 25, 2017 at 10:30:23AM +0200, Christoph Hellwig wrote:
> > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> > index 4c2ff2b..ba54e2a 100644
> > --- a/drivers/nvme/host/pci.c
> > +++ b/drivers/nvme/host/pci.c
> > @@ -1903,9 +1903,6 @@ static void nvme_reset_work(struct work_struct *work)
> >  	bool was_suspend = !!(dev->ctrl.ctrl_config & NVME_CC_SHN_NORMAL);
> >  	int result = -ENODEV;
> >  
> > -	if (WARN_ON(dev->ctrl.state == NVME_CTRL_RESETTING))
> > -		goto out;
> 
> Can we keep a
> 
> 	WARN_ON(dev->ctrl.state != NVME_CTRL_RESETTING))
> 
> here?

Yes. Will do in V3.

Taking it consideration Keith's suggestion of using new state makes
things better so V3 wouldn't touch RESETTING state.

> 
> >  		goto out;
> > @@ -2009,8 +2003,8 @@ static int nvme_reset(struct nvme_dev *dev)
> >  {
> >  	if (!dev->ctrl.admin_q || blk_queue_dying(dev->ctrl.admin_q))
> >  		return -ENODEV;
> > -	if (work_busy(&dev->reset_work))
> > -		return -ENODEV;
> > +	if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING))
> > +		return -EBUSY;
> >  	if (!queue_work(nvme_workq, &dev->reset_work))
> >  		return -EBUSY;
> 
> nvme_probe will also have to set the state to NVME_CTRL_RESETTING to
> keep the old behavior, which had some error handling implications.
>

Will keep.

> Also we can replace the work_busy(&dev->reset_work) check in
> nvme_should_reset with a check for the NVME_CTRL_RESETTING state now.

Not replacing it seems better as nvme_reset is always called if
nvme_should_reset returns true and takes care of synchrozation.
Replacing it wouldn't make it possible to use same logic in nvme_reset
as nvme_reset would always be called after.

Thanks,

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web