public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: Zwane Mwaikambo <zwane@arm.linux.org.uk>
Cc: linux-kernel@vger.kernel.org, dhowells@redhat.com,
	dipankar@in.ibm.com, ak@suse.de, akpm@osdl.org,
	maneesh@in.ibm.com
Subject: Re: [RFC,PATCH] RCU: clean up a few remaining synchronize_kernel() calls
Date: Tue, 28 Jun 2005 10:40:07 -0700	[thread overview]
Message-ID: <20050628174007.GH1294@us.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0506281055260.9135@montezuma.fsmlabs.com>

On Tue, Jun 28, 2005 at 11:15:55AM -0600, Zwane Mwaikambo wrote:
> On Tue, 28 Jun 2005, Paul E. McKenney wrote:
> > However, you do have a good point -- weakly ordered CPUs would need to
> > have an explicit memory barrier.  This might well already be taken care
> > of by the memory barriers in the locking primitives used by the up()
> > operation invoked at the end of oprofile_start(), but I did not check
> > all the possible ways that these functions can be called.
> 
> I agree, that usage looks safe.

Cool!

> > Given that set_nmi_callback isn't invoked all that often, seems like
> > it might be preferable to insert an smp_wmb() at the beginning of
> > set_nmi_callback(), so that it reads as follows:
> > 
> > 	void set_nmi_callback(nmi_callback_t callback)
> > 	{
> > 		smp_wmb();
> > 		nmi_callback = callback;
> > 	}
> > 
> > Thoughts?
> 
> Andrew (rightly) tends to howls whenever someone adds a memory barrier 
> without a comment ;) So if we were to make that change, how about the 
> following accompanying comment;
> 
> "smp_wmb ensures that all data dependencies for the callback are posted 
> and callback is ready for execution"

Actually, I was guilty of posting email to LKML before being fully
awake...  How about the following instead?

	void set_nmi_callback(nmi_callback_t callback)
	{
		rcu_assign_pointer(nmi_callback, callback);
	}

Similarly:

	void unset_nmi_callback(void)
	{
		rcu_assign_pointer(nmi_callback, dummy_nmi_callback);
	}

This, combined with the rcu_dereference() in do_nmi() seem to me to
make the usage a lot more clear.  If you agree, would you like to
submit the patches, or should I?

> Thanks for elaborating, the examples certainly do help clarify usage.

Glad they help, will clean them up (so that the examples use
rcu_dereference() and rcu_assign_pointer()) and submit them!

							Thanx, Paul

  reply	other threads:[~2005-06-28 17:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-18  0:20 [RFC,PATCH] RCU: clean up a few remaining synchronize_kernel() calls Paul E. McKenney
2005-06-19 17:53 ` Zwane Mwaikambo
2005-06-19 20:14   ` Paul E. McKenney
2005-06-20 11:58     ` Zwane Mwaikambo
2005-06-27  5:02   ` Paul E. McKenney
2005-06-28 14:22     ` Zwane Mwaikambo
2005-06-28 15:32       ` Paul E. McKenney
2005-06-28 17:15         ` Zwane Mwaikambo
2005-06-28 17:40           ` Paul E. McKenney [this message]
2005-06-28 18:02             ` Zwane Mwaikambo

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=20050628174007.GH1294@us.ibm.com \
    --to=paulmck@us.ibm.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maneesh@in.ibm.com \
    --cc=zwane@arm.linux.org.uk \
    /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