From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Christoph Lameter <clameter@sgi.com>,
Hugh Dickins <hugh@veritas.com>,
Andrea Arcangeli <andrea@qumranet.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [patch 1/9] EMM Notifier: The notifier calls
Date: Tue, 1 Apr 2008 14:38:11 -0700 [thread overview]
Message-ID: <20080401213811.GD8558@linux.vnet.ibm.com> (raw)
In-Reply-To: <1207084480.29991.2.camel@lappy>
On Tue, Apr 01, 2008 at 11:14:40PM +0200, Peter Zijlstra wrote:
> (Christoph, why are your CCs so often messed up?)
>
> On Tue, 2008-04-01 at 13:55 -0700, Christoph Lameter wrote:
> > plain text document attachment (emm_notifier)
>
> > +/* Register a notifier */
> > +void emm_notifier_register(struct emm_notifier *e, struct mm_struct *mm)
> > +{
> > + e->next = mm->emm_notifier;
> > + /*
> > + * The update to emm_notifier (e->next) must be visible
> > + * before the pointer becomes visible.
> > + * rcu_assign_pointer() does exactly what we need.
> > + */
> > + rcu_assign_pointer(mm->emm_notifier, e);
> > +}
> > +EXPORT_SYMBOL_GPL(emm_notifier_register);
> > +
> > +/* Perform a callback */
> > +int __emm_notify(struct mm_struct *mm, enum emm_operation op,
> > + unsigned long start, unsigned long end)
> > +{
> > + struct emm_notifier *e = rcu_dereference(mm)->emm_notifier;
> > + int x;
> > +
> > + while (e) {
> > +
> > + if (e->callback) {
> > + x = e->callback(e, mm, op, start, end);
> > + if (x)
> > + return x;
> > + }
> > + /*
> > + * emm_notifier contents (e) must be fetched after
> > + * the retrival of the pointer to the notifier.
> > + */
> > + e = rcu_dereference(e)->next;
> > + }
> > + return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(__emm_notify);
> > +#endif
>
> Those rcu_dereference()s are wrong. They should read:
>
> e = rcu_dereference(mm->emm_notifier);
>
> and
>
> e = rcu_dereference(e->next);
Peter has it right. You need to rcu_dereference() the same thing that
you rcu_assign_pointer() to.
Thanx, Paul
next prev parent reply other threads:[~2008-04-01 21:38 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-01 20:55 [patch 0/9] [RFC] EMM Notifier V2 Christoph Lameter
2008-04-01 20:55 ` [patch 1/9] EMM Notifier: The notifier calls Christoph Lameter
2008-04-01 21:14 ` Peter Zijlstra
2008-04-01 21:38 ` Paul E. McKenney [this message]
2008-04-02 17:44 ` Christoph Lameter
2008-04-02 18:43 ` EMM: Fix rcu handling and spelling Christoph Lameter
2008-04-02 19:02 ` Paul E. McKenney
2008-04-02 6:49 ` [patch 1/9] EMM Notifier: The notifier calls Andrea Arcangeli
2008-04-02 10:59 ` Robin Holt
2008-04-02 11:16 ` Andrea Arcangeli
2008-04-02 14:26 ` Robin Holt
2008-04-02 17:59 ` Christoph Lameter
2008-04-02 19:03 ` EMM: Fixup return value handling of emm_notify() Christoph Lameter
2008-04-02 21:25 ` Andrea Arcangeli
2008-04-02 21:33 ` Christoph Lameter
2008-04-03 10:40 ` Peter Zijlstra
2008-04-03 15:00 ` Andrea Arcangeli
2008-04-03 19:14 ` Christoph Lameter
2008-04-02 21:05 ` EMM: Require single threadedness for registration Christoph Lameter
2008-04-02 22:01 ` Andrea Arcangeli
2008-04-02 22:06 ` Christoph Lameter
2008-04-02 22:17 ` Andrea Arcangeli
2008-04-02 22:41 ` Christoph Lameter
2008-04-03 1:24 ` EMM: disable other notifiers before register and unregister Christoph Lameter
2008-04-03 10:40 ` Peter Zijlstra
2008-04-03 15:29 ` Andrea Arcangeli
2008-04-03 19:20 ` Christoph Lameter
2008-04-03 20:23 ` Christoph Lameter
2008-04-04 12:30 ` Andrea Arcangeli
2008-04-04 20:20 ` [PATCH] mmu notifier #v11 Andrea Arcangeli
2008-04-04 22:06 ` Christoph Lameter
2008-04-05 0:23 ` Andrea Arcangeli
2008-04-07 5:45 ` Christoph Lameter
2008-04-07 6:02 ` Andrea Arcangeli
2008-04-02 21:53 ` [patch 1/9] EMM Notifier: The notifier calls Andrea Arcangeli
2008-04-02 21:54 ` Christoph Lameter
2008-04-02 22:09 ` Andrea Arcangeli
2008-04-02 23:04 ` Christoph Lameter
2008-04-01 20:55 ` [patch 2/9] Move tlb flushing into free_pgtables Christoph Lameter
2008-04-01 20:55 ` [patch 3/9] Convert i_mmap_lock to i_mmap_sem Christoph Lameter
2008-04-01 20:55 ` [patch 4/9] Remove tlb pointer from the parameters of unmap vmas Christoph Lameter
2008-04-01 20:55 ` [patch 5/9] Convert anon_vma lock to rw_sem and refcount Christoph Lameter
2008-04-02 17:50 ` Andrea Arcangeli
2008-04-02 18:15 ` Christoph Lameter
2008-04-02 21:56 ` Andrea Arcangeli
2008-04-02 21:56 ` Christoph Lameter
2008-04-02 22:12 ` Andrea Arcangeli
2008-04-01 20:55 ` [patch 6/9] This patch exports zap_page_range as it is needed by XPMEM Christoph Lameter
2008-04-01 20:55 ` [patch 7/9] Locking rules for taking multiple mmap_sem locks Christoph Lameter
2008-04-01 20:55 ` [patch 8/9] XPMEM: The device driver Christoph Lameter
2008-04-01 20:55 ` [patch 9/9] XPMEM: Simple example Christoph Lameter
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=20080401213811.GD8558@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=andrea@qumranet.com \
--cc=clameter@sgi.com \
--cc=hugh@veritas.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;
as well as URLs for NNTP newsgroup(s).