All of lore.kernel.org
 help / color / mirror / Atom feed
* multipath - unable to use multiple active paths at once, and deprecated example in docs
@ 2019-11-22 20:27 Drew Hastings
  2019-11-25 19:49 ` Martin Wilck
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Hastings @ 2019-11-22 20:27 UTC (permalink / raw)
  To: dm-devel


[-- Attachment #1.1: Type: text/plain, Size: 2444 bytes --]

My use case doesn't lend itself well to multipathd, so I'm trying to
implement multipathing with device mapper directly.

My table is (kernel 4.19.79):

0 1562378240 multipath 4 queue_if_no_path retain_attached_hw_handler
queue_mode bio 0 1 1 queue-length 0 4 1 253:11 1 253:8 1 253:9 1 253:10 1

What I've found with this setup is that, aside from the first path in the
group, none of the other paths receive IO/bios.

The only "real" path is 253:11, the rest of them are to dm error targets.
Still though, you can see the status of this multipath target is:

0 1562378240 multipath 2 0 0 0 1 1 A 0 4 1 253:11 A 0 309 253:8 A 0 0 253:9
A 0 0 253:10 A 0 0

So 253:11 has a queue of 309, while the rest of the devices have a queue of
zero and show an active status, indicating no IO has triggered the
underlying dm error target causing the 2nd, 3rd, and 4th paths to fail.

Before diving much deeper into the relevant kernel code, I figured I'd
check to see if there's any obvious reason this should not work the way I
expect (where individual paths are balanced within the group).

I realize that Documentation/device-mapper/dm-queue-length.txt is also
out-dated (it makes suggestions that are deprecated), but still that
documentation implies this table would balance the load. Here is the table
from those docs.

test: 0 10 multipath 0 0 1 1 queue-length 0 2 1 8:0 128 8:16 128 ( >1 is
deprecated since those docs)

My only assumption is that the multipath features, in particular queue_mode
bio, prevent this from behaving properly. If that is the case, why can this
not be achieved with bios, as this is not a limitation of raid1 (which will
load balance read IO to device mapper targets). I also believe this is the
only feature option that is viable for me, since this multipath device is
on top of device mapper targets.

The documentation would imply that the queue should be roughly the same to
every device, and that after every IO a new path is chosen for the next IO
based on the lowest entry. The code looks like it does this as described,
but maybe there's some condition preventing it from doing so (while still
counting the queue). Is there anything I can do to get this target to
behave as I assumed it would from
Documentation/device-mapper/dm-queue-length.txt ?

Also, for what it's worth, round-robin behaves the same way as queue-length.

Thank you for your time!
- Drew

[-- Attachment #1.2: Type: text/html, Size: 2537 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: multipath - unable to use multiple active paths at once, and deprecated example in docs
  2019-11-22 20:27 multipath - unable to use multiple active paths at once, and deprecated example in docs Drew Hastings
@ 2019-11-25 19:49 ` Martin Wilck
  2019-11-25 20:42   ` Drew Hastings
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Wilck @ 2019-11-25 19:49 UTC (permalink / raw)
  To: Drew Hastings, dm-devel

On Fri, 2019-11-22 at 13:27 -0700, Drew Hastings wrote:
> My use case doesn't lend itself well to multipathd, so I'm trying to
> implement multipathing with device mapper directly.
> 
> My only assumption is that the multipath features, in particular
> queue_mode bio, prevent this from behaving properly. If that is the
> case, why can this not be achieved with bios, as this is not a
> limitation of raid1 (which will load balance read IO to device mapper
> targets). I also believe this is the only feature option that is
> viable for me, since this multipath device is on top of device mapper
> targets.

I think you are seeing this FIXME:

https://elixir.bootlin.com/linux/v4.19.79/source/drivers/md/dm-mpath.c#L612

For your testing, perhaps you just remove that if(!pgpath) condition.

Regards,
Martin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: multipath - unable to use multiple active paths at once, and deprecated example in docs
  2019-11-25 19:49 ` Martin Wilck
@ 2019-11-25 20:42   ` Drew Hastings
  2019-11-25 21:07     ` Martin Wilck
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Hastings @ 2019-11-25 20:42 UTC (permalink / raw)
  To: Martin Wilck, dm-devel


[-- Attachment #1.1: Type: text/plain, Size: 910 bytes --]

On Mon, Nov 25, 2019 at 12:48 PM Martin Wilck <mwilck@suse.de> wrote:

>
> I think you are seeing this FIXME:
>
> https://elixir.bootlin.com/linux/v4.19.79/source/drivers/md/dm-mpath.c#L612
>
> For your testing, perhaps you just remove that if(!pgpath) condition.
>
> Regards,
> Martin
>

That's correct, thanks. It works as expected after removing that condition.

With some limited testing using fio, I don't see any obvious negative
impacts of allowing choose_pgpath to run each bio mapping. I also don't see
any significant increase in CPU usage or IO latency during benchmarking.

The FIXME comment acknowledges that this sort of defeats the balancing
function of multipath, so I'm assuming this was removed for a good reason.
Does anyone know why this was done? In my particular use case, I benefit
from balancing the paths for throughput, so it's useful to me.

Thanks!
- Drew

[-- Attachment #1.2: Type: text/html, Size: 1319 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: multipath - unable to use multiple active paths at once, and deprecated example in docs
  2019-11-25 20:42   ` Drew Hastings
@ 2019-11-25 21:07     ` Martin Wilck
  2019-11-26 15:39       ` Mike Snitzer
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Wilck @ 2019-11-25 21:07 UTC (permalink / raw)
  To: Drew Hastings, dm-devel; +Cc: Mike Snitzer

On Mon, 2019-11-25 at 13:42 -0700, Drew Hastings wrote:
> On Mon, Nov 25, 2019 at 12:48 PM Martin Wilck <mwilck@suse.de> wrote:
> > I think you are seeing this FIXME:
> > 
> > https://elixir.bootlin.com/linux/v4.19.79/source/drivers/md/dm-mpath.c#L612
> > 
> > For your testing, perhaps you just remove that if(!pgpath)
> > condition.
> > 
> > Regards,
> > Martin
> 
> That's correct, thanks. It works as expected after removing that
> condition.
> 
> With some limited testing using fio, I don't see any obvious negative
> impacts of allowing choose_pgpath to run each bio mapping. I also
> don't see any significant increase in CPU usage or IO latency during
> benchmarking.
> 
> The FIXME comment acknowledges that this sort of defeats the
> balancing function of multipath, so I'm assuming this was removed for
> a good reason. Does anyone know why this was done? In my particular
> use case, I benefit from balancing the paths for throughput, so it's
> useful to me.

This originates from the former use of dm-multipath for NVMe devices,
the now obsolete "nvme" queue mode, and from the attempt to separate
dm-multipath from SCSI and its device handler model. See 8d47e65948dd
("dm mpath: remove unnecessary NVMe branching in favor of scsi_dh
checks").

It seems indeed strange to skip choosing the path in the absence of the
SCSI device handler, which is (with a grain of salt) responsible for
switching *path groups*, not paths inside a group. It's a corner case,
I don't think many real-world multipath setups deploy bio-based dm-
mpath without a device handler.

So, I suggest you submit a patch and discuss this with Mike :-)

Regards,
Martin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: multipath - unable to use multiple active paths at once, and deprecated example in docs
  2019-11-25 21:07     ` Martin Wilck
@ 2019-11-26 15:39       ` Mike Snitzer
  0 siblings, 0 replies; 5+ messages in thread
From: Mike Snitzer @ 2019-11-26 15:39 UTC (permalink / raw)
  To: Martin Wilck; +Cc: dm-devel, Drew Hastings

On Mon, Nov 25 2019 at  4:07pm -0500,
Martin Wilck <mwilck@suse.de> wrote:

> On Mon, 2019-11-25 at 13:42 -0700, Drew Hastings wrote:
> > On Mon, Nov 25, 2019 at 12:48 PM Martin Wilck <mwilck@suse.de> wrote:
> > > I think you are seeing this FIXME:
> > > 
> > > https://elixir.bootlin.com/linux/v4.19.79/source/drivers/md/dm-mpath.c#L612
> > > 
> > > For your testing, perhaps you just remove that if(!pgpath)
> > > condition.
> > > 
> > > Regards,
> > > Martin
> > 
> > That's correct, thanks. It works as expected after removing that
> > condition.
> > 
> > With some limited testing using fio, I don't see any obvious negative
> > impacts of allowing choose_pgpath to run each bio mapping. I also
> > don't see any significant increase in CPU usage or IO latency during
> > benchmarking.
> > 
> > The FIXME comment acknowledges that this sort of defeats the
> > balancing function of multipath, so I'm assuming this was removed for
> > a good reason. Does anyone know why this was done? In my particular
> > use case, I benefit from balancing the paths for throughput, so it's
> > useful to me.
> 
> This originates from the former use of dm-multipath for NVMe devices,
> the now obsolete "nvme" queue mode, and from the attempt to separate
> dm-multipath from SCSI and its device handler model. See 8d47e65948dd
> ("dm mpath: remove unnecessary NVMe branching in favor of scsi_dh
> checks").
> 
> It seems indeed strange to skip choosing the path in the absence of the
> SCSI device handler, which is (with a grain of salt) responsible for
> switching *path groups*, not paths inside a group. It's a corner case,
> I don't think many real-world multipath setups deploy bio-based dm-
> mpath without a device handler.
> 
> So, I suggest you submit a patch and discuss this with Mike :-)

Hindsight being 20/20: it was misplaced micro-optimization that
compromised the broader features provided by the configurable path
selectors.

I've just removed __map_bio_fast(), see:
https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-5.5&id=dbaf971c9cdf10843071a60dcafc1aaab3162354

not sure when I'll send this to Linus.. likely in a couple weeks as part
of any other DM fixes (first batch of DM changes for 5.5 was already
merged yesterday).

Thanks,
Mike

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-11-26 15:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22 20:27 multipath - unable to use multiple active paths at once, and deprecated example in docs Drew Hastings
2019-11-25 19:49 ` Martin Wilck
2019-11-25 20:42   ` Drew Hastings
2019-11-25 21:07     ` Martin Wilck
2019-11-26 15:39       ` Mike Snitzer

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.