All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Xenomai 2.5.3 vs gettimeofday() --> livelock?
@ 2011-07-06 20:38 Jeremy Friesner
  2011-07-07  4:54 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Friesner @ 2011-07-06 20:38 UTC (permalink / raw)
  To: xenomai

Hi all,

I'm developing a product that consists of a small number of x86 Linux boxes connected over a LAN.  These boxes run Debian Linux with Xenomai 2.5.3 installed.  In order to co-ordinate their activities, they all run ptpd (as a Linux userspace daemon) to synchronize their clocks, as returned by gettimeofday().

The issue we're having is that occasionally (maybe once or twice a week, or even less), at a seemingly random time, one of these boxes (not always the same one) will simply quit working... it stops responding to pings, stops sending or receiving network traffic, etc.   We suspect (but haven't yet proved) that this is due to the box's Xenomai real-time thread spinning in-place somewhere, causing the Linux kernel to quit running.

Our Xenomai real-time thread doesn't do much (mainly ot just copies a fixed amount of data from one location to another), but it does occasionally call gettimeofday(), in order to record the current correlation between the PTP-based Linux clock and the Xenomai rt_timer_tsc() clock, so that it can account for drift between them.

From reading this post, it seems like the call to gettimeofday() might be the culprit:

	http://www.mail-archive.com/xenomai@xenomai.org

My first question is:  Am I right in suspecting that gettimeofday() can occasionally spin/livelock, when called from a Xenomai 2.5.3 real-time thread?  FWIW, it gets called from the real-time thread once every 333mS.

And if that is the case, my second question is:  Is there an alternative "safe" way to call gettimeofday() (or something equivalent) so that the real-time thread can find out the current PTP system time?  Or do I need to re-write my code so that the real-time thread never calls gettimeofday()?

Is there a recommended practice for using Xenomai threads in conjunction with PTP?

Thanks,
Jeremy



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-07-11 11:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-06 20:38 [Xenomai-help] Xenomai 2.5.3 vs gettimeofday() --> livelock? Jeremy Friesner
2011-07-07  4:54 ` Gilles Chanteperdrix
2011-07-07  8:01   ` Uwe Fechner
2011-07-11 11:14     ` Gilles Chanteperdrix

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.