Re: [PATCH] rcu: Allow calls to rcu_exit_user_irq from nesting irqs

From: Frederic Weisbecker
Date: Sun Jun 10 2012 - 16:29:24 EST


On Sun, Jun 10, 2012 at 11:06:59AM -0700, Paul E. McKenney wrote:
> On Sun, Jun 10, 2012 at 12:55:54AM +0200, Frederic Weisbecker wrote:
> > void rcu_user_enter_irq(void)
> > {
> > @@ -478,12 +478,9 @@ void rcu_user_enter_irq(void)
> >
> > local_irq_save(flags);
> > rdtp = &__get_cpu_var(rcu_dynticks);
> > - /*
> > - * Ensure this irq is a non nesting one interrupting
> > - * a non-idle RCU state.
> > - */
> > - WARN_ON_ONCE(rdtp->dynticks_nesting != DYNTICK_TASK_EXIT_IDLE + 1);
> > - rdtp->dynticks_nesting = 1;
> > + /* Ensure we are interrupting a non-idle RCU state */
> > + WARN_ON_ONCE(!(rdtp->dynticks_nesting & DYNTICK_TASK_NEST_MASK));
> > + rdtp->dynticks_nesting -= DYNTICK_TASK_EXIT_IDLE;
>
> This will be broken on architectures that can fail to return from interrupts
> and exceptions and vice versa. The resulting value of rdtp->dynticks_nesting
> might well go negative, or might fail to reach zero when the outermost
> interrupt returns.
>
> One workaround would be to add up the relevant fields of preempt_count()
> and assign the result to rdtp->dynticks_nesting.

That's ok. I made rcu_user_enter_irq() to support nesting irqs in order to stay
consistant with the same change in rcu_user_exit_irq(). But this is not necessary.
rcu_user_enter_irq() itself is only called from the outermost irq.

Also there is a sanity check that ensures that in the current code in rcu/idle tree
so rcu_user_enter_irq() can stay as is there.

I'll resend the patch with only the change in rcu_user_exit_irq().

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/