public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jeff Moyer <[email protected]>
To: Jens Axboe <[email protected]>
Cc: io-uring <[email protected]>, Stefan Metzmacher <[email protected]>
Subject: Re: [PATCH v2] io_uring: add support for probing opcodes
Date: Fri, 17 Jan 2020 12:15:44 -0500	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]> (Jens Axboe's message of "Thu, 16 Jan 2020 19:58:18 -0700")

Jens Axboe <[email protected]> writes:

> The application currently has no way of knowing if a given opcode is
> supported or not without having to try and issue one and see if we get
> -EINVAL or not. And even this approach is fraught with peril, as maybe
> we're getting -EINVAL due to some fields being missing, or maybe it's
> just not that easy to issue that particular command without doing some
> other leg work in terms of setup first.
>
> This adds IORING_REGISTER_PROBE, which fills in a structure with info
> on what it supported or not. This will work even with sparse opcode
> fields, which may happen in the future or even today if someone
> backports specific features to older kernels.

This looks pretty good to me.  You can call it with 0 args to get the
total number of ops, then allocate an array with that number and
re-issue the syscall.  I also like that you've allowed for backporting
subsets of functionality.

I have one question below:

> @@ -6632,6 +6674,12 @@ static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode,
>  			break;
>  		ret = io_eventfd_unregister(ctx);
>  		break;
> +	case IORING_REGISTER_PROBE:
> +		ret = -EINVAL;
> +		if (!arg || nr_args > 256)
> +			break;
> +		ret = io_probe(ctx, arg, nr_args);
> +		break;

Why 256?  If it's just arbitrary, please add a comment.

Otherwise looks good!

Reviewed-by: Jeff Moyer <[email protected]>


  parent reply	other threads:[~2020-01-17 17:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-17  2:58 [PATCH v2] io_uring: add support for probing opcodes Jens Axboe
2020-01-17  7:42 ` Mark Papadakis
2020-01-17 15:15   ` Jens Axboe
2020-01-17 17:20   ` Jeff Moyer
2020-01-17 17:15 ` Jeff Moyer [this message]
2020-01-17 17:36   ` Jens Axboe

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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