2010-02-09 03:05:26     app hangs in pthread_create

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

2010-02-09 03:05:26     app hangs in pthread_create

Filip Vanalme (BELGIUM)

Message: 85789   

 

OK, I changed back to my 2009R1 version, trying to get application up and running. Compilation ends successfull. But, my application won't start up. It hangs while creating threads, finally showing : BUG: soft lockup - CPU#0 stuck for 61s! [xtg2:44]

It looks like it got stuck in a pthread_create call.

 

Never had this when application runs in 2006R2 environment. I assume posix thread handling (the way the application uses posix function calls) should act the same way in both versions. Lots of changes in using threads ?

 

I don't know if [xtg2:44] can tell me something (xtg2 is the name of the application, not of a file).

 

I wrote a little test routine in the main function that creates 10 threads using the same pthread call. No problem. Threads created successfully and running. If I place the same test routine (creating 10 threads) in another function (i.e. main --> func1 --> func2 --> test_threads), then it doesn't work at all. It hangs in the first pthread_create call. Are there any situations that can cause the creation of threads to hang ? Some particular things I might not do when creating threads ?

TranslateQuoteReplyEditDelete

 

 

2010-02-09 03:41:53     Re: app hangs in pthread_create

Yi Li (CHINA)

Message: 85828   

 

Filip,

 

Please enable the kernel option "CONFIG_DEBUG_VERBOSE" and post the full error log.

 

-Yi

QuoteReplyEditDelete

 

 

2010-02-09 04:34:06     Re: app hangs in pthread_create

Filip Vanalme (BELGIUM)

Message: 85831   

 

This is the output :

 

BUG: soft lockup - CPU#0 stuck for 61s! [xtg2:44]

 

ADSP-BF561-0.5 500(MHz CCLK) 100(MHz SCLK) (mpu off)

Linux version 2.6.28.10-ADI-2009R1XT100G2

Built with gcc version 4.1.2 (ADI svn)

 

SEQUENCER STATUS:               Not tainted

SEQSTAT: 00002000  IPEND: 8050  SYSCFG: 0006

  EXCAUSE   : 0x0

  interrupts disabled

  physical IVG6 asserted : <0xffa00e80> /* kernel dynamic memory */

  physical IVG15 asserted : <0xffa00eec> /* kernel dynamic memory */

  logical irq   6 mapped  : <0xffa00458> /* kernel dynamic memory */

  logical irq  35 mapped  : <0x001a5d68> /* kernel dynamic memory */

  logical irq  36 mapped  : <0x001a5f94> /* kernel dynamic memory */

  logical irq  82 mapped  : <0x001adf24> /* kernel dynamic memory */

RETE: <0x00000000> /* Maybe null pointer? */

RETN: <0x00404000> [ xtg2 + 0x0 ]

RETX: <0x06ecd048> [ /lib/libc.so.0 + 0xd048 ]

RETS: <0x06aa8264> [ /bin/xtg2 + 0xa8264 ]

PC  : <0xffa00f46> /* kernel dynamic memory */

 

PROCESSOR STATE:

R0 : 00000000    R1 : 00000000    R2 : 00000000    R3 : 00000001

R4 : 06000b30    R5 : 06899388    R6 : 00000030    R7 : 00406e24

P0 : 0000004e    P1 : 06ecd03c    P2 : 06012bb4    P3 : 06bf9940

P4 : 00406e24    P5 : 06899388    FP : 00406cfc    SP : 00403e48

LB0: 06edf7ed    LT0: 06edf7ea    LC0: 00000000

LB1: 06edd6b7    LT1: 06edd6b6    LC1: 00000000

B0 : 00000000    L0 : 00000000    M0 : ffffffe8    I0 : 00000000

B1 : 00000000    L1 : 00000000    M1 : 00000000    I1 : 00000000

B2 : 00000000    L2 : 00000000    M2 : 00000000    I2 : 00000000

B3 : 00000000    L3 : 00000000    M3 : 00000000    I3 : 00000000

A0.w: 00000002   A0.x: 00000000   A1.w: 00000002   A1.x: 00000000

USP : 00406cf0  ASTAT: 02003025

TranslateQuoteReplyEditDelete

 

 

2010-02-09 05:24:25     Re: app hangs in pthread_create

Yi Li (CHINA)

Message: 85832   

 

Can you also enable:

 

kernel hacking--> kernel debugging

 

                         [*]   Detect Soft Lockups

 

                                [*]     Panic (Reboot) On Soft Lockups

 

And post the full log? This would give more useful information.

 

-Yi

QuoteReplyEditDelete

 

 

2010-02-09 05:36:24     Re: app hangs in pthread_create

Yi Li (CHINA)

Message: 85833   

 

You may know that soft lockup happens when kernel busily doing something (e.g, some driver code is in dead loop), so that a high priority watchdog thread (with priority 99) cannot get scheduled. You may need to do some debug and find out what kernel is doing.

 

-Yi

QuoteReplyEditDelete

 

 

2010-02-09 11:34:18     Re: app hangs in pthread_create

Mike Frysinger (UNITED STATES)

Message: 85850   

 

there have been lots of pthread changes since 2006R2.

 

are you using vfork/daemon before/after creating threads ?

QuoteReplyEditDelete

 

 

2010-02-10 02:34:00     Re: app hangs in pthread_create

Filip Vanalme (BELGIUM)

Message: 85870   

 

No, no vfork or daemon

TranslateQuoteReplyEditDelete

 

 

2010-02-10 02:39:43     Re: app hangs in pthread_create

Filip Vanalme (BELGIUM)

Message: 85871   

 

No, no vfork or daemon

 

---

 

Strange thing is that, in the beginning of my application, two threads seem to be started with success. Then, one of the following calls to pthread is hanging. I have to double check what the difference is between the first two calls to pthread_create and the following.

TranslateQuoteReplyEditDelete

 

 

2010-02-10 03:15:08     Re: app hangs in pthread_create

Mike Frysinger (UNITED STATES)

Message: 85872   

 

if you could rip out the sequence of calls into a stand alone app and post the source for that, it'd help immensely as we'd be able to debug it ...

QuoteReplyEditDelete

 

 

2010-02-10 04:42:43     Re: app hangs in pthread_create

Filip Vanalme (BELGIUM)

Message: 85907   

 

Hi Mike,

 

I finally managed to get my application working. But, frustration... because I don't know exactly where the problem was. I removed everything from the startup sequence and added things step by step (because I had two threads that started up alright, I used this as a base to go on). Especially in the thread startup handling, I added things bit by bit.

 

The only thing that remains as "suspect" for the hanging is a call to pthread_attr_setstacksize(). I removed this call from the thread startup sequence. Maybe, I should add this call again to see if this makes the difference. But I have to move on quickly now because deadline is appoaching fast...

 

Thanks for all support !

Attachments

    Outcomes