From: Pavel Begunkov <[email protected]>
To: lizetao <[email protected]>
Cc: Anuj Gupta <[email protected]>,
Kanchan Joshi <[email protected]>,
"[email protected]" <[email protected]>
Subject: Re: [PATCH 4/4] io_uring/rw: pre-mapped rw attributes
Date: Mon, 6 Jan 2025 16:53:23 +0000 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 1/6/25 11:13, lizetao wrote:
...
>> /* sqe->attr_type_mask flags */
>> -#define IORING_RW_ATTR_FLAG_PI (1U << 0)
>> +#define IORING_RW_ATTR_FLAG_PI (1UL << 0)
>> +#define IORING_RW_ATTR_REGISTERED (1UL << 63)
> Why use (1UL << 63) instead of (1UL << 1) here?
They serve different purposes, think how you'd be iterating
more attribute types, calculating the total size, etc.
>> diff --git a/io_uring/rw.c b/io_uring/rw.c index dc1acaf95db1..b1db4595788b
>> 100644
>> --- a/io_uring/rw.c
>> +++ b/io_uring/rw.c
>> @@ -271,10 +271,17 @@ static int io_prep_rw_pi(struct io_kiocb *req, struct
>> io_rw *rw, int ddir,
>> size_t pi_len;
>> int ret;
>>
>> - if (copy_from_user(&__pi_attr, u64_to_user_ptr(attr_ptr),
>> - sizeof(pi_attr)))
>> - return -EFAULT;
>> - pi_attr = &__pi_attr;
>> + if (attr_type_mask & IORING_RW_ATTR_REGISTERED) {
>> + pi_attr = io_args_get_ptr(&req->ctx->sqe_args, attr_ptr,
>> + sizeof(pi_attr));
> Here pi_attr is just pointer, so maybe sizeof(__pi_attr) or sizeof(struct io_uring_attr_pi) will be better.
Good catch, and that's an issue from 3/4. As noted it's not even
tested and posted to discuss the API. I'd even prefer them to be
thrown away, and for Anuj / Kanchan to take over if that's
interesting.
--
Pavel Begunkov
prev parent reply other threads:[~2025-01-06 16:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-30 13:30 [RFC 0/4] pre-mapped rw attributes Pavel Begunkov
2024-12-30 13:30 ` [PATCH 1/4] io_uring: add structure for registered arguments Pavel Begunkov
2024-12-30 13:30 ` [PATCH 2/4] io_uring: add registered request arguments Pavel Begunkov
2025-01-06 11:33 ` lizetao
2025-01-06 16:40 ` Pavel Begunkov
2024-12-30 13:30 ` [PATCH 3/4] io_uring/rw: use READ_ONCE with rw attributes Pavel Begunkov
2024-12-30 13:30 ` [PATCH 4/4] io_uring/rw: pre-mapped " Pavel Begunkov
2025-01-06 11:13 ` lizetao
2025-01-06 16:53 ` Pavel Begunkov [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] \
[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