From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: paulmck@linux.vnet.ibm.com
Cc: Nathan Zimmer <nzimmer@sgi.com>,
"viresh.kumar@linaro.org" <viresh.kumar@linaro.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"cpufreq@vger.kernel.org" <cpufreq@vger.kernel.org>
Subject: Re: [PATCH v2 linux-next 2/2] cpufreq: Convert the cpufreq_driver_lock to use the rcu
Date: Wed, 13 Feb 2013 14:20:35 +0100 [thread overview]
Message-ID: <1651157.ApO0q9O4LF@vostro.rjw.lan> (raw)
In-Reply-To: <20130212155954.GP2666@linux.vnet.ibm.com>
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@sgi.com>
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.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@vger.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.
next prev parent reply other threads:[~2013-02-13 13:14 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-04 22:45 [PATCH 0/2] cpufreq: cpufreq_driver_lock is hot on large systems Nathan Zimmer
2013-02-04 22:45 ` [PATCH 1/2] cpufreq: Convert the cpufreq_driver_lock to a rwlock Nathan Zimmer
2013-02-05 8:11 ` Viresh Kumar
2013-02-04 22:45 ` [PATCH 2/2] cpufreq: Convert the cpufreq_driver_lock to use the rcu Nathan Zimmer
2013-02-05 1:07 ` [PATCH 0/2] cpufreq: cpufreq_driver_lock is hot on large systems Rafael J. Wysocki
2013-02-05 8:28 ` Viresh Kumar
2013-02-05 10:03 ` Rafael J. Wysocki
2013-02-05 9:58 ` Viresh Kumar
2013-02-05 10:13 ` Rafael J. Wysocki
2013-02-05 14:58 ` Nathan Zimmer
2013-02-05 22:00 ` Rafael J. Wysocki
2013-02-06 2:04 ` [PATCH v2 linux-next " Nathan Zimmer
2013-02-06 2:04 ` [PATCH v2 linux-next 1/2] cpufreq: Convert the cpufreq_driver_lock to a rwlock Nathan Zimmer
2013-02-06 2:47 ` Viresh Kumar
2013-02-06 2:04 ` [PATCH v2 linux-next 2/2] cpufreq: Convert the cpufreq_driver_lock to use the rcu Nathan Zimmer
2013-02-06 2:52 ` Viresh Kumar
2013-02-06 8:51 ` Viresh Kumar
2013-02-06 13:00 ` Rafael J. Wysocki
2013-02-07 23:29 ` Rafael J. Wysocki
2013-02-11 17:13 ` Nathan Zimmer
2013-02-11 19:36 ` Rafael J. Wysocki
2013-02-12 4:03 ` Nathan Zimmer
2013-02-12 15:59 ` Paul E. McKenney
2013-02-13 13:20 ` Rafael J. Wysocki [this message]
2013-02-20 23:56 ` [PATCH v3 0/2] cpufreq: cpufreq_driver_lock is hot on large systems Nathan Zimmer
2013-02-20 23:56 ` [PATCH v3 1/2] cpufreq: Convert the cpufreq_driver_lock to a rwlock Nathan Zimmer
2013-02-20 23:56 ` [PATCH v3 2/2] cpufreq: Convert the cpufreq_driver_lock to use the rcu Nathan Zimmer
2013-02-21 5:50 ` Viresh Kumar
2013-02-21 17:49 ` Nathan Zimmer
2013-02-22 16:24 ` [PATCH v4 0/2] cpufreq: cpufreq_driver_lock is hot on large systems Nathan Zimmer
2013-02-22 16:24 ` [PATCH v4 1/2] cpufreq: Convert the cpufreq_driver_lock to a rwlock Nathan Zimmer
2013-02-23 3:57 ` Viresh Kumar
2013-02-22 16:24 ` [PATCH v4 2/2] cpufreq: Convert the cpufreq_driver_lock to use the rcu Nathan Zimmer
2013-02-23 3:39 ` Viresh Kumar
2013-02-25 20:07 ` Nathan Zimmer
2013-03-11 23:23 ` [PATCH v4 0/2] cpufreq: cpufreq_driver_lock is hot on large systems Rafael J. Wysocki
2013-03-13 20:50 ` Nathan Zimmer
2013-04-01 15:33 ` [PATCH v5] cpufreq: split the cpufreq_driver_lock and use the rcu (was cpufreq: cpufreq_driver_lock is hot on large systems) Nathan Zimmer
2013-04-01 16:28 ` Viresh Kumar
2013-04-01 17:17 ` Nathan Zimmer
2013-04-01 20:11 ` [PATCH v6 0/2] cpufreq: cpufreq_driver_lock is hot on large systems Nathan Zimmer
2013-04-01 20:11 ` [PATCH v6 1/2] cpufreq: split the cpufreq_driver_lock and use the rcu Nathan Zimmer
2013-04-02 5:05 ` Viresh Kumar
2013-04-02 14:55 ` Nathan Zimmer
2013-04-02 14:59 ` Viresh Kumar
2013-04-02 15:40 ` Nathan Zimmer
2013-04-02 15:52 ` Viresh Kumar
2013-04-02 22:57 ` Rafael J. Wysocki
2013-04-03 5:25 ` Viresh Kumar
2013-04-01 20:11 ` [PATCH v6 2/2] cpufreq: covert the cpufreq_data_lock to a spinlock Nathan Zimmer
2013-04-01 20:41 ` Rafael J. Wysocki
2013-04-02 0:56 ` Nathan Zimmer
2013-04-02 5:04 ` Viresh Kumar
2013-04-02 12:48 ` Rafael J. Wysocki
2013-04-02 14:58 ` Nathan Zimmer
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=1651157.ApO0q9O4LF@vostro.rjw.lan \
--to=rjw@sisk.pl \
--cc=cpufreq@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nzimmer@sgi.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=viresh.kumar@linaro.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;
as well as URLs for NNTP newsgroup(s).