2008-10-06 14:19:52 critical section in user-space
Servaes Joordens (NETHERLANDS)
Message: 63169
I am trying to make a time synchronisation tool through ethernet.
It is important to have some critical sections to handle my timing commands correctly. I want to be able to disable task-switches for a very short while. What commands are used to generate a critical section in uClinux?
regards,
Servaes
QuoteReplyEditDelete
2008-10-06 14:32:58 Re: critical section in user-space
Mike Frysinger (UNITED STATES)
Message: 63170
there arent. you can set your application's scheduling mode to real time and increase its priority, and then Linux should schedule it in ahead of all other applications. just make sure you have your app yield the processor properly.
QuoteReplyEditDelete
2008-10-06 14:38:49 Re: critical section in user-space
Servaes Joordens (NETHERLANDS)
Message: 63171
Can it be done in kernel-mode?
Is it possible to detect wether a task-switch has occurred?
QuoteReplyEditDelete
2008-10-06 15:01:47 Re: critical section in user-space
Servaes Joordens (NETHERLANDS)
Message: 63174
Mike,
What would be the correct way to call settimeofday(...)
It is important to set the correct time. First I calculate the correct time value. Then I call settimeofday(...). It would be very bad when a taskswitch occurs just before the call to settimeofday(...)
regards,
Servaes
QuoteReplyEditDelete
2008-10-06 15:13:41 Re: critical section in user-space
Mike Frysinger (UNITED STATES)
Message: 63177
use NTP if you're concerned about proper time keeping. anything else is just a hack attempting to approximate NTP behavior.
QuoteReplyEditDelete
2008-10-06 15:13:57 Re: critical section in user-space
Mike Frysinger (UNITED STATES)
Message: 63178
can what be done in kernel mode ?
QuoteReplyEditDelete
2008-10-06 15:17:03 Re: critical section in user-space
Servaes Joordens (NETHERLANDS)
Message: 63179
Mike,
I was waiting for this answer. I cannot use NTP, because there is a very exact timeslot when I can do the ethernet communication for synchronisation. NTP does it's thing in it's own pace.
regards
Servaes
QuoteReplyEditDelete
2008-10-06 15:18:34 Re: critical section in user-space
Servaes Joordens (NETHERLANDS)
Message: 63181
Does a critical section exist in kernel mode? So, I can do the time-adjustment in kernel-mode.
regards,
Servaes
QuoteReplyEditDelete
2008-10-06 15:33:03 Re: critical section in user-space
Robin Getz (UNITED STATES)
Message: 63183
Servaes:
Sounds like what you want is 1588 support - there is support for this as well in the Linux kernel in a generic way.
-Robin
QuoteReplyEditDelete
2008-10-06 15:47:09 Re: critical section in user-space
Servaes Joordens (NETHERLANDS)
Message: 63184
Robin,
Thanks for the link. I will look into it.
However.. I am still interrested in the correct way to make a call to settimeofday(). When using it now, I get an possible error of 4ms (being the task-switch time).
regards,
Servaes
QuoteReplyEditDelete
2008-10-06 16:10:56 Re: critical section in user-space
Robin Getz (UNITED STATES)
Message: 63185
Servaes:
If you want to do things in kernel space - the best thing to look at the way NTP does things. (Since that is what you are mostly replicating). - in kernel/time/ntp.c & arch/blackfin/kernel/time.c - do not use settimeofday() directly (since that is part of the C library - not a kernel function).
-Robin
QuoteReplyEditDelete
2008-10-06 17:30:48 Re: critical section in user-space
Michael Hennerich (GERMANY)
Message: 63187
Also play with the High Resolution Timer support and Tickless Kernel options.
Let me know how it goes.
-Michael