Prev: rcu: Fix holdoff for accelerated GPs for last non-dynticked CPU
Next: [PATCH 2/2] AIO: Change pr_debug statements to dprintk in fs/aio.c
From: Ingo Molnar on 16 Mar 2010 07:30 * Lai Jiangshan <laijs(a)cn.fujitsu.com> wrote: > It is documented that local_irq_disable() also delimits > RCU_SCHED read-site critical sections. > See the document of synchronize_sched() or > Documentation/RCU/whatisRCU.txt. > > So we have to test irqs_disabled() in rcu_read_lock_sched_held(). > Otherwise rcu-lockdep brings incorrect complaint. It would be useful to include the warning in question in the changelog - so that others who might be affected by it can see the fix and can track its progress. (and dont start a parallel effort debugging/reporting/fixing it) Thanks, Ingo -- 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: Lai Jiangshan on 16 Mar 2010 21:50
Paul E. McKenney wrote: > On Tue, Mar 16, 2010 at 07:09:21PM +0800, Lai Jiangshan wrote: >> It is documented that local_irq_disable() also delimits >> RCU_SCHED read-site critical sections. >> See the document of synchronize_sched() or >> Documentation/RCU/whatisRCU.txt. >> >> So we have to test irqs_disabled() in rcu_read_lock_sched_held(). >> Otherwise rcu-lockdep brings incorrect complaint. > > Interesting -- I was under the impression that preempt_count() covered > this as well, due to the following in include/linux/hardirq.h: > > #define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT) > #define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT) > #define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT) > #define NMI_MASK (__IRQ_MASK(NMI_BITS) << NMI_SHIFT) > > But irqs_disabled() does look to sample the actual interrupt hardware. > > So, if there are cases where RCU is used where the interrupt hardware > is disabled, but preempt_count() has not been updated, this patch is > the right thing to do. > > Thanx, Paul > local_irq_disable() does not touch preempt_count, it touchs a register of current CPU. The following quick test module is a case where RCU_SCHED is used where the interrupt hardware is disabled, but preempt_count() has not been updated, and it raises rcu-lockdep complaint. #include <linux/module.h> #include <linux/hardirq.h> #include <linux/rcupdate.h> void *test = &test; int test_init(void) { local_irq_disable(); printk(KERN_INFO "%p\n", rcu_dereference_sched(test)); local_irq_enable(); return 0; } void test_exit(void) {} module_init(test_init); module_exit(test_exit); MODULE_LICENSE("GPL"); -- 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/ |