From: Jens Axboe <[email protected]>
To: Jeff Moyer <[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 10:36:56 -0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 1/17/20 10:15 AM, Jeff Moyer wrote:
> 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.
Right, this is similar to how most hardware commands work when you don't
know what the max size would be. Since this is pretty small, I would
expect applications to just use 256 as the value and get all of them.
But if they want to probe and use that method, that'll work just fine.
> 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.
We can't have more than 256 opcodes, as it's a byte for the opcode.
> Otherwise looks good!
>
> Reviewed-by: Jeff Moyer <[email protected]>
Thanks!
--
Jens Axboe
prev parent reply other threads:[~2020-01-17 17:36 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
2020-01-17 17:36 ` Jens Axboe [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 \
[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