Re: [PATCH] nvme-core: Fix subsystem instance mismatches

2019-09-04 Thread Logan Gunthorpe
On 2019-09-04 11:14 a.m., Keith Busch wrote: > On Wed, Sep 04, 2019 at 11:01:22AM -0600, Logan Gunthorpe wrote: >> Oh, yes that's simpler than the struct/kref method and looks like it >> will accomplish the same thing. I did some brief testing with it and it >> seems to work for me (though I don

Re: [PATCH] nvme-core: Fix subsystem instance mismatches

2019-09-04 Thread Keith Busch
On Wed, Sep 04, 2019 at 11:01:22AM -0600, Logan Gunthorpe wrote: > Oh, yes that's simpler than the struct/kref method and looks like it > will accomplish the same thing. I did some brief testing with it and it > seems to work for me (though I don't have any subsystems with multiple > controllers).

Re: [PATCH] nvme-core: Fix subsystem instance mismatches

2019-09-04 Thread Logan Gunthorpe
On 2019-09-04 10:35 a.m., Keith Busch wrote: > On Wed, Sep 04, 2019 at 10:07:12AM -0600, Logan Gunthorpe wrote: >> Yes, I agree, we can't solve the mismatch problem in the general case: >> with sequences of hot plug events there will always be a case that >> mismatches. I just think we can do be

Re: [PATCH] nvme-core: Fix subsystem instance mismatches

2019-09-04 Thread Keith Busch
On Wed, Sep 04, 2019 at 10:07:12AM -0600, Logan Gunthorpe wrote: > Yes, I agree, we can't solve the mismatch problem in the general case: > with sequences of hot plug events there will always be a case that > mismatches. I just think we can do better in the simple common default case. This may be

Re: [PATCH] nvme-core: Fix subsystem instance mismatches

2019-09-04 Thread Logan Gunthorpe
On 2019-09-04 9:54 a.m., Keith Busch wrote: > On Wed, Sep 04, 2019 at 05:42:15PM +0200, Christoph Hellwig wrote: >> On Wed, Sep 04, 2019 at 08:44:27AM -0600, Keith Busch wrote: >>> Let me step through an example: >>> >>> Ctrl A gets instance 0. >>> >>> Its subsystem gets the same instance, a

Re: [PATCH] nvme-core: Fix subsystem instance mismatches

2019-09-04 Thread Christoph Hellwig
On Wed, Sep 04, 2019 at 09:54:45AM -0600, Keith Busch wrote: > Can we just ensure there is never a matching controller then? This > patch will accomplish that and simpler than wrapping the instance in a > refcount'ed object: > > http://lists.infradead.org/pipermail/linux-nvme/2019-May/024142.html

Re: [PATCH] nvme-core: Fix subsystem instance mismatches

2019-09-04 Thread Keith Busch
On Wed, Sep 04, 2019 at 05:42:15PM +0200, Christoph Hellwig wrote: > On Wed, Sep 04, 2019 at 08:44:27AM -0600, Keith Busch wrote: > > Let me step through an example: > > > > Ctrl A gets instance 0. > > > > Its subsystem gets the same instance, and takes ref count on it: > > all namespaces i

Re: [PATCH] nvme-core: Fix subsystem instance mismatches

2019-09-04 Thread Christoph Hellwig
On Wed, Sep 04, 2019 at 08:44:27AM -0600, Keith Busch wrote: > Let me step through an example: > > Ctrl A gets instance 0. > > Its subsystem gets the same instance, and takes ref count on it: > all namespaces in this subsystem will use '0'. > > Ctrl B gets instance 1, and it's in the sam

Re: [PATCH] nvme-core: Fix subsystem instance mismatches

2019-09-04 Thread Keith Busch
On Wed, Sep 04, 2019 at 08:05:58AM +0200, Christoph Hellwig wrote: > On Tue, Sep 03, 2019 at 10:46:20AM -0600, Keith Busch wrote: > > Could we possibly make /dev/nvmeX be a subsystem handle without causing > > trouble for anyone? This would essentially be the same thing as today > > for non-CMIC co

Re: [PATCH] nvme-core: Fix subsystem instance mismatches

2019-09-03 Thread Christoph Hellwig
On Tue, Sep 03, 2019 at 10:46:20AM -0600, Keith Busch wrote: > Could we possibly make /dev/nvmeX be a subsystem handle without causing > trouble for anyone? This would essentially be the same thing as today > for non-CMIC controllers with a device-per-controller and only affects > the CMIC ones. A

Re: [PATCH] nvme-core: Fix subsystem instance mismatches

2019-09-03 Thread Logan Gunthorpe
On 2019-09-03 10:46 a.m., Keith Busch wrote: > On Tue, Sep 03, 2019 at 10:08:01AM -0600, Logan Gunthorpe wrote: >> On 2019-08-31 9:29 a.m., Keith Busch wrote: >>> On Fri, Aug 30, 2019 at 06:01:39PM -0600, Logan Gunthorpe wrote: To fix this, assign the subsystem's instance based on the insta

Re: [PATCH] nvme-core: Fix subsystem instance mismatches

2019-09-03 Thread Keith Busch
On Tue, Sep 03, 2019 at 10:08:01AM -0600, Logan Gunthorpe wrote: > On 2019-08-31 9:29 a.m., Keith Busch wrote: > > On Fri, Aug 30, 2019 at 06:01:39PM -0600, Logan Gunthorpe wrote: > >> To fix this, assign the subsystem's instance based on the instance > >> number of the controller's instance that f

Re: [PATCH] nvme-core: Fix subsystem instance mismatches

2019-09-03 Thread Logan Gunthorpe
On 2019-08-31 9:29 a.m., Keith Busch wrote: > On Fri, Aug 30, 2019 at 06:01:39PM -0600, Logan Gunthorpe wrote: >> To fix this, assign the subsystem's instance based on the instance >> number of the controller's instance that first created it. There should >> always be fewer subsystems than contr

Re: [PATCH] nvme-core: Fix subsystem instance mismatches

2019-08-31 Thread Keith Busch
On Fri, Aug 30, 2019 at 06:01:39PM -0600, Logan Gunthorpe wrote: > To fix this, assign the subsystem's instance based on the instance > number of the controller's instance that first created it. There should > always be fewer subsystems than controllers so the should not be a need > to create extra

[PATCH] nvme-core: Fix subsystem instance mismatches

2019-08-30 Thread Logan Gunthorpe
With multipath enabled (which is now default in many distros), nvme controllers and their respective namespaces can be numbered differently. For example: nvme0n1 might actually belong to controller nvme1, which is super confusing (and may have broken any scripts that rely on the numbering relation)