* [PATCH] Add IORING_FEAT_FILES_SKIP feature flag
@ 2021-05-18 16:12 Drew DeVault
2021-05-20 13:32 ` Jens Axboe
0 siblings, 1 reply; 5+ messages in thread
From: Drew DeVault @ 2021-05-18 16:12 UTC (permalink / raw)
To: io-uring; +Cc: Drew DeVault, noah, Jens Axboe, Pavel Begunkov
This is aliased to IORING_FEAT_NATIVE_WORKERS, which was shipped in the
same kernel release. A separate flag is useful because the features are
unrelated, so user code testing for IORING_FEAT_NATIVE_WORKERS before
using FILES_SKIP is not very obvious in intent.
Signed-off-by: Drew DeVault <[email protected]>
---
man/io_uring_register.2 | 10 ++++++++--
src/include/liburing/io_uring.h | 1 +
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/man/io_uring_register.2 b/man/io_uring_register.2
index 5326a87..c71ce40 100644
--- a/man/io_uring_register.2
+++ b/man/io_uring_register.2
@@ -156,8 +156,14 @@ since 5.5.
File descriptors can be skipped if they are set to
.B IORING_REGISTER_FILES_SKIP.
Skipping an fd will not touch the file associated with the previous
-fd at that index. Available since 5.12.
-
+fd at that index. Available since 5.12. Availability of this feature is
+indicated by the presence of the
+.B IORING_FEAT_FILES_SKIP
+bit in the
+.I features
+field of the
+.I io_uring_params
+structure.
.TP
.B IORING_UNREGISTER_FILES
diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h
index 5a3cb90..091dcf7 100644
--- a/src/include/liburing/io_uring.h
+++ b/src/include/liburing/io_uring.h
@@ -285,6 +285,7 @@ struct io_uring_params {
#define IORING_FEAT_SQPOLL_NONFIXED (1U << 7)
#define IORING_FEAT_EXT_ARG (1U << 8)
#define IORING_FEAT_NATIVE_WORKERS (1U << 9)
+#define IORING_FEAT_FILES_SKIP IORING_FEAT_NATIVE_WORKERS
/*
* io_uring_register(2) opcodes and arguments
--
2.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Add IORING_FEAT_FILES_SKIP feature flag
2021-05-18 16:12 [PATCH] Add IORING_FEAT_FILES_SKIP feature flag Drew DeVault
@ 2021-05-20 13:32 ` Jens Axboe
2021-05-20 21:55 ` Drew DeVault
0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2021-05-20 13:32 UTC (permalink / raw)
To: Drew DeVault, io-uring; +Cc: noah, Pavel Begunkov
On 5/18/21 10:12 AM, Drew DeVault wrote:
> This is aliased to IORING_FEAT_NATIVE_WORKERS, which was shipped in the
> same kernel release. A separate flag is useful because the features are
> unrelated, so user code testing for IORING_FEAT_NATIVE_WORKERS before
> using FILES_SKIP is not very obvious in intent.
>
> Signed-off-by: Drew DeVault <[email protected]>
> ---
> man/io_uring_register.2 | 10 ++++++++--
> src/include/liburing/io_uring.h | 1 +
> 2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/man/io_uring_register.2 b/man/io_uring_register.2
> index 5326a87..c71ce40 100644
> --- a/man/io_uring_register.2
> +++ b/man/io_uring_register.2
> @@ -156,8 +156,14 @@ since 5.5.
> File descriptors can be skipped if they are set to
> .B IORING_REGISTER_FILES_SKIP.
> Skipping an fd will not touch the file associated with the previous
> -fd at that index. Available since 5.12.
> -
> +fd at that index. Available since 5.12. Availability of this feature is
> +indicated by the presence of the
> +.B IORING_FEAT_FILES_SKIP
> +bit in the
> +.I features
> +field of the
> +.I io_uring_params
> +structure.
>
> .TP
> .B IORING_UNREGISTER_FILES
> diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h
> index 5a3cb90..091dcf7 100644
> --- a/src/include/liburing/io_uring.h
> +++ b/src/include/liburing/io_uring.h
> @@ -285,6 +285,7 @@ struct io_uring_params {
> #define IORING_FEAT_SQPOLL_NONFIXED (1U << 7)
> #define IORING_FEAT_EXT_ARG (1U << 8)
> #define IORING_FEAT_NATIVE_WORKERS (1U << 9)
> +#define IORING_FEAT_FILES_SKIP IORING_FEAT_NATIVE_WORKERS
I don't think this is a great idea. It can be used as a "probably we have
this feature" in userspace, but I don't like aliasing on the kernel side.
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add IORING_FEAT_FILES_SKIP feature flag
2021-05-20 13:32 ` Jens Axboe
@ 2021-05-20 21:55 ` Drew DeVault
2021-05-20 22:54 ` Pavel Begunkov
0 siblings, 1 reply; 5+ messages in thread
From: Drew DeVault @ 2021-05-20 21:55 UTC (permalink / raw)
To: Jens Axboe, io-uring; +Cc: noah, Pavel Begunkov
On Thu May 20, 2021 at 9:32 AM EDT, Jens Axboe wrote:
> > diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h
> > index 5a3cb90..091dcf7 100644
> > --- a/src/include/liburing/io_uring.h
> > +++ b/src/include/liburing/io_uring.h
> > @@ -285,6 +285,7 @@ struct io_uring_params {
> > #define IORING_FEAT_SQPOLL_NONFIXED (1U << 7)
> > #define IORING_FEAT_EXT_ARG (1U << 8)
> > #define IORING_FEAT_NATIVE_WORKERS (1U << 9)
> > +#define IORING_FEAT_FILES_SKIP IORING_FEAT_NATIVE_WORKERS
>
> I don't think this is a great idea. It can be used as a "probably we
> have this feature" in userspace, but I don't like aliasing on the
> kernel side.
This patch is for liburing, following the feedback on the kernel patch
(which didn't alias, but regardless).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add IORING_FEAT_FILES_SKIP feature flag
2021-05-20 21:55 ` Drew DeVault
@ 2021-05-20 22:54 ` Pavel Begunkov
2021-05-20 23:09 ` Drew DeVault
0 siblings, 1 reply; 5+ messages in thread
From: Pavel Begunkov @ 2021-05-20 22:54 UTC (permalink / raw)
To: Drew DeVault, Jens Axboe, io-uring; +Cc: noah
On 5/20/21 10:55 PM, Drew DeVault wrote:
> On Thu May 20, 2021 at 9:32 AM EDT, Jens Axboe wrote:
>>> diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h
>>> index 5a3cb90..091dcf7 100644
>>> --- a/src/include/liburing/io_uring.h
>>> +++ b/src/include/liburing/io_uring.h
>>> @@ -285,6 +285,7 @@ struct io_uring_params {
>>> #define IORING_FEAT_SQPOLL_NONFIXED (1U << 7)
>>> #define IORING_FEAT_EXT_ARG (1U << 8)
>>> #define IORING_FEAT_NATIVE_WORKERS (1U << 9)
>>> +#define IORING_FEAT_FILES_SKIP IORING_FEAT_NATIVE_WORKERS
>>
>> I don't think this is a great idea. It can be used as a "probably we
>> have this feature" in userspace, but I don't like aliasing on the
>> kernel side.
>
> This patch is for liburing, following the feedback on the kernel patch
> (which didn't alias, but regardless).
This file is a copy (almost) of the kernel's uapi header, so better be
off this file and have naming that wouldn't alias with names in this
header.
I think that's the problem Jens mean. Jens, is it? And I do still
believe it's a better way to not have an itchy one release gap
between actual feature introduction and new feat flag.
--
Pavel Begunkov
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add IORING_FEAT_FILES_SKIP feature flag
2021-05-20 22:54 ` Pavel Begunkov
@ 2021-05-20 23:09 ` Drew DeVault
0 siblings, 0 replies; 5+ messages in thread
From: Drew DeVault @ 2021-05-20 23:09 UTC (permalink / raw)
To: Pavel Begunkov, Jens Axboe, io-uring; +Cc: noah
On Thu May 20, 2021 at 6:54 PM EDT, Pavel Begunkov wrote:
> On 5/20/21 10:55 PM, Drew DeVault wrote:
> > On Thu May 20, 2021 at 9:32 AM EDT, Jens Axboe wrote:
> >>> diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h
> >>> index 5a3cb90..091dcf7 100644
> >>> --- a/src/include/liburing/io_uring.h
> >>> +++ b/src/include/liburing/io_uring.h
> >>> @@ -285,6 +285,7 @@ struct io_uring_params {
> >>> #define IORING_FEAT_SQPOLL_NONFIXED (1U << 7)
> >>> #define IORING_FEAT_EXT_ARG (1U << 8)
> >>> #define IORING_FEAT_NATIVE_WORKERS (1U << 9)
> >>> +#define IORING_FEAT_FILES_SKIP IORING_FEAT_NATIVE_WORKERS
> >>
> >> I don't think this is a great idea. It can be used as a "probably we
> >> have this feature" in userspace, but I don't like aliasing on the
> >> kernel side.
> >
> > This patch is for liburing, following the feedback on the kernel patch
> > (which didn't alias, but regardless).
>
> This file is a copy (almost) of the kernel's uapi header, so better be
> off this file and have naming that wouldn't alias with names in this
> header.
>
> I think that's the problem Jens mean. Jens, is it? And I do still
> believe it's a better way to not have an itchy one release gap
> between actual feature introduction and new feat flag.
It does itch, but I don't think it's actually wrong, per-se. Unless we
expect features to be removed or optionally available, it might make
sense to have used an incrementing number rather than a bitfield.
What should userspace programs do if they're not sure if they can use
FILES_SKIP? What was the previous behavior if -2 is used? I'm guessing
it was EINVAL, EBADF, something like that.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-05-20 23:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-18 16:12 [PATCH] Add IORING_FEAT_FILES_SKIP feature flag Drew DeVault
2021-05-20 13:32 ` Jens Axboe
2021-05-20 21:55 ` Drew DeVault
2021-05-20 22:54 ` Pavel Begunkov
2021-05-20 23:09 ` Drew DeVault
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox