core kernel fixes
Linus,
Please pull the latest core-fixes-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git core-fixes-for-linus
Thanks,
Ingo
------------------>
Eric Dumazet (1):
rcu: rcu_read_lock_bh_held(): disabling irqs also disables bh
Heiko Carstens (1):
generic-ipi: Fix deadlock in __smp_call_function_single
include/linux/rcupdate.h | 2 +- kernel/smp.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-)
include/linux/rcupdate.h +1 -1
@@ -454,7 +454,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)* Makes rcu_dereference_check() do the dirty work. */ #define rcu_dereference_bh (p) \ - rcu_dereference_check(p, rcu_read_lock_bh_held()) + rcu_dereference_check(p, rcu_read_lock_bh_held() || irqs_disabled())/** * rcu_dereference_sched - fetch RCU-protected pointer, checking for RCU-sched
kernel/smp.c +14 -3
@@ -365,9 +365,10 @@ call:EXPORT_SYMBOL_GPL (smp_call_function_any);/** -* __smp_call_function_single(): Run a function on another CPU +* __smp_call_function_single(): Run a function on a specific CPU * @cpu: The CPU to run on. * @data: Pre-allocated and setup data structure +* @wait: If true, wait until function has completed on specified CPU. * * Like smp_call_function_single(), but allow caller to pass in a * pre-allocated data structure. Useful for embedding @data inside
@@ -376,8 +377,10 @@ EXPORT_SYMBOL_GPL(smp_call_function_any);void __smp_call_function_single (int cpu,struct call_single_data *data,int wait) { -csd_lock (data); +unsigned int this_cpu; +unsigned long flags; + this_cpu =get_cpu ();/* * Can deadlock when called with interrupts disabled. * We allow cpu's that are not yet online though, as no one else can
@@ -387,7 +390,15 @@ void __smp_call_function_single(int cpu, struct call_single_data *data,WARN_ON_ONCE (cpu_online (smp_processor_id ()) && wait &&irqs_disabled () && !oops_in_progress); -generic_exec_single (cpu, data, wait); +if (cpu == this_cpu) { +local_irq_save (flags); + data->func (data->info); +local_irq_restore (flags); + }else { +csd_lock (data); +generic_exec_single (cpu, data, wait); + } +put_cpu (); }/**
Quoted 3 lines · Ingo Molnar
#define
rcu_dereference_bh(p)\
-rcu_dereference_check(p, rcu_read_lock_bh_held())
+rcu_dereference_check(p, rcu_read_lock_bh_held() || irqs_disabled())
Wouldn't that irqs_disabled() check have made more sense inside rcu_read_lock_bh_held()?
That's the function that is _supposed_ to check whether bottom halves are disabled, no? So why add a workaround for that function being buggy/incomplete in one place that uses it?
Linus
Quoted 11 lines · Linus Torvalds
Quoted 3 lines · Ingo Molnar
#define
rcu_dereference_bh(p)\
-rcu_dereference_check(p, rcu_read_lock_bh_held())
+rcu_dereference_check(p, rcu_read_lock_bh_held() || irqs_disabled())Wouldn't that
irqs_disabled()check have made more sense insidercu_read_lock_bh_held()?That's the function that is _supposed_ to check whether bottom halves are disabled, no? So why add a workaround for that function being buggy/incomplete in one place that uses it?
Good point!!! If the following diff looks good to you, I will get it tested and pushed.
Thanx, Paul
------------------------------------------------------------------------
kernel/rcupdate.c +1 -1
@@ -86,7 +86,7 @@ int rcu_read_lock_bh_held(void) {if (!debug_lockdep_rcu_enabled ())return 1 ; -return in_softirq (); +return in_softirq () ||irqs_disabled (); }EXPORT_SYMBOL_GPL (rcu_read_lock_bh_held);
Quoted 3 lines · Paul E. McKenney
Good point!!! If the following diff looks good to you, I will get it tested and pushed.
Looks good. Except since I pulled the thing despite my complaint, you'll also need to undo the extra irqs_disabled() test.
Linus
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Paul E. McKenney
Good point!!! If the following diff looks good to you, I will get it tested and pushed.
Looks good. Except since I pulled the thing despite my complaint, you'll also need to undo the extra
irqs_disabled()test.
No problem, the diff I sent you combined two commits. ;-)
Thanx, Paul
Quoted 4 lines · Paul E. McKenney
Quoted 3 lines · Linus Torvalds
Quoted 1 line · Paul E. McKenney
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Good point!!! If the following diff looks good to you, I will get it tested and pushed.
Looks good. Except since I pulled the thing despite my complaint, you'll also need to undo the extra
irqs_disabled()test.No problem, the diff I sent you combined two commits. ;-)
Hi Paul & Linus
I originally considered adding the test in rcu_read_lock_bh_held() too, but thought (wrongly) :
"rcu_read_unlock_bh() doesnt block hard IRQ, thus
rcu_read_lock_bh_held() should not test hard irq."
I remember anyway my first patch was wrong, since I was not using irqs_disabled() but in_irq()
http://kerneltrap.org/mailarchive/linux-kernel/2010/9/22/4622784
Thanks !
Quoted 19 lines · Eric Dumazet
Quoted 4 lines · Paul E. McKenney
Quoted 3 lines · Linus Torvalds
Quoted 1 line · Paul E. McKenney
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Good point!!! If the following diff looks good to you, I will get it tested and pushed.
Looks good. Except since I pulled the thing despite my complaint, you'll also need to undo the extra
irqs_disabled()test.No problem, the diff I sent you combined two commits. ;-)
Hi Paul & Linus
I originally considered adding the test in
rcu_read_lock_bh_held()too, but thought (wrongly) :
Quoted 7 lines
"
rcu_read_unlock_bh()doesnt block hard IRQ, thus
rcu_read_lock_bh_held()should not test hard irq."I remember anyway my first patch was wrong, since I was not using
irqs_disabled()butin_irq()http://kerneltrap.org/mailarchive/linux-kernel/2010/9/22/4622784
Eric,
I believe that history shows that we were all groping around in the dark on this one... Me not least of all. ;-)
Not sure we are completely there yet, but we are at least in a feasible state.
Ingo, I have this queued up at:
git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-2.6-rcu.git rcu/urgent
It passes targeted testing. If Eric is OK with it, it is ready to be pulled. At least as soon as kernel.org gets it out to the mirrors. Commmit 773e3f9357.
Thanx, Paul
Quoted 7 lines · Paul E. McKenney
Ingo, I have this queued up at:
git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-2.6-rcu.gitrcu/urgentIt passes targeted testing. If Eric is OK with it, it is ready to be pulled. At least as soon as kernel.org gets it out to the mirrors. Commmit
773e3f9357.
Now that the original fix is in Linus's tree, can the followup commits wait until v2.6.37?
Linus, Paul, what's your preference?
Thanks,
Ingo
Quoted 7 lines · Ingo Molnar
Quoted 4 lines · Paul E. McKenney
Ingo, I have this queued up at:
git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-2.6-rcu.gitrcu/urgent
Quoted 8 lines
Quoted 3 lines
It passes targeted testing. If Eric is OK with it, it is ready to be pulled. At least as soon as kernel.org gets it out to the mirrors. Commmit
773e3f9357.Now that the original fix is in Linus's tree, can the followup commits wait until v2.6.37?
Linus, Paul, what's your preference?
I am fine either way.
Thanx, Paul
Quoted 3 lines
Thanks,
Ingo
Quoted 12 lines · Paul E. McKenney
Quoted 11 lines · Ingo Molnar
Quoted 7 lines · Paul E. McKenney
Ingo, I have this queued up at:
git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-2.6-rcu.gitrcu/urgentIt passes targeted testing. If Eric is OK with it, it is ready to be pulled. At least as soon as kernel.org gets it out to the mirrors. Commmit
773e3f9357.
Quoted 6 lines
Quoted 4 lines
Now that the original fix is in Linus's tree, can the followup commits wait until v2.6.37?
Linus, Paul, what's your preference?
I am fine either way.
Ok, Linus released -rc7 which is probably the last -rc so to reduce final-rc code flux i have pulled your fix into tip:core/rcu, for v2.6.37.
Thanks,
Ingo
Quoted 18 lines · Ingo Molnar
Quoted 15 lines · Paul E. McKenney
Quoted 14 lines · Ingo Molnar
Quoted 7 lines · Paul E. McKenney
Ingo, I have this queued up at:
git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-2.6-rcu.gitrcu/urgentIt passes targeted testing. If Eric is OK with it, it is ready to be pulled. At least as soon as kernel.org gets it out to the mirrors. Commmit
773e3f9357.Now that the original fix is in Linus's tree, can the followup commits wait until v2.6.37?
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Linus, Paul, what's your preference?
I am fine either way.
Ok, Linus released -rc7 which is probably the last -rc so to reduce final-rc code flux i have pulled your fix into tip:core/rcu, for v2.6.37.
Ah, good, thank you! I am rebasing on top of that. Here is hoping that this approach quiets down the conflict in -next as well. ;-)
Thanx, Paul