[dm-devel] [RFC 0/3] Add support of iopoll for dm device
JeffleXu
jefflexu at linux.alibaba.com
Wed Nov 4 06:47:44 UTC 2020
On 11/2/20 11:28 PM, Mike Snitzer wrote:
> On Sun, Nov 01 2020 at 10:14pm -0500,
> JeffleXu <jefflexu at linux.alibaba.com> wrote:
>
>> On 10/27/20 2:53 AM, Mike Snitzer wrote:
>>> What you detailed there isn't properly modeling what it needs to.
>>> A given dm_target_io could result in quite a few bios (e.g. for
>>> dm-striped we clone each bio for each of N stripes). So the fan-out,
>>> especially if then stacked on N layers of stacked devices, to all the
>>> various hctx at the lowest layers is like herding cats.
>>>
>>> But the recursion in block core's submit_bio path makes that challenging
>>> to say the least. So much so that any solution related to enabling
>>> proper bio-based IO polling is going to need a pretty significant
>>> investment in fixing block core (storing __submit_bio()'s cookie during
>>> recursion, possibly storing to driver provided memory location,
>>> e.g. DM initialized bio->submit_cookie pointer to a blk_qc_t within a DM
>>> clone bio's per-bio-data).
>>>
>>> SO __submit_bio_noacct would become:
>>>
>>> retp = &ret;
>>> if (bio->submit_cookie)
>>> retp = bio->submit_cookie;
>>> *retp = __submit_bio(bio);
>> Sorry for the late reply. Exactly I missed this point before. IF you
>> have not started working on this, I'd like to try to implement this as
>> an RFC.
> I did start on this line of development but it needs quite a bit more
> work. Even the pseudo code I provided above isn't useful in the context
> of DM clone bios that have their own per-bio-data to assist with this
> implementation. Because the __submit_bio_noacct() recursive call
> drivers/md/dm.c:__split_and_process_bio() makes is supplying the
> original bio (modified to only point to remaining work).
Yes I noticed this recently. Since the depth-first splitting introduced
in commit 18a25da84354
("dm: ensure bio submission follows a depth-first tree walk"), one bio
to dm device can be
split into multiple bios to this dm device.
```
one bio to dm device (dm0) = one dm_io (to nvme0) + one bio to this same
dm device (dm0)
```
In this case we need a mechanism to track all split sub-bios of the very
beginning original bio.
I'm doubted if this should be implemented in block layer like:
```
struct bio {
...
struct list_head cookies;
};
```
After all it's only used by bio-based queue, or more specifically only
dm device currently.
Another design I can come up with is to maintain a global data structure
for the very beginning
original bio. Currently the blocking point is that now one original bio
to the dm device (@bio of
dm_submit()) can correspond to multiple dm_io and thus we have nowhere
to place the
@cookies list.
Now we have to maintain one data structure for every original bio,
something like
```
struct dm_poll_instance {
...
struct list_head cookies;
};
```
We can transfer this dm_poll_instance between split bios by
bio->bi_private, like
```
dm_submit_bio(...) {
struct dm_poll_instance *ins;
if (bio->bi_private)
ins = bio->bi_private;
else {
ins = alloc_poll_instance();
bio->bi_private = ins;
}
...
}
```
--
Jeffle
Thanks
More information about the dm-devel
mailing list