UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Adventurer
Adventurer
5,346 Views
Registered: ‎03-19-2008

Linux timer crash on Petalinux SDK

Dear Linux users,

 

I am using PetaLinux SDK 2.2 (kernel 2.6.37.6) and noticed a strange behaviour when using periodic timers.

It seems that for some values of the interval the application crashes (segfault).

 

As a workaround I avoided using periodic timers and faked them via software by comparing timestamps, but it would be good if somebody would be able to try the simple test I put up and confirm the behaviour and guess some possible cause.

 

The app just install a periodic timer that triggers an event and prints how many ticks have been seen in a second. Nothing special..
An argument can be used to specify how many ticks to trigger per second.

When called with 1000 it seems to always segfault. When called with 100 or 10000 not.
Attached is the code and a core dump that does not seem to give much information anyway.

 

I also tried with bot signal and sigaction to no avail.

 

Best regards to everybody.

Giulio

0 Kudos
7 Replies
Xilinx Employee
Xilinx Employee
5,340 Views
Registered: ‎07-29-2011

Re: Linux timer crash on Petalinux SDK

Hi,

I think you should be getting help from petalogix support team

 

Regards

Madhubala

0 Kudos
Adventurer
Adventurer
5,338 Views
Registered: ‎03-19-2008

Re: Linux timer crash on Petalinux SDK

Hi Madhubala, you are perfectly right and I have asked them , too.

But maybe anybody of you can check if this bug is present in the Open Source Linux, too?

The kernel were almost identical, even if now the Open Source one is more up-to-date.

I will post their comments here, anyway.

Best regards.

Giulio

0 Kudos
Observer gsmecher
Observer
5,322 Views
Registered: ‎01-21-2011

Re: Linux timer crash on Petalinux SDK

Bear in mind the manpage's warning about mixing sleep() and SIGALRM:

 

"sleep() may be implemented using SIGALRM; mixing calls to alarm(2) and sleep() is a bad idea."

0 Kudos
Adventurer
Adventurer
5,319 Views
Registered: ‎03-19-2008

Re: Linux timer crash on Petalinux SDK

Thanks for the pointer gsmecher.

And probably the same applies to usleep. Maybe not to nanosleep..

I'll check. But it is still quite bad that the application would crash.

Giulio

0 Kudos
Visitor raymondr99
Visitor
4,985 Views
Registered: ‎10-16-2012

Re: Linux timer crash on Petalinux SDK

Hi all,

I have had this exact symptom for more than a year and decided to get the latest tools(4.6.2)/kernel(12.12) snapshot to give it another go. No luck, same segmentation fault as Giulio.  Below is my sample code.  It's an umpleasant feeling that code as mundane as this crashes.

 

Any thoughts?

Thanks for your time,

Raymond

 

 

#include <stdio.h>

long cnt = 0; static void TimerHandler(int sig) { cnt ++; } int main(int argc, char**argv) { printf("Welcome ...\n"); signal(SIGALRM, TimerHandler); struct itimerval it; it.it_interval.tv_sec = 0; it.it_interval.tv_usec = 10 * 1000; it.it_value = it.it_interval; setitimer(ITIMER_REAL, &it, NULL); // this works on x86, but seg faults on microblaze. while (1) { printf("cnt:%li\n", cnt); } }

 

0 Kudos
Observer benh88
Observer
4,883 Views
Registered: ‎01-03-2013

Re: Linux timer crash on Petalinux SDK

Just tried it using a home-brewed GCC 4.6.4 toolchain (see http://forums.xilinx.com/t5/Embedded-Linux/Microblaze-big-endian-support/td-p/319765) and it still crashes usually before reaching 400

0 Kudos
Highlighted
Visitor tuxnoel
Visitor
240 Views
Registered: ‎05-31-2018

Re: Linux timer crash on Petalinux SDK

Has any fix for this found yet? It seems to be happening in Petalinux-2018.1 also where simple socket application with sendto() call is crashing whenever SIGALRM handler is entered. Can anyone suggest a fix for this. Issue doesn't happen with ARM-32/64 or Intel 32/64 bit architectures running same code.

0 Kudos