io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Metzmacher <metze@samba.org>
To: Jens Axboe <axboe@kernel.dk>, io-uring@vger.kernel.org
Subject: Re: [PATCH v1] io_uring_cqe_get_data() only requires a const struct io_uring_cqe *cqe
Date: Thu, 6 Feb 2020 18:05:00 +0100	[thread overview]
Message-ID: <1c61d1da-9c1e-2d57-81da-f251d8e1992a@samba.org> (raw)
In-Reply-To: <95e6c04d-e66f-06f8-3a04-ac59b35c2ac7@kernel.dk>


[-- Attachment #1.1: Type: text/plain, Size: 4370 bytes --]

Am 06.02.20 um 17:42 schrieb Jens Axboe:
> On 2/6/20 9:37 AM, Stefan Metzmacher wrote:
>> Am 06.02.20 um 17:04 schrieb Jens Axboe:
>>> On 2/6/20 9:02 AM, Stefan Metzmacher wrote:
>>>> Signed-off-by: Stefan Metzmacher <metze@samba.org>
>>>> ---
>>>>  src/include/liburing.h | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/src/include/liburing.h b/src/include/liburing.h
>>>> index faed2e7..44f18fd 100644
>>>> --- a/src/include/liburing.h
>>>> +++ b/src/include/liburing.h
>>>> @@ -179,7 +179,7 @@ static inline void io_uring_sqe_set_data(struct io_uring_sqe *sqe, void *data)
>>>>  	sqe->user_data = (unsigned long) data;
>>>>  }
>>>>  
>>>> -static inline void *io_uring_cqe_get_data(struct io_uring_cqe *cqe)
>>>> +static inline void *io_uring_cqe_get_data(const struct io_uring_cqe *cqe)
>>>>  {
>>>>  	return (void *) (uintptr_t) cqe->user_data;
>>>>  }
>>>
>>> Applied, thanks.
>>
>> Thanks!
>>
>>> Unrelated to this patch, but I'd like to release a 0.4 sooner rather
>>> than later.
>>
>> Funny, I thought about that today:-)
>> I prepared debian packaging for liburing-0.4 I'll send the patches soon.
> 
> Great!
> 
>> While doing that I found the following incompatible change against
>> liburing-0.3:
>>
>>  static inline void io_uring_prep_files_update(struct io_uring_sqe *sqe,
>> -                                             int *fds, unsigned nr_fds)
>> +                                             int *fds, unsigned nr_fds,
>> +                                             int offset)
>>
>> I'm not sure if we should do something about that.
> 
> Hmm, that wasn't on purpose. But for this specific case, I think we can
> just pretend that never happened.

Ok.

>> It's also strange that in src/liburing.map LIBURING_0.3 doesn't
>> inherit LIBURING_0.2. There's not a single symbol with @LIBURING_0.3.
>> Also io_uring_{setup,enter,register} are still
>> listed under LIBURING_0.1, but they're not in the library anymore.
> 
> That seems like a bug, I'd happily take a patch for that...

I'm not sure how what to change, so I'll just leave it for now.

>>> Let me know if you see any immediate work that needs doing
>>> before that happens.
>>
>> I had the idea to have a simple version of fd compounding.
>> We already have IORING_OP_FILES_UPDATE in order to update
>> specific indexes in the files array.
>> I'm wondering if we could have specify an index where
>> IORING_OP_ACCEPT, IORING_OP_OPENAT and IORING_OP_OPENAT2
>> could store the generated fd into the fixed array.
>> The index 0 is not valid, correct? So we can have it
>> without a flag similar to the personality, and for
>> all of these buf_index is not used.
> 
> Just to make sure I'm undestanding your proposal, you want the result
> from those fd instantiating calls to be added to the array of registered
> files, instead of having the application do that?

Yes.

> If so, I think this is another case where the BPF driven links would be useful, as we could
> easily do it through that with an IORING_OP_FILES_UPDATE linked to
> either one of those commands.

Sure, it's just hard to imagine how to do BPF without it being there and
a real world examples...

> index 0 is valid, so we can't use that trick.

Ok :-)

>> While researching that I noticed that IOSQE_FIXED_FILE
>> seems to be ignored for some new commands, I think that
>> all commands with on input fd, should be able to use that flag.
>> Can this be fixed before 5.6 final?
> 
> Do you have specifics? Generally the file grabbing happens as part of
> request prep, and the individual opcodes should not need to bother with
> it.

io_statx_prep():
io_openat_prep():
io_openat2_prep():

  req->open.dfd = READ_ONCE(sqe->fd);


io_statx():
  ret = filename_lookup(ctx->dfd, ctx->filename, lookup_flags...

io_openat2():

  file = do_filp_open(req->open.dfd, req->open.filename, &op);

io_close_prep(): has this to make it clear that IOSQE_FIXED_FILE is not
supported, I guess because FILE_UPDATE with -1 needs to be used instead?

        if (sqe->flags & IOSQE_FIXED_FILE)
                return -EINVAL;

        req->close.fd = READ_ONCE(sqe->fd);


I guess at least we need if (sqe->flags & IOSQE_FIXED_FILE) in all
cases, if we can't just fix it.

metze


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-02-06 17:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 16:02 [PATCH v1] io_uring_cqe_get_data() only requires a const struct io_uring_cqe *cqe Stefan Metzmacher
2020-02-06 16:04 ` Jens Axboe
2020-02-06 16:37   ` Stefan Metzmacher
2020-02-06 16:42     ` Jens Axboe
2020-02-06 17:05       ` Stefan Metzmacher [this message]
2020-02-06 19:13         ` Jens Axboe
2020-02-07 23:45   ` Stefan Metzmacher
2020-02-08 19:53     ` 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 \
    --in-reply-to=1c61d1da-9c1e-2d57-81da-f251d8e1992a@samba.org \
    --to=metze@samba.org \
    --cc=axboe@kernel.dk \
    --cc=io-uring@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).