All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] rtdm timer questions
@ 2009-03-12 10:55 Steven Seeger
  2009-03-12 11:12 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 8+ messages in thread
From: Steven Seeger @ 2009-03-12 10:55 UTC (permalink / raw)
  To: xenomai

Is an RTDM timer going to run at a priority higher than any scheduled  
realtime thread?

How accurate is the timing?

We are seeing the timer running at 125us periodic rate being called  
much too quickly. At least, I think we are. I can't personally use  
anything for a little over a week.

Thanks,
Steven



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

* Re: [Xenomai-core] rtdm timer questions
  2009-03-12 10:55 [Xenomai-core] rtdm timer questions Steven Seeger
@ 2009-03-12 11:12 ` Gilles Chanteperdrix
  2009-03-12 11:29   ` Steven Seeger
  0 siblings, 1 reply; 8+ messages in thread
From: Gilles Chanteperdrix @ 2009-03-12 11:12 UTC (permalink / raw)
  To: Steven Seeger; +Cc: xenomai

Steven Seeger wrote:
> Is an RTDM timer going to run at a priority higher than any scheduled  
> realtime thread?
> 
> How accurate is the timing?
> 
> We are seeing the timer running at 125us periodic rate being called  
> much too quickly. At least, I think we are. I can't personally use  
> anything for a little over a week.

Yes a timer runs in interrupt context. This is the same design as Linux,
VxWorks, RTLinux, RTAI and most known OSes.

I do not understand what you mean by "too quickly", but do you get the
same phenomenon with the klatency -t 2 test?

-- 
                                                 Gilles.


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

* Re: [Xenomai-core] rtdm timer questions
  2009-03-12 11:12 ` Gilles Chanteperdrix
@ 2009-03-12 11:29   ` Steven Seeger
  2009-03-12 11:46     ` Jan Kiszka
  0 siblings, 1 reply; 8+ messages in thread
From: Steven Seeger @ 2009-03-12 11:29 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

I will ask Mark to run the klatency -t 2 test. I do not have a system  
or even a piece of a system right now so I can't run anything. Sorry. :(

What happens if I call start on a timer that is already running? Will  
it change the timing at all or ignore the start?

Is this correct:

rtdm_timer_start(&timer, 2000000, 125000, RTDM_TIMERMODE_ABSOLUTE);

The behavior I want is to start my timer in 2ms and have it fire every  
125us. The timer itself will use rtdm_timer_stop_in_handler() to stop  
itself.

Am I making any mistakes here?

Steven

On Mar 12, 2009, at 7:12 AM, Gilles Chanteperdrix wrote:

> Steven Seeger wrote:
>> Is an RTDM timer going to run at a priority higher than any scheduled
>> realtime thread?
>>
>> How accurate is the timing?
>>
>> We are seeing the timer running at 125us periodic rate being called
>> much too quickly. At least, I think we are. I can't personally use
>> anything for a little over a week.
>
> Yes a timer runs in interrupt context. This is the same design as  
> Linux,
> VxWorks, RTLinux, RTAI and most known OSes.
>
> I do not understand what you mean by "too quickly", but do you get the
> same phenomenon with the klatency -t 2 test?
>
> -- 
>                                                 Gilles.



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

* Re: [Xenomai-core] rtdm timer questions
  2009-03-12 11:29   ` Steven Seeger
@ 2009-03-12 11:46     ` Jan Kiszka
  2009-03-12 11:50       ` Steven Seeger
  2009-03-12 11:51       ` Steven Seeger
  0 siblings, 2 replies; 8+ messages in thread
From: Jan Kiszka @ 2009-03-12 11:46 UTC (permalink / raw)
  To: Steven Seeger; +Cc: xenomai

Steven Seeger wrote:
> I will ask Mark to run the klatency -t 2 test. I do not have a system  
> or even a piece of a system right now so I can't run anything. Sorry. :(
> 
> What happens if I call start on a timer that is already running? Will  

Not explicitly specified, but the existing timer will be stopped first
and then newly started.

> it change the timing at all or ignore the start?
> 
> Is this correct:
> 
> rtdm_timer_start(&timer, 2000000, 125000, RTDM_TIMERMODE_ABSOLUTE);
> 
> The behavior I want is to start my timer in 2ms and have it fire every  

"...start ... in 2 ms" sounds a bit like TIMERMODE_RELATIVE, no? :)

> 125us. The timer itself will use rtdm_timer_stop_in_handler() to stop  
> itself.
> 
> Am I making any mistakes here?
> 
> Steven
> 

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux


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

* Re: [Xenomai-core] rtdm timer questions
  2009-03-12 11:46     ` Jan Kiszka
@ 2009-03-12 11:50       ` Steven Seeger
  2009-03-12 11:51       ` Steven Seeger
  1 sibling, 0 replies; 8+ messages in thread
From: Steven Seeger @ 2009-03-12 11:50 UTC (permalink / raw)
  To: xenomai

> Not explicitly specified, but the existing timer will be stopped first
> and then newly started.

I should see if we are doing that, then. We are loading bytes into a  
buffer and calling start if we need to call it. Perhaps the logic is  
incorrect.

> "...start ... in 2 ms" sounds a bit like TIMERMODE_RELATIVE, no? :)

Yes I made this same mistake when I first wrote the driver. The  
version we are having issues with does say RELATIVE. I am still  
adjusting to a new time zone, so I use that as my excuse. :)

Steven


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

* Re: [Xenomai-core] rtdm timer questions
  2009-03-12 11:46     ` Jan Kiszka
  2009-03-12 11:50       ` Steven Seeger
@ 2009-03-12 11:51       ` Steven Seeger
  2009-03-12 12:09         ` Jan Kiszka
  1 sibling, 1 reply; 8+ messages in thread
From: Steven Seeger @ 2009-03-12 11:51 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

I think I see what my problem is with the driver. The flag that is  
holding off the extra starts is stupidly not set to volatile. Oops.  
I'll report back with results later.

Thanks,
Steven



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

* Re: [Xenomai-core] rtdm timer questions
  2009-03-12 11:51       ` Steven Seeger
@ 2009-03-12 12:09         ` Jan Kiszka
  2009-03-12 12:15           ` Steven Seeger
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Kiszka @ 2009-03-12 12:09 UTC (permalink / raw)
  To: Steven Seeger; +Cc: xenomai

Steven Seeger wrote:
> I think I see what my problem is with the driver. The flag that is
> holding off the extra starts is stupidly not set to volatile. Oops. I'll
> report back with results later.

Be careful with volatile variables: Unless they refer to hardware-backed
data (MMIO), you may just happen to write racy lock-less code - or the
volatile is useless anyway.

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux


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

* Re: [Xenomai-core] rtdm timer questions
  2009-03-12 12:09         ` Jan Kiszka
@ 2009-03-12 12:15           ` Steven Seeger
  0 siblings, 0 replies; 8+ messages in thread
From: Steven Seeger @ 2009-03-12 12:15 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

> Be careful with volatile variables: Unless they refer to hardware- 
> backed
> data (MMIO), you may just happen to write racy lock-less code - or the
> volatile is useless anyway.

Yes that is true. In this case, however, writes are atomic (just 0 or  
1) and even if something happens the "mode of failure" will be a  
missed 125us cycle of sound output. I doubt anyone would hear just one.

Steven



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

end of thread, other threads:[~2009-03-12 12:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-12 10:55 [Xenomai-core] rtdm timer questions Steven Seeger
2009-03-12 11:12 ` Gilles Chanteperdrix
2009-03-12 11:29   ` Steven Seeger
2009-03-12 11:46     ` Jan Kiszka
2009-03-12 11:50       ` Steven Seeger
2009-03-12 11:51       ` Steven Seeger
2009-03-12 12:09         ` Jan Kiszka
2009-03-12 12:15           ` Steven Seeger

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.