2008-06-19 06:25:09     Kernel panic with timer bug

Document created by Aaronwu Employee on Aug 6, 2013
Version 1Show Document
  • View in full screen mode

2008-06-19 06:25:09     Kernel panic with timer bug

Cyril HAENEL (FRANCE)

Message: 57580   

 

Hi all,

 

A customer have "ported" his code (userspace code and kernel modules) on the last kernel and toolchain 2008 releases, and now he gets a strange problem. After approx 90 minutes, he gets this error :

 

BUG: failure at include/linux/timer.h:153/add_timer()!

Kernel panic - not syncing: BUG!

 

I looked in include/linux/timer.h, and the error appears in this function

 

static inline void add_timer(struct timer_list *timer)

{

        BUG_ON(timer_pending(timer));

        __mod_timer(timer, timer->expires);

}

 

Is someone knows why this error appears ?

 

Best regards,

Cyril

TranslateQuoteReplyEditDelete

 

 

2008-06-19 11:40:41     Re: Kernel panic with timer bug

Mike Frysinger (UNITED STATES)

Message: 57590   

 

i'm guessing you're running the Blackfin UART in PIO mode.  there was a bug in it that should be fixed now in svn.

QuoteReplyEditDelete

 

 

2008-06-30 04:16:45     Re: Kernel panic with timer bug

Cyril HAENEL (FRANCE)

Message: 58066   

 

Mike, I asked the customer to verify that point, the uarts are not configured in PIO mode but in DMA mode.

 

Thus I believe the problem is not coming from uarts.

 

The customer have a kernel module which use a timer, I think the problem comes from here because there is no kernel panic when the kernel module and userspace application are not loaded.

 

Can you explain me the differents reasons which can cause this kernel panic ?

 

Regards,

 

Cyril

TranslateQuoteReplyEditDelete

 

 

2008-06-30 05:51:12     Re: Kernel panic with timer bug

Mike Frysinger (UNITED STATES)

Message: 58106   

 

if it's their module that's causing the problem, then they're using the timer framework incorrectly ... i'd review the timer framework documentation

 

the BUG() tells you that you're wrongly calling add_timer() on a timer that's already been added.  dont do that.

QuoteReplyEditDelete

 

 

2008-06-30 13:23:25     Re: Kernel panic with timer bug

Cyril HAENEL (FRANCE)

Message: 58130   

 

The framework is not used because they do specifics things with the timer that the framwork can't do.

 

These specifics things work well with an old svn revision.

 

Does the message they have (BUG: failure at include/linux/timer.h:153/add_timer()! Kernel panic - not syncing: BUG! ) can come from another action than add a timer that is already added ? Or it's the only possibility ?

 

Regards,

 

Cyril

 

 

 

 

TranslateQuoteReplyEditDelete

 

 

2008-06-30 13:57:11     Re: Kernel panic with timer bug

Mike Frysinger (UNITED STATES)

Message: 58131   

 

i imagine if you screwed up memory, that could trigger the BUG() as well.  you have the source code and clearly see the condition inside of the BUG_ON().

 

i dont know what specific things you're talking about, but if you're doing wonky things outside of the framework, you shouldnt be surprised if the framework does sanity checking which has since been violated.

 

you may also want to review the common locking guidelines in case your code is racy:

http://docs.blackfin.uclinux.org/kernel/generated/kernel-locking/

Attachments

    Outcomes