[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1651157.ApO0q9O4LF@vostro.rjw.lan>
Date: Wed, 13 Feb 2013 14:20:35 +0100
From: "Rafael J. Wysocki" <rjw@...k.pl>
To: paulmck@...ux.vnet.ibm.com
Cc: Nathan Zimmer <nzimmer@....com>,
"viresh.kumar@...aro.org" <viresh.kumar@...aro.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
"cpufreq@...r.kernel.org" <cpufreq@...r.kernel.org>
Subject: Re: [PATCH v2 linux-next 2/2] cpufreq: Convert the cpufreq_driver_lock to use the rcu
On Tuesday, February 12, 2013 07:59:54 AM Paul E. McKenney wrote:
> On Mon, Feb 11, 2013 at 08:36:17PM +0100, Rafael J. Wysocki wrote:
> > On Monday, February 11, 2013 05:13:30 PM Nathan Zimmer wrote:
> > > There are some spots that I need to give a much deeper review, cpufreq_register_driver for example.
> > >
> > > But I believe
> > > > @@ -196,7 +195,7 @@ static void __cpufreq_cpu_put(struct cpufreq_policy *data, bool sysfs)
> > > > {
> > > > if (!sysfs)
> > > > kobject_put(&data->kobj);
> > > > - module_put(cpufreq_driver->owner);
> > > > + module_put(rcu_dereference(cpufreq_driver)->owner);
> > > > }
> > > would be ok. In the documentation whatisRCU.txt they give a very similar example.
> >
> > Well, the very same document states the following:
> >
> > Note that the value returned by rcu_dereference() is valid
> > only within the enclosing RCU read-side critical section.
>
> Ah, there is a code sample in that document showing a bug. I added
> comments to the code sample making it clear even to someone skimming
> the document that the code is buggy.
>
> Thanx, Paul
> ------------------------------------------------------------------------
>
> rcu: Make bugginess of code sample more evident
>
> One of the code samples in whatisRCU.txt shows a bug, but someone scanning
> the document quickly might mistake it for a valid use of RCU. Add some
> screaming comments to help keep speed-readers on track.
>
> Reported-by: Nathan Zimmer <nzimmer@....com>
> Signed-off-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> diff --git a/Documentation/RCU/whatisRCU.txt b/Documentation/RCU/whatisRCU.txt
> index 0cc7820..10df0b8 100644
> --- a/Documentation/RCU/whatisRCU.txt
> +++ b/Documentation/RCU/whatisRCU.txt
> @@ -265,9 +265,9 @@ rcu_dereference()
> rcu_read_lock();
> p = rcu_dereference(head.next);
> rcu_read_unlock();
> - x = p->address;
> + x = p->address; /* BUG!!! */
> rcu_read_lock();
> - y = p->data;
> + y = p->data; /* BUG!!! */
> rcu_read_unlock();
>
> Holding a reference from one RCU read-side critical section
>
> --
> To unsubscribe from this list: send the line "unsubscribe cpufreq" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
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