lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3d59d0ed-50c0-2308-7b6d-c3f5d4459638@gmail.com>
Date:   Tue, 17 Dec 2019 17:16:43 +0300
From:   Pavel Begunkov <asml.silence@...il.com>
To:     Dmitry Dolgov <9erthalion6@...il.com>
Cc:     Jens Axboe <axboe@...nel.dk>, io-uring@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] io_uring: move *queue_link_head() from common path

On 12/17/2019 5:00 PM, Dmitry Dolgov wrote:
>> On Tue, Dec 17, 2019 at 02:22:09AM +0300, Pavel Begunkov wrote:
>>
>> Move io_queue_link_head() to links handling code in io_submit_sqe(),
>> so it wouldn't need extra checks and would have better data locality.
>>
>> ---
>>  fs/io_uring.c | 32 ++++++++++++++------------------
>>  1 file changed, 14 insertions(+), 18 deletions(-)
>>
>> diff --git a/fs/io_uring.c b/fs/io_uring.c
>> index bac9e711e38d..a880ed1409cb 100644
>> --- a/fs/io_uring.c
>> +++ b/fs/io_uring.c
>> @@ -3373,13 +3373,15 @@ static bool io_submit_sqe(struct io_kiocb *req, struct io_submit_state *state,
>>  			  struct io_kiocb **link)
>>  {
>>  	struct io_ring_ctx *ctx = req->ctx;
>> +	unsigned int sqe_flags;
>>  	int ret;
>>
>> +	sqe_flags = READ_ONCE(req->sqe->flags);
> 
> Just out of curiosity, why READ_ONCE it necessary here? I though, that
> since io_submit_sqes happens within a uring_lock, it's already
> protected. Do I miss something?
> 
SQEs are rw-shared with the userspace, that's it. Probably, there are
more places where proper READ_ONCE() annotations have been lost.

>> @@ -3421,9 +3423,15 @@ static bool io_submit_sqe(struct io_kiocb *req, struct io_submit_state *state,
>>  		}
>>  		trace_io_uring_link(ctx, req, head);
>>  		list_add_tail(&req->link_list, &head->link_list);
>> -	} else if (req->sqe->flags & (IOSQE_IO_LINK|IOSQE_IO_HARDLINK)) {
>> +
>> +		/* last request of a link, enqueue the link */
>> +		if (!(sqe_flags & IOSQE_IO_LINK)) {
> 
> Yes, as you mentioned in the previous email, it seems correct that if
> IOSQE_IO_HARDLINK imply IOSQE_IO_LINK, then here we need to check both.
> 
>> +			io_queue_link_head(head);
>> +			*link = NULL;
>> +		}
>> +	} else if (sqe_flags & (IOSQE_IO_LINK|IOSQE_IO_HARDLINK)) {

-- 
Pavel Begunkov

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ