Skip to contentSkip to conversation

alloc_skb called nonatomically from interrupt

DISCUSSION Daniel Ann 1 participant 1 message Apr 12, 2005

lore
Share & tools
lore

Daniel Ann

author
#0 lore raw

Hiya folks

I'm trying to get a feel of notifier_call_chain(), but with no luck. This is basically what I've done.

On 2.4.21, I've added dev_sample() function which I've declared and implemented in include/linux/netdevice.h and net/core/dev.c respectively.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
int dev_sample(struct net_device *dev)

{
    notifier_call_chain(&netdev_chain, NETDEV_SAMPLE, dev);
    return 0;
}

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Of course, I've defined NETDEV_SAMPLE in include/linux/notifier.h

Now up to this stage, its fine. Problem is when I try to call dev_sample() from driver/net/natsemi.c (my network device driver).

natsemi.c has check_link function which runs periodically and checks to see if cable is out. So I've placed my dev_sample() in this function and have it called whenever status of cable changes. But as soon as the status change, machine dies with "alloc_skb called nonatomically from interrupt c00ba700", with some printk's I was able to find out notifier_call_chain() was getting called. But it happens when it traverses the &netdev_chain. (at the very first one in fact)

I've tried wrapping the dev_sample() with rtnl_lock and unlock but with no luck. It looks to me its to do with accessing resource at a wrong time, but I have no idea where to go from here.

Any suggestion would be appreciated.
Cheers,

Signature · 1 line
Daniel