Re: Can srcu_read_lock() be called from interrupt context?

From: Paul E. McKenney
Date: Tue Nov 03 2015 - 04:55:50 EST


On Mon, Nov 02, 2015 at 05:56:56PM -0800, Yunhong Jiang wrote:
> Hi, Paul
> I have a question to the srcu_read_lock(). Can it be invoked on
> interrupt context? According to
> http://lxr.free-electrons.com/source/kernel/rcu/srcu.c#L292 it can only be
> called from process context, but according to
> http://lxr.free-electrons.com/source/include/linux/srcu.h#L213 seems it's ok
> from irq context only if it matches with the srcu_read_unlock. Can you
> please give some hints?

Adding Lai Jianshan for his thoughts.

I believe that srcu.h is correct, at least assuming that interrupts do
not nest too deeply. (If they were to nest four billion deep, then the
->seq[] counter could overflow, defeating the checks, but the CPU stack
would have overflowed long before.)

Lai, am I missing anything here?

Thanx, Paul

--
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/