From: Cong Wang <xiyou.wangcong@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: [PATCH 1/2] module: use rcu to protect module list read
Date: Sun, 11 Mar 2012 18:53:52 +0800 [thread overview]
Message-ID: <4F5C8440.7000907@gmail.com> (raw)
In-Reply-To: <1331393157.2453.15.camel@edumazet-laptop>
On 03/10/2012 11:25 PM, Eric Dumazet wrote:
> Le samedi 10 mars 2012 à 22:20 +0800, Cong Wang a écrit :
>> Now the read of module list is protected by preempt disable + *_rcu
>> list operations, this is odd, as RCU read lock should be able to
>> protect it directly. This patch makes the read of module list
>> protected by RCU read lock and the write still protected by
>> module_mutex.
>>
>
> Problem is that your patch does more than that.
>
> In set_all_modules_text_rw() and set_all_modules_text_ro() you removed
> the mutex in favor of rcu_read_lock()
Yeah, I was wrong, set_all_modules_text_rw() and
set_all_modules_text_ro() mean to block module add/del, it is correct to
use module_mutex.
>
> Also, module code uses synchronize_sched(), not synchronize_rcu()
Stupid me, I totally missed this, should use rcu_read_lock_sched()...
>
> Take a look at Documentation/RCU/whatisRCU.txt and see that
> preempt_disable() / preempt_enable() are documented as a right protect
> code, in line 333.
>
> You added races in /proc/modules as well.
Yeah, that list iteration is not protected by rcu yet.
>
> So I would say your patch is not needed at all : module code already
> uses RCU.
>
> What particular problem do you have with current code ?
preempt_disable() + list_*_rcu() looks a little weird for me,
rcu_read_lock_sched() + list_*_rcu() is better, although they are
functionally equal.
I will send out a new version.
Thanks for review!
next prev parent reply other threads:[~2012-03-11 10:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-10 14:20 [PATCH 1/2] module: use rcu to protect module list read Cong Wang
2012-03-10 14:20 ` [PATCH 2/2] module: avoid exporting module_mutex Cong Wang
2012-03-10 15:25 ` [PATCH 1/2] module: use rcu to protect module list read Eric Dumazet
2012-03-11 10:53 ` Cong Wang [this message]
2012-03-13 0:37 ` Rusty Russell
2012-03-13 10:09 ` Cong Wang
2012-03-13 0:32 ` Rusty Russell
2012-03-13 10:12 ` Cong Wang
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=4F5C8440.7000907@gmail.com \
--to=xiyou.wangcong@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=eric.dumazet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=rusty@rustcorp.com.au \
/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).