Re: [dm-devel] multipath-tools: add ANA support for NVMe device
On Wed, Nov 14 2018 at 1:51pm -0500, Hannes Reinecke wrote: > On 11/14/18 6:47 PM, Mike Snitzer wrote: > > On Wed, Nov 14 2018 at 2:49am -0500, > > Hannes Reinecke wrote: > > > >> On 11/14/18 6:38 AM, Mike Snitzer wrote: > >>> On Tue, Nov 13 2018 at 1:00pm -0500, > >>> Mike Snitzer wrote: > >>> > [1]: > http://lists.infradead.org/pipermail/linux-nvme/2018-November/020765.html > [2]: https://www.redhat.com/archives/dm-devel/2018-November/msg00072.html > >>> ... > >>> > >>> I knew there had to be a pretty tight coupling between the NVMe driver's > >>> native multipathing and ANA support... and that the simplicity of > >>> Hannes' patch [1] was too good to be true. > >>> > >>> The real justification for not making Hannes' change is it'd effectively > >>> be useless without first splitting out the ANA handling done during NVMe > >>> request completion (NVME_SC_ANA_* cases in nvme_failover_req) that > >>> triggers re-reading the ANA log page accordingly. > >>> > >>> So without the ability to drive the ANA workqueue to trigger > >>> nvme_read_ana_log() from the nvme driver's completion path -- even if > >>> nvme_core.multipath=N -- it really doesn't buy multipath-tools anything > >>> to have the NVMe driver export the ana state via sysfs, because that ANA > >>> state will never get updated. > >>> > >> Hmm. Indeed, I was more focussed on having the sysfs attributes > >> displayed, so yes, indeed it needs some more work. > > ... > >>> Not holding my breath BUT: > >>> if decoupling the reading of ANA state from native NVMe multipathing > >>> specific work during nvme request completion were an acceptable > >>> advancement I'd gladly do the work. > >>> > >> I'd be happy to work on that, given that we'll have to have 'real' > >> ANA support for device-mapper anyway for SLE12 SP4 etc. > > > > I had a close enough look yesterday that I figured I'd just implement > > what I reasoned through as one way forward, compile tested only (patch > > relative to Jens' for-4.21/block): > > > > drivers/nvme/host/core.c | 14 +++--- > > drivers/nvme/host/multipath.c | 65 > > ++- > > drivers/nvme/host/nvme.h | 4 +++ > > 3 files changed, 54 insertions(+), 29 deletions(-) > > > > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c > > index f172d63db2b5..05313ab5d91e 100644 > > --- a/drivers/nvme/host/core.c > > +++ b/drivers/nvme/host/core.c > > @@ -252,10 +252,16 @@ void nvme_complete_rq(struct request *req) > > trace_nvme_complete_rq(req); > > > > if (unlikely(status != BLK_STS_OK && nvme_req_needs_retry(req))) { > > - if ((req->cmd_flags & REQ_NVME_MPATH) && > > - blk_path_error(status)) { > > - nvme_failover_req(req); > > - return; > > + if (blk_path_error(status)) { > > + struct nvme_ns *ns = req->q->queuedata; > > + u16 nvme_status = nvme_req(req)->status; > > + > > + if (req->cmd_flags & REQ_NVME_MPATH) { > > + nvme_failover_req(req); > > + nvme_update_ana(ns, nvme_status); > > + return; > > + } > > + nvme_update_ana(ns, nvme_status); > > } > > > > if (!blk_queue_dying(req->q)) { > > diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c > > index 5e3cc8c59a39..f7fbc161dc8c 100644 > > --- a/drivers/nvme/host/multipath.c > > +++ b/drivers/nvme/host/multipath.c > > @@ -22,7 +22,7 @@ MODULE_PARM_DESC(multipath, > > > > inline bool nvme_ctrl_use_ana(struct nvme_ctrl *ctrl) > > { > > - return multipath && ctrl->subsys && (ctrl->subsys->cmic & (1 << 3)); > > + return ctrl->subsys && (ctrl->subsys->cmic & (1 << 3)); > > } > > > > /* > > @@ -47,6 +47,17 @@ void nvme_set_disk_name(char *disk_name, struct nvme_ns > > *ns, > > } > > } > > > > +static bool nvme_ana_error(u16 status) > > +{ > > + switch (status & 0x7ff) { > > + case NVME_SC_ANA_TRANSITION: > > + case NVME_SC_ANA_INACCESSIBLE: > > + case NVME_SC_ANA_PERSISTENT_LOSS: > > + return true; > > + } > > + return false; > > +} > > + > > void nvme_failover_req(struct request *req) > > { > > struct nvme_ns *ns = req->q->queuedata; > > @@ -58,10 +69,7 @@ void nvme_failover_req(struct request *req) > > spin_unlock_irqrestore(>head->requeue_lock, flags); > > blk_mq_end_request(req, 0); > > > > - switch (status & 0x7ff) { > > - case NVME_SC_ANA_TRANSITION: > > - case NVME_SC_ANA_INACCESSIBLE: > > - case NVME_SC_ANA_PERSISTENT_LOSS: > > + if (nvme_ana_error(status)) { > > /* > > * If we got back an ANA error we know the controller is alive, > > * but not ready to serve this namespaces. The spec suggests > > @@ -69,31 +77,38 @@ void nvme_failover_req(struct request *req) > > * that the
Re: [dm-devel] multipath-tools: add ANA support for NVMe device
On 11/14/18 6:47 PM, Mike Snitzer wrote: > On Wed, Nov 14 2018 at 2:49am -0500, > Hannes Reinecke wrote: > >> On 11/14/18 6:38 AM, Mike Snitzer wrote: >>> On Tue, Nov 13 2018 at 1:00pm -0500, >>> Mike Snitzer wrote: >>> [1]: http://lists.infradead.org/pipermail/linux-nvme/2018-November/020765.html [2]: https://www.redhat.com/archives/dm-devel/2018-November/msg00072.html >>> ... >>> >>> I knew there had to be a pretty tight coupling between the NVMe driver's >>> native multipathing and ANA support... and that the simplicity of >>> Hannes' patch [1] was too good to be true. >>> >>> The real justification for not making Hannes' change is it'd effectively >>> be useless without first splitting out the ANA handling done during NVMe >>> request completion (NVME_SC_ANA_* cases in nvme_failover_req) that >>> triggers re-reading the ANA log page accordingly. >>> >>> So without the ability to drive the ANA workqueue to trigger >>> nvme_read_ana_log() from the nvme driver's completion path -- even if >>> nvme_core.multipath=N -- it really doesn't buy multipath-tools anything >>> to have the NVMe driver export the ana state via sysfs, because that ANA >>> state will never get updated. >>> >> Hmm. Indeed, I was more focussed on having the sysfs attributes >> displayed, so yes, indeed it needs some more work. > ... >>> Not holding my breath BUT: >>> if decoupling the reading of ANA state from native NVMe multipathing >>> specific work during nvme request completion were an acceptable >>> advancement I'd gladly do the work. >>> >> I'd be happy to work on that, given that we'll have to have 'real' >> ANA support for device-mapper anyway for SLE12 SP4 etc. > > I had a close enough look yesterday that I figured I'd just implement > what I reasoned through as one way forward, compile tested only (patch > relative to Jens' for-4.21/block): > > drivers/nvme/host/core.c | 14 +++--- > drivers/nvme/host/multipath.c | 65 > ++- > drivers/nvme/host/nvme.h | 4 +++ > 3 files changed, 54 insertions(+), 29 deletions(-) > > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c > index f172d63db2b5..05313ab5d91e 100644 > --- a/drivers/nvme/host/core.c > +++ b/drivers/nvme/host/core.c > @@ -252,10 +252,16 @@ void nvme_complete_rq(struct request *req) > trace_nvme_complete_rq(req); > > if (unlikely(status != BLK_STS_OK && nvme_req_needs_retry(req))) { > - if ((req->cmd_flags & REQ_NVME_MPATH) && > - blk_path_error(status)) { > - nvme_failover_req(req); > - return; > + if (blk_path_error(status)) { > + struct nvme_ns *ns = req->q->queuedata; > + u16 nvme_status = nvme_req(req)->status; > + > + if (req->cmd_flags & REQ_NVME_MPATH) { > + nvme_failover_req(req); > + nvme_update_ana(ns, nvme_status); > + return; > + } > + nvme_update_ana(ns, nvme_status); > } > > if (!blk_queue_dying(req->q)) { > diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c > index 5e3cc8c59a39..f7fbc161dc8c 100644 > --- a/drivers/nvme/host/multipath.c > +++ b/drivers/nvme/host/multipath.c > @@ -22,7 +22,7 @@ MODULE_PARM_DESC(multipath, > > inline bool nvme_ctrl_use_ana(struct nvme_ctrl *ctrl) > { > - return multipath && ctrl->subsys && (ctrl->subsys->cmic & (1 << 3)); > + return ctrl->subsys && (ctrl->subsys->cmic & (1 << 3)); > } > > /* > @@ -47,6 +47,17 @@ void nvme_set_disk_name(char *disk_name, struct nvme_ns > *ns, > } > } > > +static bool nvme_ana_error(u16 status) > +{ > + switch (status & 0x7ff) { > + case NVME_SC_ANA_TRANSITION: > + case NVME_SC_ANA_INACCESSIBLE: > + case NVME_SC_ANA_PERSISTENT_LOSS: > + return true; > + } > + return false; > +} > + > void nvme_failover_req(struct request *req) > { > struct nvme_ns *ns = req->q->queuedata; > @@ -58,10 +69,7 @@ void nvme_failover_req(struct request *req) > spin_unlock_irqrestore(>head->requeue_lock, flags); > blk_mq_end_request(req, 0); > > - switch (status & 0x7ff) { > - case NVME_SC_ANA_TRANSITION: > - case NVME_SC_ANA_INACCESSIBLE: > - case NVME_SC_ANA_PERSISTENT_LOSS: > + if (nvme_ana_error(status)) { > /* >* If we got back an ANA error we know the controller is alive, >* but not ready to serve this namespaces. The spec suggests > @@ -69,31 +77,38 @@ void nvme_failover_req(struct request *req) >* that the admin and I/O queues are not serialized that is >* fundamentally racy. So instead just clear the current path, >* mark the the path as pending and kick of a re-read of the ANA > -
Re: [dm-devel] multipath-tools: add ANA support for NVMe device
On Wed, Nov 14 2018 at 2:49am -0500, Hannes Reinecke wrote: > On 11/14/18 6:38 AM, Mike Snitzer wrote: > >On Tue, Nov 13 2018 at 1:00pm -0500, > >Mike Snitzer wrote: > > > >>[1]: > >>http://lists.infradead.org/pipermail/linux-nvme/2018-November/020765.html > >>[2]: https://www.redhat.com/archives/dm-devel/2018-November/msg00072.html > >... > > > >I knew there had to be a pretty tight coupling between the NVMe driver's > >native multipathing and ANA support... and that the simplicity of > >Hannes' patch [1] was too good to be true. > > > >The real justification for not making Hannes' change is it'd effectively > >be useless without first splitting out the ANA handling done during NVMe > >request completion (NVME_SC_ANA_* cases in nvme_failover_req) that > >triggers re-reading the ANA log page accordingly. > > > >So without the ability to drive the ANA workqueue to trigger > >nvme_read_ana_log() from the nvme driver's completion path -- even if > >nvme_core.multipath=N -- it really doesn't buy multipath-tools anything > >to have the NVMe driver export the ana state via sysfs, because that ANA > >state will never get updated. > > > Hmm. Indeed, I was more focussed on having the sysfs attributes > displayed, so yes, indeed it needs some more work. ... > >Not holding my breath BUT: > >if decoupling the reading of ANA state from native NVMe multipathing > >specific work during nvme request completion were an acceptable > >advancement I'd gladly do the work. > > > I'd be happy to work on that, given that we'll have to have 'real' > ANA support for device-mapper anyway for SLE12 SP4 etc. I had a close enough look yesterday that I figured I'd just implement what I reasoned through as one way forward, compile tested only (patch relative to Jens' for-4.21/block): drivers/nvme/host/core.c | 14 +++--- drivers/nvme/host/multipath.c | 65 ++- drivers/nvme/host/nvme.h | 4 +++ 3 files changed, 54 insertions(+), 29 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index f172d63db2b5..05313ab5d91e 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -252,10 +252,16 @@ void nvme_complete_rq(struct request *req) trace_nvme_complete_rq(req); if (unlikely(status != BLK_STS_OK && nvme_req_needs_retry(req))) { - if ((req->cmd_flags & REQ_NVME_MPATH) && - blk_path_error(status)) { - nvme_failover_req(req); - return; + if (blk_path_error(status)) { + struct nvme_ns *ns = req->q->queuedata; + u16 nvme_status = nvme_req(req)->status; + + if (req->cmd_flags & REQ_NVME_MPATH) { + nvme_failover_req(req); + nvme_update_ana(ns, nvme_status); + return; + } + nvme_update_ana(ns, nvme_status); } if (!blk_queue_dying(req->q)) { diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 5e3cc8c59a39..f7fbc161dc8c 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -22,7 +22,7 @@ MODULE_PARM_DESC(multipath, inline bool nvme_ctrl_use_ana(struct nvme_ctrl *ctrl) { - return multipath && ctrl->subsys && (ctrl->subsys->cmic & (1 << 3)); + return ctrl->subsys && (ctrl->subsys->cmic & (1 << 3)); } /* @@ -47,6 +47,17 @@ void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns, } } +static bool nvme_ana_error(u16 status) +{ + switch (status & 0x7ff) { + case NVME_SC_ANA_TRANSITION: + case NVME_SC_ANA_INACCESSIBLE: + case NVME_SC_ANA_PERSISTENT_LOSS: + return true; + } + return false; +} + void nvme_failover_req(struct request *req) { struct nvme_ns *ns = req->q->queuedata; @@ -58,10 +69,7 @@ void nvme_failover_req(struct request *req) spin_unlock_irqrestore(>head->requeue_lock, flags); blk_mq_end_request(req, 0); - switch (status & 0x7ff) { - case NVME_SC_ANA_TRANSITION: - case NVME_SC_ANA_INACCESSIBLE: - case NVME_SC_ANA_PERSISTENT_LOSS: + if (nvme_ana_error(status)) { /* * If we got back an ANA error we know the controller is alive, * but not ready to serve this namespaces. The spec suggests @@ -69,31 +77,38 @@ void nvme_failover_req(struct request *req) * that the admin and I/O queues are not serialized that is * fundamentally racy. So instead just clear the current path, * mark the the path as pending and kick of a re-read of the ANA -* log page ASAP. +* log page ASAP (see nvme_update_ana() below). */ nvme_mpath_clear_current_path(ns); -
Re: [dm-devel] multipath-tools: add ANA support for NVMe device
On Wed, Nov 14 2018 at 10:35am -0500, Christoph Hellwig wrote: > On Wed, Nov 14, 2018 at 08:24:05AM +0100, Hannes Reinecke wrote: > > My argument here is that _ANA_ support should not be tied to the NVME > > native multipathing at all. > > It should. Because nvme driver multipathing is the only sanctioned > way to use it. All other ways aren't supported and might break at > any time. Quite a few of us who are multipath-tools oriented would like the proper separation rather than your more pragmatic isolated approach. And we'd fix it if it broke in the future. > > So personally I don't see why the 'raw' ANA support (parsing log pages, > > figuring out path states etc) needs to be tied in with native NVMe > > multipathing. _Especially_ not as my patch really is trivial. > > And not actually usable for anything.. They only thing you do is to > increase the code size for embedded nvme users that don't need any > multipathing. Isn't that why CONFIG_NVME_MULTIPATH exists? Embedded nvme users wouldn't set that. -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel
Re: [dm-devel] multipath-tools: add ANA support for NVMe device
On Wed, Nov 14, 2018 at 08:24:05AM +0100, Hannes Reinecke wrote: > My argument here is that _ANA_ support should not be tied to the NVME > native multipathing at all. It should. Because nvme driver multipathing is the only sanctioned way to use it. All other ways aren't supported and might break at any time. > So personally I don't see why the 'raw' ANA support (parsing log pages, > figuring out path states etc) needs to be tied in with native NVMe > multipathing. _Especially_ not as my patch really is trivial. And not actually usable for anything.. They only thing you do is to increase the code size for embedded nvme users that don't need any multipathing. -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel
Re: [dm-devel] multipath-tools: add ANA support for NVMe device
On Wed, 2018-11-14 at 08:49 +0100, Hannes Reinecke wrote: > On 11/14/18 6:38 AM, Mike Snitzer wrote: > > > > Not holding my breath BUT: > > if decoupling the reading of ANA state from native NVMe > > multipathing > > specific work during nvme request completion were an acceptable > > advancement I'd gladly do the work. > > > I'd be happy to work on that, given that we'll have to have 'real' > ANA > support for device-mapper anyway for SLE12 SP4 etc. So, what's the way ahead for multipath-tools? Given that, IIUC, at least one official kernel (4.19) has been released with ANA support but without the ANA sysfs attributes exported to user space, multipath-tools can't rely on them being present. I for one have no issue with copying code from nvme-cli and doing NVMe ioctls from multipath-tools, as in Lijie's patch. When those sysfs attributes are added (and work as expected), we will use them, but IMO we'll need to fall back to ioctls until then, and also afterwards, because we can't assume to be always running on the latest kernel. Best, Martin -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel
Re: [dm-devel] multipath-tools: add ANA support for NVMe device
On 11/14/18 6:38 AM, Mike Snitzer wrote: On Tue, Nov 13 2018 at 1:00pm -0500, Mike Snitzer wrote: On Tue, Nov 13 2018 at 11:18am -0500, Keith Busch wrote: On Mon, Nov 12, 2018 at 04:53:23PM -0500, Mike Snitzer wrote: On Mon, Nov 12 2018 at 11:23am -0500, Martin Wilck wrote: Hello Lijie, On Thu, 2018-11-08 at 14:09 +0800, lijie wrote: Add support for Asynchronous Namespace Access as specified in NVMe 1.3 TP 4004. The states are updated through reading the ANA log page. By default, the native nvme multipath takes over the nvme device. We can pass a false to the parameter 'multipath' of the nvme-core.ko module,when we want to use multipath-tools. Thank you for the patch. It looks quite good to me. I've tested it with a Linux target and found no problems so far. I have a few questions and comments inline below. I suggest you also have a look at detect_prio(); it seems to make sense to use the ana prioritizer for NVMe paths automatically if ANA is supported (with your patch, "detect_prio no" and "prio ana" have to be configured explicitly). But that can be done in a later patch. I (and others) think it makes sense to at least triple check with the NVMe developers (now cc'd) to see if we could get agreement on the nvme driver providing the ANA state via sysfs (when modparam nvme_core.multipath=N is set), like Hannes proposed here: http://lists.infradead.org/pipermail/linux-nvme/2018-November/020765.html Then the userspace multipath-tools ANA support could just read sysfs rather than reinvent harvesting the ANA state via ioctl. I'd prefer not duplicating the log page parsing. Maybe nvme's shouldn't even be tied to CONFIG_NVME_MULTIPATH so that the 'multipath' param isn't even an issue. I like your instincts, we just need to take them a bit further. Splitting out the kernel's ANA log page parsing won't buy us much given it is userspace (multipath-tools) that needs to consume it. The less work userspace needs to do (because kernel has already done it) the better. If the NVMe driver is made to always track and export the ANA state via sysfs [1] we'd avoid userspace parsing duplication "for free". This should occur regardless of what layer is reacting to the ANA state changes (be it NVMe's native multipathing or multipath-tools). ANA and NVMe multipathing really are disjoint, making them tightly coupled only serves to force NVMe driver provided multipathing _or_ userspace ANA state tracking duplication that really isn't ideal [2]. We need a reasoned answer to the primary question of whether the NVMe maintainers are willing to cooperate by providing this basic ANA sysfs export even if nvme_core.multipath=N [1]. Christoph said "No" [3], but offered little _real_ justification for why this isn't the right thing for NVMe in general. ... [1]: http://lists.infradead.org/pipermail/linux-nvme/2018-November/020765.html [2]: https://www.redhat.com/archives/dm-devel/2018-November/msg00072.html ... I knew there had to be a pretty tight coupling between the NVMe driver's native multipathing and ANA support... and that the simplicity of Hannes' patch [1] was too good to be true. The real justification for not making Hannes' change is it'd effectively be useless without first splitting out the ANA handling done during NVMe request completion (NVME_SC_ANA_* cases in nvme_failover_req) that triggers re-reading the ANA log page accordingly. So without the ability to drive the ANA workqueue to trigger nvme_read_ana_log() from the nvme driver's completion path -- even if nvme_core.multipath=N -- it really doesn't buy multipath-tools anything to have the NVMe driver export the ana state via sysfs, because that ANA state will never get updated. Hmm. Indeed, I was more focussed on having the sysfs attributes displayed, so yes, indeed it needs some more work. The inability to provide proper justification for rejecting a patch (that already had one co-maintainer's Reviewed-by [5]) _should_ render that rejection baseless, and the patch applied (especially if there is contributing subsystem developer interest in maintaining this support over time, which there is). At least that is what would happen in a properly maintained kernel subsystem. It'd really go a long way if senior Linux NVMe maintainers took steps to accept reasonable changes. Even though I'm frustrated I was clearly too harsh and regret my tone. I promise to _try_ to suck less. This dynamic of terse responses or no responses at all whenever NVMe driver changes to ease multipath-tools NVMe support are floated is the depressing gift that keeps on giving. But enough excuses... Not holding my breath BUT: if decoupling the reading of ANA state from native NVMe multipathing specific work during nvme request completion were an acceptable advancement I'd gladly do the work. I'd be happy to work on that, given that we'll have to have 'real' ANA support for device-mapper anyway for SLE12 SP4 etc. Cheers, Hannes -- Dr. Hannes Reinecke
Re: [dm-devel] multipath-tools: add ANA support for NVMe device
On 11/13/18 5:18 PM, Keith Busch wrote: On Mon, Nov 12, 2018 at 04:53:23PM -0500, Mike Snitzer wrote: On Mon, Nov 12 2018 at 11:23am -0500, Martin Wilck wrote: Hello Lijie, On Thu, 2018-11-08 at 14:09 +0800, lijie wrote: Add support for Asynchronous Namespace Access as specified in NVMe 1.3 TP 4004. The states are updated through reading the ANA log page. By default, the native nvme multipath takes over the nvme device. We can pass a false to the parameter 'multipath' of the nvme-core.ko module,when we want to use multipath-tools. Thank you for the patch. It looks quite good to me. I've tested it with a Linux target and found no problems so far. I have a few questions and comments inline below. I suggest you also have a look at detect_prio(); it seems to make sense to use the ana prioritizer for NVMe paths automatically if ANA is supported (with your patch, "detect_prio no" and "prio ana" have to be configured explicitly). But that can be done in a later patch. I (and others) think it makes sense to at least triple check with the NVMe developers (now cc'd) to see if we could get agreement on the nvme driver providing the ANA state via sysfs (when modparam nvme_core.multipath=N is set), like Hannes proposed here: http://lists.infradead.org/pipermail/linux-nvme/2018-November/020765.html Then the userspace multipath-tools ANA support could just read sysfs rather than reinvent harvesting the ANA state via ioctl. I'd prefer not duplicating the log page parsing. Maybe nvme's shouldn't even be tied to CONFIG_NVME_MULTIPATH so that the 'multipath' param isn't even an issue. My argument here is that _ANA_ support should not be tied to the NVME native multipathing at all. Whether or not ANA is present is a choice of the target implementation; the host has _zero_ influence on this. It may argue all it wants and doesn't even have to implement multipathing. But in the end if the target declares a path as 'inaccessible' the path _is_ inaccessible to the host. Even it that particular host doesn't implement or activate multipathing. (You wouldn't believe how often I had this discussion with our QA team for ALUA ...) Whether or not _multipathing_ is used is a _host_ implementation, and is actually independent on ANA support; linux itself proved the point here as we supported (symmetric) multipathing far longer than we had an ANA implementation. So personally I don't see why the 'raw' ANA support (parsing log pages, figuring out path states etc) needs to be tied in with native NVMe multipathing. _Especially_ not as my patch really is trivial. Cheers, Hannes -- Dr. Hannes ReineckeTeamlead Storage & Networking h...@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel
Re: [dm-devel] multipath-tools: add ANA support for NVMe device
On Tue, Nov 13 2018 at 1:00pm -0500, Mike Snitzer wrote: > On Tue, Nov 13 2018 at 11:18am -0500, > Keith Busch wrote: > > > On Mon, Nov 12, 2018 at 04:53:23PM -0500, Mike Snitzer wrote: > > > On Mon, Nov 12 2018 at 11:23am -0500, > > > Martin Wilck wrote: > > > > > > > Hello Lijie, > > > > > > > > On Thu, 2018-11-08 at 14:09 +0800, lijie wrote: > > > > > Add support for Asynchronous Namespace Access as specified in NVMe > > > > > 1.3 > > > > > TP 4004. The states are updated through reading the ANA log page. > > > > > > > > > > By default, the native nvme multipath takes over the nvme device. > > > > > We can pass a false to the parameter 'multipath' of the nvme-core.ko > > > > > module,when we want to use multipath-tools. > > > > > > > > Thank you for the patch. It looks quite good to me. I've tested it with > > > > a Linux target and found no problems so far. > > > > > > > > I have a few questions and comments inline below. > > > > > > > > I suggest you also have a look at detect_prio(); it seems to make sense > > > > to use the ana prioritizer for NVMe paths automatically if ANA is > > > > supported (with your patch, "detect_prio no" and "prio ana" have to be > > > > configured explicitly). But that can be done in a later patch. > > > > > > I (and others) think it makes sense to at least triple check with the > > > NVMe developers (now cc'd) to see if we could get agreement on the nvme > > > driver providing the ANA state via sysfs (when modparam > > > nvme_core.multipath=N is set), like Hannes proposed here: > > > http://lists.infradead.org/pipermail/linux-nvme/2018-November/020765.html > > > > > > Then the userspace multipath-tools ANA support could just read sysfs > > > rather than reinvent harvesting the ANA state via ioctl. > > > > I'd prefer not duplicating the log page parsing. Maybe nvme's shouldn't > > even be tied to CONFIG_NVME_MULTIPATH so that the 'multipath' param > > isn't even an issue. > > I like your instincts, we just need to take them a bit further. > > Splitting out the kernel's ANA log page parsing won't buy us much given > it is userspace (multipath-tools) that needs to consume it. The less > work userspace needs to do (because kernel has already done it) the > better. > > If the NVMe driver is made to always track and export the ANA state via > sysfs [1] we'd avoid userspace parsing duplication "for free". This > should occur regardless of what layer is reacting to the ANA state > changes (be it NVMe's native multipathing or multipath-tools). > > ANA and NVMe multipathing really are disjoint, making them tightly > coupled only serves to force NVMe driver provided multipathing _or_ > userspace ANA state tracking duplication that really isn't ideal [2]. > > We need a reasoned answer to the primary question of whether the NVMe > maintainers are willing to cooperate by providing this basic ANA sysfs > export even if nvme_core.multipath=N [1]. > > Christoph said "No" [3], but offered little _real_ justification for why > this isn't the right thing for NVMe in general. ... > [1]: http://lists.infradead.org/pipermail/linux-nvme/2018-November/020765.html > [2]: https://www.redhat.com/archives/dm-devel/2018-November/msg00072.html ... I knew there had to be a pretty tight coupling between the NVMe driver's native multipathing and ANA support... and that the simplicity of Hannes' patch [1] was too good to be true. The real justification for not making Hannes' change is it'd effectively be useless without first splitting out the ANA handling done during NVMe request completion (NVME_SC_ANA_* cases in nvme_failover_req) that triggers re-reading the ANA log page accordingly. So without the ability to drive the ANA workqueue to trigger nvme_read_ana_log() from the nvme driver's completion path -- even if nvme_core.multipath=N -- it really doesn't buy multipath-tools anything to have the NVMe driver export the ana state via sysfs, because that ANA state will never get updated. > The inability to provide proper justification for rejecting a patch > (that already had one co-maintainer's Reviewed-by [5]) _should_ render > that rejection baseless, and the patch applied (especially if there is > contributing subsystem developer interest in maintaining this support > over time, which there is). At least that is what would happen in a > properly maintained kernel subsystem. > > It'd really go a long way if senior Linux NVMe maintainers took steps to > accept reasonable changes. Even though I'm frustrated I was clearly too harsh and regret my tone. I promise to _try_ to suck less. This dynamic of terse responses or no responses at all whenever NVMe driver changes to ease multipath-tools NVMe support are floated is the depressing gift that keeps on giving. But enough excuses... Not holding my breath BUT: if decoupling the reading of ANA state from native NVMe multipathing specific work during nvme request completion were an acceptable advancement I'd gladly do the work.
Re: [dm-devel] multipath-tools: add ANA support for NVMe device
On Tue, Nov 13 2018 at 11:18am -0500, Keith Busch wrote: > On Mon, Nov 12, 2018 at 04:53:23PM -0500, Mike Snitzer wrote: > > On Mon, Nov 12 2018 at 11:23am -0500, > > Martin Wilck wrote: > > > > > Hello Lijie, > > > > > > On Thu, 2018-11-08 at 14:09 +0800, lijie wrote: > > > > Add support for Asynchronous Namespace Access as specified in NVMe > > > > 1.3 > > > > TP 4004. The states are updated through reading the ANA log page. > > > > > > > > By default, the native nvme multipath takes over the nvme device. > > > > We can pass a false to the parameter 'multipath' of the nvme-core.ko > > > > module,when we want to use multipath-tools. > > > > > > Thank you for the patch. It looks quite good to me. I've tested it with > > > a Linux target and found no problems so far. > > > > > > I have a few questions and comments inline below. > > > > > > I suggest you also have a look at detect_prio(); it seems to make sense > > > to use the ana prioritizer for NVMe paths automatically if ANA is > > > supported (with your patch, "detect_prio no" and "prio ana" have to be > > > configured explicitly). But that can be done in a later patch. > > > > I (and others) think it makes sense to at least triple check with the > > NVMe developers (now cc'd) to see if we could get agreement on the nvme > > driver providing the ANA state via sysfs (when modparam > > nvme_core.multipath=N is set), like Hannes proposed here: > > http://lists.infradead.org/pipermail/linux-nvme/2018-November/020765.html > > > > Then the userspace multipath-tools ANA support could just read sysfs > > rather than reinvent harvesting the ANA state via ioctl. > > I'd prefer not duplicating the log page parsing. Maybe nvme's shouldn't > even be tied to CONFIG_NVME_MULTIPATH so that the 'multipath' param > isn't even an issue. I like your instincts, we just need to take them a bit further. Splitting out the kernel's ANA log page parsing won't buy us much given it is userspace (multipath-tools) that needs to consume it. The less work userspace needs to do (because kernel has already done it) the better. If the NVMe driver is made to always track and export the ANA state via sysfs [1] we'd avoid userspace parsing duplication "for free". This should occur regardless of what layer is reacting to the ANA state changes (be it NVMe's native multipathing or multipath-tools). ANA and NVMe multipathing really are disjoint, making them tightly coupled only serves to force NVMe driver provided multipathing _or_ userspace ANA state tracking duplication that really isn't ideal [2]. We need a reasoned answer to the primary question of whether the NVMe maintainers are willing to cooperate by providing this basic ANA sysfs export even if nvme_core.multipath=N [1]. Christoph said "No" [3], but offered little _real_ justification for why this isn't the right thing for NVMe in general -- even when asked the question gets ignored [4]. The inability to provide proper justification for rejecting a patch (that already had one co-maintainer's Reviewed-by [5]) _should_ render that rejection baseless, and the patch applied (especially if there is contributing subsystem developer interest in maintaining this support over time, which there is). At least that is what would happen in a properly maintained kernel subsystem. It'd really go a long way if senior Linux NVMe maintainers took steps to accept reasonable changes. Mike [1]: http://lists.infradead.org/pipermail/linux-nvme/2018-November/020765.html [2]: https://www.redhat.com/archives/dm-devel/2018-November/msg00072.html [3]: http://lists.infradead.org/pipermail/linux-nvme/2018-November/020815.html [4]: http://lists.infradead.org/pipermail/linux-nvme/2018-November/020846.html [5]: http://lists.infradead.org/pipermail/linux-nvme/2018-November/020790.html -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel
Re: [dm-devel] multipath-tools: add ANA support for NVMe device
On Mon, Nov 12, 2018 at 04:53:23PM -0500, Mike Snitzer wrote: > On Mon, Nov 12 2018 at 11:23am -0500, > Martin Wilck wrote: > > > Hello Lijie, > > > > On Thu, 2018-11-08 at 14:09 +0800, lijie wrote: > > > Add support for Asynchronous Namespace Access as specified in NVMe > > > 1.3 > > > TP 4004. The states are updated through reading the ANA log page. > > > > > > By default, the native nvme multipath takes over the nvme device. > > > We can pass a false to the parameter 'multipath' of the nvme-core.ko > > > module,when we want to use multipath-tools. > > > > Thank you for the patch. It looks quite good to me. I've tested it with > > a Linux target and found no problems so far. > > > > I have a few questions and comments inline below. > > > > I suggest you also have a look at detect_prio(); it seems to make sense > > to use the ana prioritizer for NVMe paths automatically if ANA is > > supported (with your patch, "detect_prio no" and "prio ana" have to be > > configured explicitly). But that can be done in a later patch. > > I (and others) think it makes sense to at least triple check with the > NVMe developers (now cc'd) to see if we could get agreement on the nvme > driver providing the ANA state via sysfs (when modparam > nvme_core.multipath=N is set), like Hannes proposed here: > http://lists.infradead.org/pipermail/linux-nvme/2018-November/020765.html > > Then the userspace multipath-tools ANA support could just read sysfs > rather than reinvent harvesting the ANA state via ioctl. I'd prefer not duplicating the log page parsing. Maybe nvme's shouldn't even be tied to CONFIG_NVME_MULTIPATH so that the 'multipath' param isn't even an issue. > But if we continue to hit a wall on that type of sharing of the nvme > driver's state then I'm fine with reinventing ANA state inquiry and > tracking like has been proposed here. > > Mike > > p.s. thanks for your review Martin, we really need to determine the way > forward for full multipath-tools support of NVMe with ANA. -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel
Re: [dm-devel] multipath-tools: add ANA support for NVMe device
On Mon, 2018-11-12 at 16:53 -0500, Mike Snitzer wrote: > > I (and others) think it makes sense to at least triple check with the > NVMe developers (now cc'd) to see if we could get agreement on the > nvme > driver providing the ANA state via sysfs (when modparam > nvme_core.multipath=N is set), like Hannes proposed here: > http://lists.infradead.org/pipermail/linux-nvme/2018-November/020765.html > > Then the userspace multipath-tools ANA support could just read sysfs > rather than reinvent harvesting the ANA state via ioctl. If some kernels expose the sysfs attributes and some don't, what are we supposed to do? In order to be portable, multipath-tools (and other user space tools, for that matter) need to support both, and maintain multiple code paths. Just like SCSI :-) I'd really like to see this abstracted away with a "libnvme" (you name it), which user space tools could simply call without having to worry how it actually talks to the kernel. Martin -- Dr. Martin Wilck , Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel
Re: [dm-devel] multipath-tools: add ANA support for NVMe device
On Mon, Nov 12 2018 at 11:23am -0500, Martin Wilck wrote: > Hello Lijie, > > On Thu, 2018-11-08 at 14:09 +0800, lijie wrote: > > Add support for Asynchronous Namespace Access as specified in NVMe > > 1.3 > > TP 4004. The states are updated through reading the ANA log page. > > > > By default, the native nvme multipath takes over the nvme device. > > We can pass a false to the parameter 'multipath' of the nvme-core.ko > > module,when we want to use multipath-tools. > > Thank you for the patch. It looks quite good to me. I've tested it with > a Linux target and found no problems so far. > > I have a few questions and comments inline below. > > I suggest you also have a look at detect_prio(); it seems to make sense > to use the ana prioritizer for NVMe paths automatically if ANA is > supported (with your patch, "detect_prio no" and "prio ana" have to be > configured explicitly). But that can be done in a later patch. I (and others) think it makes sense to at least triple check with the NVMe developers (now cc'd) to see if we could get agreement on the nvme driver providing the ANA state via sysfs (when modparam nvme_core.multipath=N is set), like Hannes proposed here: http://lists.infradead.org/pipermail/linux-nvme/2018-November/020765.html Then the userspace multipath-tools ANA support could just read sysfs rather than reinvent harvesting the ANA state via ioctl. But if we continue to hit a wall on that type of sharing of the nvme driver's state then I'm fine with reinventing ANA state inquiry and tracking like has been proposed here. Mike p.s. thanks for your review Martin, we really need to determine the way forward for full multipath-tools support of NVMe with ANA. -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel