On Mon, 2009-04-06 at 22:55 +0200, Gregory Gas wrote:
> I can't solve the problem with that warning. I've read documentation
> but still don't know what's wrong.
> [ 1618.441861] WARNING:
> at /build/buildd/linux-2.6.27/kernel/softirq.c:136
> Generally, it helps if you look at that line in your kernel
> and post the context.
> Here is that context:
> static inline void _local_bh_enable_ip(unsigned long ip)
> WARN_ON_ONCE(in_irq() || irqs_disabled()); //<------
That's what I expected. Enabling softirqs ("bh" means bottom half, with
is a variety of softirq) with in a hardware IRQ is a priority inversion.
It allows execution of low priority code while the high priority code is
blocked. It's a sure way to a deadlock.
> You didn't give the function name, which could be useful to
> read the above stack trace.
> The name of this function is measure.
OK, I saw it in the stack trace, so it's called from the IRQ handler.
That should be avoided whenever possible.
> Try localizing errors by eliminating parts of the code or by
> adding printk statements between the lines.
> My function 'measure' (called every time when any frame received from
> the network) collects some statistics and send it periodically via
> netlink socket to the user space.
Sending data should be done by a separate thread that is not run in the
> I've noticed that warning occurs in line:
> netlink_unicast(NLnl_sk_, NLskb, mmm.pid, GFP_ATOMIC);
> after the function 'measure' is executed several times. At the first
> time the function is always executed properly and no warning occurs.
> When I eliminate this line from my code warning doesn't appear at any
It means you cannot do it in IRQ handlers. But you can schedule a task
in the IRQ handler, and that task will send the message.