All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Rodrigo Rosenfeld Rosas <lbocseg@domain.hid>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] RTDM and Timer functions
Date: Fri, 10 Mar 2006 19:32:38 +0100	[thread overview]
Message-ID: <4411C646.80802@domain.hid> (raw)
In-Reply-To: <200603101054.41122.lbocseg@domain.hid>

[-- Attachment #1: Type: text/plain, Size: 3319 bytes --]

Rodrigo Rosenfeld Rosas wrote:
> Em Quinta 09 Março 2006 17:33, Jan Kiszka escreveu:
> 
>> Rodrigo Rosenfeld Rosas wrote:
>>> Hi Jan,
>>>
>>> I'm still concerned about the future of RTDM and timer functions. I think
>>> there should be some function for starting the timer manually, since the
>>> automatic feature don't work great for RTDM drivers.
>>>
>>> It is not nice to have to run the latency (or any other) program for
>>> starting the timer before I can load my driver. And it is not suffice to
>>> run it once I booted. After I open/close my rtdm device and reload my
>>> driver the problem will occur again and I'll have to re-run the latency
>>> program.
>> Sorry I don't see the problem here.
>>
>> # modprobe xeno_nucleus; cat /proc/xenomai/timer
>> status=off:setup=1392:tickval=0:jiffies=0
>>
>> # modprobe xeno_rtdm; cat /proc/xenomai/timer
>> status=oneshot:setup=1392:tickval=1:jiffies=8113917792696
>>
>> So the timer is running right since when rtdm is loaded?!
> 
> Yes, here too.
> 
>> And that simple heartbeat rtdm example on my rt-addon homepage now
>> cleanly runs even without any further helper to start some timer.
> 
> Yes, here too. You are right, once the timer is in oneshot mode. My driver 
> loads correctly without the helper. Then I start a user application that 
> changes the timer to periodic mode and uses my driver. When I reload my 
> driver, now in periodic mode, the problem raises.

What happens if you make the periodic timer the default one in the
kernel configuration?

> 
> It seems, there is no problem when the timer is set to oneshot. But when 
> turning it to periodic, at least one of rtdm_task_busy_sleep() or 
> rtdm_clock_read() doesn't seem to work. See below:
> 
> cat /proc/xenomai/timer
>   status=periodic:setup=188:tickval=100000:jiffies=19972453
> 
> start_time = rtdm_clock_read();
> rtdm_task_busy_sleep(84000);
> temp_time = rtdm_clock_read();
> rtdm_printk(KERN_INFO "Should be near 84000: %u\n", (unsigned int)
>                    (temp_time-start_time));
> 
> Sometimes the result is "Should be near 84000: 100000", that is kind of 
> correct, since the tickval is 100000, although I think that those functions 
> in the RTDM driver context should be independent of the tick value set by the 
> user program... Maybe using oneshot in the driver calls and periodic in the 
> application... I really don't know what would be the best approach here...

rtdm_clock_read always uses the nucleus clock. Using something different
(e.g. always TSC) would break applications specifying absolute times
derived from the return values of other skins' functions.

> 
> But the worst case is that sometimes I get "Should be near 84000: 0" which 
> clearly is a incorrect result.

That might be a rounding issue somewhere, as the sleep than clearly did
not wait at least one tick. Will have to check this when time permits.

> 
> After I run the latency program, the timer turns to be oneshot again and 
> everything goes right.
> 
> What can I do to solve this problem?

Use oneshot mode in the meantime - or even longer ;). Why do you prefer
periodic mode for your application? Another workaround: reduce the tick
interval.

> 
> Thanks in advance,
> 
> Rodrigo.
> 

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

  reply	other threads:[~2006-03-10 18:32 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-09 17:43 [Xenomai-core] RTDM and Timer functions Rodrigo Rosenfeld Rosas
2006-03-09 20:33 ` Jan Kiszka
2006-03-10 13:54   ` Rodrigo Rosenfeld Rosas
2006-03-10 18:32     ` Jan Kiszka [this message]
2006-03-10 20:00       ` Rodrigo Rosenfeld Rosas
2006-03-13 11:48         ` Jan Kiszka
2006-03-13 14:54           ` Rodrigo Rosenfeld Rosas
2006-03-13 17:15             ` Rodrigo Rosenfeld Rosas
2006-03-13 17:58               ` Rodrigo Rosenfeld Rosas
2006-03-13 18:24                 ` Jan Kiszka
2006-03-13 19:25                   ` Rodrigo Rosenfeld Rosas
2006-03-13 19:19                 ` Rodrigo Rosenfeld Rosas
2006-03-15  4:44                   ` Jim Cromie
2006-03-13 18:12             ` Jan Kiszka
2006-03-14  1:28               ` Rodrigo Rosenfeld Rosas
2006-03-13 17:25       ` Gilles Chanteperdrix
2006-03-13 17:31         ` Rodrigo Rosenfeld Rosas
2006-03-13 18:33           ` Jan Kiszka
2006-03-13 19:31             ` Rodrigo Rosenfeld Rosas
2006-03-13 23:05               ` Jan Kiszka
2006-03-14  1:36                 ` Rodrigo Rosenfeld Rosas
2006-03-14  6:44                   ` Jan Kiszka
2006-03-14 14:27                     ` Rodrigo Rosenfeld Rosas
2006-03-14 16:46                       ` Jan Kiszka
2006-03-14 16:59                         ` Rodrigo Rosenfeld Rosas
2006-03-14 18:45                           ` Rodrigo Rosenfeld Rosas
2006-03-14 19:00                             ` Jan Kiszka
2006-03-14 19:40                               ` Rodrigo Rosenfeld Rosas
2006-03-14 20:29                                 ` Jan Kiszka
2006-03-14 22:32                                   ` Rodrigo Rosenfeld Rosas
2006-03-14 22:51                                     ` Jan Kiszka
2006-03-15  0:31                                       ` Rodrigo Rosenfeld Rosas
2006-03-15 13:06                                     ` Philippe Gerum
     [not found]                 ` <44167BE9.2090703@domain.hid>
2006-03-14 10:16                   ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4411C646.80802@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=lbocseg@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.