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: <0efbce2d-1f63-82a7-6479-d8ef062aa90d@kernel.dk>
Date:   Tue, 26 Oct 2021 08:47:55 -0600
From:   Jens Axboe <axboe@...nel.dk>
To:     Muchun Song <songmuchun@...edance.com>,
        Zqiang <qiang.zhang1211@...il.com>
Cc:     asml.silence@...il.com, io-uring@...r.kernel.org,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] io-wq: Remove unnecessary rcu_read_lock/unlock() in raw
 spinlock critical section

On 10/26/21 4:32 AM, Muchun Song wrote:
> On Tue, Oct 26, 2021 at 11:23 AM Zqiang <qiang.zhang1211@...il.com> wrote:
>>
>> Due to raw_spin_lock/unlock() contains preempt_disable/enable() action,
>> already regarded as RCU critical region, so remove unnecessary
>> rcu_read_lock/unlock().
>>
>> Signed-off-by: Zqiang <qiang.zhang1211@...il.com>
>> ---
>>  fs/io-wq.c | 2 --
>>  1 file changed, 2 deletions(-)
>>
>> diff --git a/fs/io-wq.c b/fs/io-wq.c
>> index cd88602e2e81..401be005d089 100644
>> --- a/fs/io-wq.c
>> +++ b/fs/io-wq.c
>> @@ -855,9 +855,7 @@ static void io_wqe_enqueue(struct io_wqe *wqe, struct io_wq_work *work)
>>         io_wqe_insert_work(wqe, work);
>>         clear_bit(IO_ACCT_STALLED_BIT, &acct->flags);
>>
>> -       rcu_read_lock();
> 
> Add a comment like:
> /* spin_lock can serve as an RCU read-side critical section. */

Note that it's a raw spinlock. Honestly I'd probably prefer if we just leave
it as-is. There are plans to improve the io-wq locking, and a rcu lock/unlock
is pretty cheap.

That said, if resend with a comment fully detailing why it's OK currently,
then I'd be fine with that as well.

-- 
Jens Axboe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ