Re: [PATCH 14/17] io_uring: add polling support for uring-cmd

Kanchan Joshi
2022-03-14T10:16:48Z

On Fri, Mar 11, 2022 at 12:20 PM Christoph Hellwig <hch@lst.de> wrote:
>
> On Tue, Mar 08, 2022 at 08:51:02PM +0530, Kanchan Joshi wrote:
> > + if (req->opcode == IORING_OP_URING_CMD ||
> > + req->opcode == IORING_OP_URING_CMD_FIXED) {
> > + /* uring_cmd structure does not contain kiocb struct */
> > + struct kiocb kiocb_uring_cmd;
> > +
> > + kiocb_uring_cmd.private = req->uring_cmd.bio;
> > + kiocb_uring_cmd.ki_filp = req->uring_cmd.file;
> > + ret = req->uring_cmd.file->f_op->iopoll(&kiocb_uring_cmd,
> > + &iob, poll_flags);
> > + } else {
> > + ret = kiocb->ki_filp->f_op->iopoll(kiocb, &iob,
> > + poll_flags);
> > + }
>
> This is just completely broken. You absolutely do need the iocb
> in struct uring_cmd for ->iopoll to work.

But, after you did bio based polling, we need just the bio to poll.
iocb is a big structure (48 bytes), and if we try to place it in
struct io_uring_cmd, we will just blow up the cacheline in io_uring
(first one in io_kiocb).
So we just store that bio pointer in io_uring_cmd on submission
(please see patch 15).
And here on completion we pick that bio, and put that into this local
iocb, simply because ->iopoll needs it.
Do you see I am still missing anything here?

--
Kanchan