lkml.org 
[lkml]   [2005]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC,PATCH] RCU: clean up a few remaining synchronize_kernel() calls
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-06-28 19:43    [W:0.059 / U:1.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site