All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@domain.hid>
To: niklaus.giger@domain.hid
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] Problem with periodic timer on PPC40x solved
Date: Tue, 26 Sep 2006 08:47:41 +0200	[thread overview]
Message-ID: <4518CD0D.2070505@domain.hid> (raw)
In-Reply-To: <200609252229.56854.niklaus.giger@domain.hid>

Niklaus Giger wrote:
> Am Montag, 25. September 2006 17:57 schrieb Philippe Gerum:
>> On Sun, 2006-09-24 at 23:07 +0200, Wolfgang Grandegger wrote:
>>> Niklaus Giger wrote:
> <..>
>> Ok, we can go for the lazy fix here, since this code is poised to
>> disappear anyway. I've merged a variant of the above we already use for
>> the ARM port, which scales down the period to microseconds instead of
>> losing precision on the count of timebase ticks per jiffy.
>>
>> - ticks = ns * tb_ticks_per_jiffy / (1000000000 / HZ);
>> + ticks = (ns / 1000) * tb_ticks_per_jiffy / (1000000 / HZ);
> Thanks for finding this solution. I tried to understand mulhwu and 
> mulhwu_scale_factor but couldn't figure out a correct solution in a short 
> time.

I took me also some time to understand the meaning. mulhwu(a,b) returns 
the high 32 bits (32..63) of a*b. A possible quick fix could be:

   if (mulhwu(ns, tb_ticks_per_jiffy) > 0)
	ticks = (ns / 1000) * tb_ticks_per_jiffy / (1000000 / HZ);
   else
	ticks = ns * tb_ticks_per_jiffy / (1000000000 / HZ);

But Philippe already applied a reasonable fix.

> 
> The buildbot cannot presently power on and off my PPC405 target board, as the 
> my power outlet switching device is broken and has been sent back for a 
> remplacement.
> 
> I did however run some tests manually and have the following questions about 
> the output:
> Why do I get negative values for latenciy values?
> Is the output of lines like "Xenomai: Switching display-3238 to secondary mode 
> after exception #1025 from user-space at 0x100033c4 (pid 3240)" harmless or 
> the result of a activated CONFIG_XENO_OPT_DEBUG<..> option?
> 
> Mon Sep 25 20:20:33 UTC 2006
> running: ./run -- -T 5 -t2 # latency
> *
> *
> * Type ^C to stop this application.
> *
> Xenomai: Switching display-3238 to secondary mode after exception #1025 from 
> user-space at 0x100033c4 (pid 3240)
> == Sampling period: 100 us
> == Test mode: in-kernel timer handler
> == All results in microseconds
> warming up...
> RTT|  00:00:01  (in-kernel timer handler, 100 us period, priority 99)
> RTH|-----lat min|-----lat avg|-----lat max|-overrun|----lat best|---lat worst
> RTD|      -5.108|      -4.754|      -0.905|       0|      -5.108|      -0.905
> RTD|      -4.963|      -4.871|       1.155|       0|      -5.108|       1.155
> Xenomai: Switching display-3238 to secondary mode after exception #1025 from 
> user-space at 0xfda9638 (pid 3240)
> RTD|      -4.963|      -4.758|      16.020|       0|      -5.108|      16.020
> RTD|      -6.313|      -4.861|      10.980|       0|      -6.313|      16.020
> Xenomai: Switching display-3238 to secondary mode after exception #1025 from 
> user-space at 0xfe7c1c4 (pid 3240)
> ---|------------|------------|------------|--------|-------------------------
> RTS|      -6.313|      -4.811|      16.020|       0|    00:00:05/00:00:05
> Xenomai: stopping RTDM services.
> 
> Best regards



  parent reply	other threads:[~2006-09-26  6:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-23 18:13 [Xenomai-core] Problem with periodic timer on PPC40x identified Niklaus Giger
2006-09-23 20:55 ` Wolfgang Grandegger
2006-09-23 21:33   ` Philippe Gerum
2006-09-24 20:47   ` [Xenomai-core] Problem with periodic timer on PPC40x solved Niklaus Giger
2006-09-24 21:07     ` Wolfgang Grandegger
2006-09-25 15:57       ` Philippe Gerum
2006-09-25 20:29         ` Niklaus Giger
2006-09-25 20:59           ` Philippe Gerum
2006-09-25 21:15             ` Niklaus Giger
2006-09-26  6:59               ` Philippe Gerum
2006-09-26 14:21               ` Philippe Gerum
2006-09-26 18:39                 ` Niklaus Giger
2006-09-26 19:34               ` Niklaus Giger
2006-09-26 19:48                 ` Philippe Gerum
2006-09-26  6:47           ` Wolfgang Grandegger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-09-26 14:56 gilles.chanteperdrix
2006-09-26 16:10 ` Philippe Gerum
2006-09-26 16:28   ` Wolfgang Grandegger
2006-09-26 16:38     ` Philippe Gerum
2006-09-26 16:57       ` Wolfgang Grandegger
2006-09-26 18:56     ` Niklaus Giger
2006-09-26 20:23       ` Wolfgang Grandegger
2006-09-26 21:26         ` Niklaus Giger
2006-09-27 10:13           ` Wolfgang Grandegger
2006-09-27 18:19             ` Wolfgang Grandegger
2006-09-28  6:02               ` Niklaus Giger
2006-09-28  7:59                 ` Wolfgang Grandegger

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=4518CD0D.2070505@domain.hid \
    --to=wg@domain.hid \
    --cc=niklaus.giger@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.