From: Paul E. McKenney on 16 Apr 2010 09:50 On Fri, Apr 16, 2010 at 04:54:51PM +1000, Benjamin Herrenschmidt wrote: > On Thu, 2010-04-15 at 07:28 -0700, Paul E. McKenney wrote: > > > > Of course, with call_rcu_sched(), the corresponding RCU read-side > > critical > > sections are non-preemptible. Therefore, in CONFIG_PREEMPT_RT, these > > read-side critical sections must use raw spinlocks. > > > > Can the code in question accommodate these restrictions? > > What we protect against is always code that hard-disable IRQs (though > there seem to be a bug in the hugepages code there...). Would that > work ? From the perspective of call_rcu_sched() and synchronize_sched(), the following things mark RCU-sched read-side critical sections: 1. rcu_read_lock_sched() and rcu_read_unlock_sched(). 2. preempt_disable() and preempt_enable(), along with anything else that disables preemption. 3. local_bh_disable() and local_bh_enable(), along with anything else that disables bottom halves. 4. local_irq_disable() and local_irq_enable(), along wiht anything else that disables hardirqs. 5. Handlers for NMIs. So I believe that in this case call_rcu_sched() is your friend. ;-) Thanx, Paul -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Peter Zijlstra on 16 Apr 2010 10:00 On Thu, 2010-04-15 at 07:28 -0700, Paul E. McKenney wrote: > On Wed, Apr 14, 2010 at 03:51:50PM +0200, Peter Zijlstra wrote: > > On Mon, 2010-04-12 at 20:43 -0700, Paul E. McKenney wrote: > > > > So we might have to support the interrupt assumption, at least in some > > > > form, with those guys... > > > > > > One way to make the interrupt assumption official is to use > > > synchronize_sched() rather than synchronize_rcu(). > > > > Well, call_rcu_sched() then, because the current usage is to use > > call_rcu() to free the page directories. > > > > Paul, here is a call_rcu_sched() available in kernel/rcutree.c, but am I > > right in reading that code that that would not be available for > > preemptible RCU? > > Both call_rcu_sched() and call_rcu() are always there for you. ;-) > > o If CONFIG_TREE_RCU (or CONFIG_TINY_RCU), they both have the same > implementation. > > o If CONFIG_TREE_PREEMPT_RCU, call_rcu_sched() is preemptible and > call_rcu() is not. (The reverse I suspect?) > Of course, with call_rcu_sched(), the corresponding RCU read-side critical > sections are non-preemptible. Therefore, in CONFIG_PREEMPT_RT, these > read-side critical sections must use raw spinlocks. OK, so if we fully remove CONFIG_TREE_PREEMPT_RCU (defaulting to y), rename all the {call_rcu, rcu_read_lock, rcu_read_unlock, synchronize_rcu} functions to {*}_preempt and then add a new CONFIG_PREEMPT_RCU that simply maps {*} to either {*}_sched or {*}_preempt, we've basically got what I've been asking for for a while, no? > Can the code in question accommodate these restrictions? Yes, that should do just fine I think. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Paul E. McKenney on 16 Apr 2010 10:20 On Fri, Apr 16, 2010 at 03:51:21PM +0200, Peter Zijlstra wrote: > On Thu, 2010-04-15 at 07:28 -0700, Paul E. McKenney wrote: > > On Wed, Apr 14, 2010 at 03:51:50PM +0200, Peter Zijlstra wrote: > > > On Mon, 2010-04-12 at 20:43 -0700, Paul E. McKenney wrote: > > > > > So we might have to support the interrupt assumption, at least in some > > > > > form, with those guys... > > > > > > > > One way to make the interrupt assumption official is to use > > > > synchronize_sched() rather than synchronize_rcu(). > > > > > > Well, call_rcu_sched() then, because the current usage is to use > > > call_rcu() to free the page directories. > > > > > > Paul, here is a call_rcu_sched() available in kernel/rcutree.c, but am I > > > right in reading that code that that would not be available for > > > preemptible RCU? > > > > Both call_rcu_sched() and call_rcu() are always there for you. ;-) > > > > o If CONFIG_TREE_RCU (or CONFIG_TINY_RCU), they both have the same > > implementation. > > > > o If CONFIG_TREE_PREEMPT_RCU, call_rcu_sched() is preemptible and > > call_rcu() is not. > > (The reverse I suspect?) Indeed: If CONFIG_TREE_PREEMPT_RCU, call_rcu() is preemptible and call_rcu_sched() is not. > > Of course, with call_rcu_sched(), the corresponding RCU read-side critical > > sections are non-preemptible. Therefore, in CONFIG_PREEMPT_RT, these > > read-side critical sections must use raw spinlocks. > > OK, so if we fully remove CONFIG_TREE_PREEMPT_RCU (defaulting to y), > rename all the {call_rcu, rcu_read_lock, rcu_read_unlock, > synchronize_rcu} functions to {*}_preempt and then add a new > CONFIG_PREEMPT_RCU that simply maps {*} to either {*}_sched or > {*}_preempt, we've basically got what I've been asking for for a while, > no? What would rcu_read_lock_preempt() do in a !CONFIG_PREEMPT kernel? > > Can the code in question accommodate these restrictions? > > Yes, that should do just fine I think. Cool!!! Thanx, Paul -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Peter Zijlstra on 16 Apr 2010 10:30 On Fri, 2010-04-16 at 07:17 -0700, Paul E. McKenney wrote: > > > Of course, with call_rcu_sched(), the corresponding RCU read-side critical > > > sections are non-preemptible. Therefore, in CONFIG_PREEMPT_RT, these > > > read-side critical sections must use raw spinlocks. > > > > OK, so if we fully remove CONFIG_TREE_PREEMPT_RCU (defaulting to y), > > rename all the {call_rcu, rcu_read_lock, rcu_read_unlock, > > synchronize_rcu} functions to {*}_preempt and then add a new > > CONFIG_PREEMPT_RCU that simply maps {*} to either {*}_sched or > > {*}_preempt, we've basically got what I've been asking for for a while, > > no? > > What would rcu_read_lock_preempt() do in a !CONFIG_PREEMPT kernel? Same as for a preempt one, since you'd have to be able to schedule() while holding it to be able to do things like mutex_lock(). -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Paul E. McKenney on 16 Apr 2010 10:40 On Fri, Apr 16, 2010 at 04:23:39PM +0200, Peter Zijlstra wrote: > On Fri, 2010-04-16 at 07:17 -0700, Paul E. McKenney wrote: > > > > > Of course, with call_rcu_sched(), the corresponding RCU read-side critical > > > > sections are non-preemptible. Therefore, in CONFIG_PREEMPT_RT, these > > > > read-side critical sections must use raw spinlocks. > > > > > > OK, so if we fully remove CONFIG_TREE_PREEMPT_RCU (defaulting to y), > > > rename all the {call_rcu, rcu_read_lock, rcu_read_unlock, > > > synchronize_rcu} functions to {*}_preempt and then add a new > > > CONFIG_PREEMPT_RCU that simply maps {*} to either {*}_sched or > > > {*}_preempt, we've basically got what I've been asking for for a while, > > > no? > > > > What would rcu_read_lock_preempt() do in a !CONFIG_PREEMPT kernel? > > Same as for a preempt one, since you'd have to be able to schedule() > while holding it to be able to do things like mutex_lock(). So what you really want is something like rcu_read_lock_sleep() rather than rcu_read_lock_preempt(), right? The point is that you want to do more than merely preempt, given that it is legal to do general blocking while holding a mutex, correct? Thanx, Paul -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: 2.6.34-rc3-git8: Reported regressions 2.6.32 -> 2.6.33 Next: mm: Preemptible mmu_gather |