[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <491D6B4EAD0A714894D8AD22F4BDE043032A1A@SCYBEXDAG04.amd.com>
Date: Thu, 8 Mar 2012 12:18:19 +0000
From: "Chen, Dennis (SRDC SW)" <Dennis1.Chen@....com>
To: Rusty Russell <rusty@...abs.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: "Chen, Dennis (SRDC SW)" <Dennis1.Chen@....com>
Subject: RE: [PATCH 1/2] Refine mutex and rcu method in module.c,
kernel<3.2.9>
From: Rusty Russell [mailto:rusty@...abs.org]
Sent: Thursday, March 08, 2012 5:18 PM
To: Chen, Dennis (SRDC SW); linux-kernel@...r.kernel.org
Cc: Chen, Dennis (SRDC SW)
Subject: Re: [PATCH 1/2] Refine mutex and rcu method in module.c, kernel<3.2.9>
On Wed, 7 Mar 2012 14:51:06 +0000, "Chen, Dennis (SRDC SW)" <Dennis1.Chen@....com> wrote:
> 1. Narrow down the granularity of mutex_lock/ mutex_unlock
> 2. Replace some unnecessary mutex_lock/mutex_unlock pairs with RCU
> 3. Refine the consistent calling style of RCU functioan
Hi Dennis,
This follows a logical evolution, where we wean off the mutex,
but AFAICT this is lost in the noise. Taking the mutex might be naive,
but adding or removing a module is the slow path. Or am I missing
something?
> -
> - /* Now sew it into the lists so we can get lockdep and oops
> - * info during argument parsing. No one should access us, since
> - * strong_try_module_get() will fail.
> - * lockdep/oops can run asynchronous, so use the RCU list insertion
> - * function to insert in a way safe to concurrent readers.
> - * The mutex protects against concurrent writers.
> - */
> - mutex_lock(&module_mutex);
> +
> + /* Concurrent writers for the global modules list are protected by RCU*/
> if (find_module(mod->name)) {
> err = -EEXIST;
> goto unlock;
> }
RCU does not protect concurrent writers:
> -
> +
> /* This has to be done once we're sure module name is unique. */
> dynamic_debug_setup(info.debug, info.num_debug);
Now this is racy...
======================================================================================
Hi Rusty,
I known RCU doesn't protect concurrent writers, so all the writers for the global modules list has been
protected by the original module_mutex in the 2-patch, I just make the scope of module_mutex become smaller
as it can, for example, dynamic_debug_setup doesn't touch modules, so it should not be in the protection of
module_mutex.
I am a person like to see a perfect world, especially in the kernel space:) Maybe I can write a test case
to trigger something you don't expect to see while the original codes will...let's think about it
BRs,
Dennis
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists