io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Metzmacher <metze@samba.org>
To: Jens Axboe <axboe@kernel.dk>,
	Pavel Begunkov <asml.silence@gmail.com>,
	Jann Horn <jannh@google.com>
Cc: io-uring <io-uring@vger.kernel.org>,
	kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] io_uring: add support for IORING_OP_IOCTL
Date: Wed, 8 Jan 2020 14:26:46 +0100	[thread overview]
Message-ID: <d52435c0-54dc-0fbb-81b4-b2be0b834ffc@samba.org> (raw)
In-Reply-To: <1f995281-4a56-a7de-d20b-14b0f64536c0@kernel.dk>

Hi Jens,

> While the ioctl approach is tempting, for the use cases where it makes
> sense, I think we should just add a ioctl type opcode and have the
> sub-opcode be somewhere else in the sqe. Because I do think there's
> a large opportunity to expose a fast API that works with ioctl like
> mechanisms. If we have
> 
> IORING_OP_IOCTL
> 
> and set aside an sqe field for the per-driver (or per-user) and
> add a file_operations method for sending these to the fd, then we'll
> have a much better (and faster + async) API than ioctls. We could
> add fops->uring_issue() or something, and that passes the io_kiocb.
> When it completes, the ->io_uring_issue() posts a completion by
> calling io_uring_complete_req() or something.
> 
> Outside of the issues that Jann outlined, ioctls are also such a
> decade old mess that we have to do the -EAGAIN punt for all of them
> like you did in your patch. If it's opt-in like ->uring_issue(), then
> care could be taken to do this right and just have it return -EAGAIN
> if it does need async context.
> 
> ret = fops->uring_issue(req, force_nonblock);
> if (ret == -EAGAIN) {
> 	... usual punt ...
> }
> 
> I think working on this would be great, and some of the more performance
> sensitive ioctl cases should flock to it.

I could use also use a generic way for an async fd-based syscall.
I thought about using sendmsg() with special CMSG_ elements, but
currently it's not possible with IORING_OP_SENDMSG to do an async
io_kiocb based completion, using msg_iocb.

My use case would be samba triggering async sendfile-like io for
the SMB-Direct protocol, doing multiple async file io operations
followed by RDMA-WRITE operations as a single async syscall from userspace.

Thanks!
metze

      parent reply	other threads:[~2020-01-08 13:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-14 15:29 [RFC PATCH] io_uring: add support for IORING_OP_IOCTL Pavel Begunkov
2019-12-14 17:12 ` Jann Horn
2019-12-14 17:56   ` Pavel Begunkov
2019-12-14 18:52     ` Jens Axboe
2019-12-15 15:40       ` Pavel Begunkov
2020-01-08 13:26       ` Stefan Metzmacher [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d52435c0-54dc-0fbb-81b4-b2be0b834ffc@samba.org \
    --to=metze@samba.org \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).