mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@ozlabs.org>
To: "Chen\, Dennis \(SRDC SW\)" <Dennis1.Chen@amd.com>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "Chen\, Dennis \(SRDC SW\)" <Dennis1.Chen@amd.com>
Subject: Re: [PATCH 1/2] Refine mutex and rcu method in module.c, kernel<3.2.9>
Date: Thu, 08 Mar 2012 19:48:06 +1030	[thread overview]
Message-ID: <87ipifwiwh.fsf@rustcorp.com.au> (raw)
In-Reply-To: <491D6B4EAD0A714894D8AD22F4BDE04303289D@SCYBEXDAG04.amd.com>

On Wed, 7 Mar 2012 14:51:06 +0000, "Chen, Dennis (SRDC SW)" <Dennis1.Chen@amd.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...

Cheers,
Rusty.
-- 
  How could I marry someone with more hair than me?  http://baldalex.org

  parent reply	other threads:[~2012-03-08  9:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-07 14:51 Chen, Dennis (SRDC SW)
2012-03-07 14:57 ` [PATCH 2/2] " Chen, Dennis (SRDC SW)
2012-03-07 16:48   ` Chen, Dennis (SRDC SW)
2012-03-10  3:44     ` Cong Wang
2012-03-07 15:37 ` [PATCH 1/2] " Cong Wang
2012-03-07 15:52   ` Chen, Dennis (SRDC SW)
2012-03-10  3:42     ` Cong Wang
2012-03-07 16:46 ` Chen, Dennis (SRDC SW)
2012-03-08  9:18 ` Rusty Russell [this message]
2012-03-08 12:18   ` Chen, Dennis (SRDC SW)
2012-03-08 16:13     ` Chen, Dennis (SRDC SW)
2012-03-10  4:26       ` Cong Wang
2012-03-11 14:56         ` Paul E. McKenney

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=87ipifwiwh.fsf@rustcorp.com.au \
    --to=rusty@ozlabs.org \
    --cc=Dennis1.Chen@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome