On Tue, Mar 23, 2021 at 09:54:36AM -0700, Sagi Grimberg wrote: > > > > > +static void blk_bio_poll_post_submit(struct bio *bio, blk_qc_t cookie) > > > > +{ > > > > + bio->bi_iter.bi_private_data = cookie; > > > > +} > > > > + > > > > > > Hey Ming, thinking about nvme-mpath, I'm thinking that this should be > > > an exported function for failover. nvme-mpath updates bio.bi_dev > > > when re-submitting I/Os to an alternate path, so I'm thinking > > > that if this function is exported then nvme-mpath could do as little > > > as the below to allow polling? > > > > > > -- > > > diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c > > > index 92adebfaf86f..e562e296153b 100644 > > > --- a/drivers/nvme/host/multipath.c > > > +++ b/drivers/nvme/host/multipath.c > > > @@ -345,6 +345,7 @@ static void nvme_requeue_work(struct work_struct *work) > > > struct nvme_ns_head *head = > > > container_of(work, struct nvme_ns_head, requeue_work); > > > struct bio *bio, *next; > > > + blk_qc_t cookie; > > > > > > spin_lock_irq(&head->requeue_lock); > > > next = bio_list_get(&head->requeue_list); > > > @@ -359,7 +360,8 @@ static void nvme_requeue_work(struct work_struct *work) > > > * path. > > > */ > > > bio_set_dev(bio, head->disk->part0); > > > - submit_bio_noacct(bio); > > > + cookie = submit_bio_noacct(bio); > > > + blk_bio_poll_post_submit(bio, cookie); > > > } > > > } > > > -- > > > > > > I/O failover will create misalignment from the polling context cpu and > > > the submission cpu (running requeue_work), but I don't see if there is > > > something that would break here... > > > > I understand requeue shouldn't be one usual event, and I guess it is just > > fine to fallback to IRQ based mode? > > Well, when it will failover, it will probably be directed to the poll > queues. Maybe I'm missing something... In this patchset, because it isn't submitted directly from FS, there isn't one polling context associated with this bio, so its HIPRI flag will be cleared, then fallback to irq mode. > > > This patchset actually doesn't cover such bio submission from kernel context. > > What is the difference? So far upper layer(io_uring, or dio, ..) needs to get the returned cookie, then pass it to blk_poll(). For this case, the cookie can't be passed to FS caller of submit_bio(FS bio), so it can't be polled by in-tree's code. Thanks, Ming