All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Thomas Petazzoni <thomas@free-electrons.com>,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	Boris Brezillon <boris@free-electrons.com>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	xenomai@xenomai.org
Subject: Re: [Xenomai] [PATCH] AT91: SAMA5D3: Adapt Ipipe for AIC5
Date: Thu, 17 Jul 2014 12:54:10 +0200	[thread overview]
Message-ID: <53C7AB52.609@xenomai.org> (raw)
In-Reply-To: <20140717101807.GC20328@lukather>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 07/17/2014 12:18 PM, Maxime Ripard wrote:
> On Wed, Jul 16, 2014 at 09:47:38PM +0200, Gilles Chanteperdrix
> wrote:
>>>>> I don't think latency fits both these criterias, that are 
>>>>> quite essential for us. But if you have any better
>>>>> solution that might, we're definitely open to suggestions
>>>>> :)
>>>> 
>>>> Xenomai forge's latency is based on timerfd, so will be
>>>> usable on Linux, preempt-rt and xenomai. But that is for the
>>>> future.
>>> 
>>> Ah, good to know.
>>> 
>>>> I suggest you fix the issue with negative latencies, and see
>>>> if it avoids the large latencies you observe.
>>> 
>>> So, I tested it today with the latency calibration disabled.
>>> 
>>> It doesn't change anything. I slightly modified it to dump the 
>>> time1 and time2 variables to see if we're observing negative 
>>> latencies.
>>> 
>>> The code is here: http://code.bulix.org/y7f8tc-86530?raw And
>>> here is the output of a single run: 
>>> http://code.bulix.org/ciamlo-86531?raw
>>> 
>>> So, if you look at it, we can see that we have around half a
>>> dozen of these huge latency spikes, while we gather 180k
>>> samples, but these spikes are not actually caused by some
>>> negative latencies. There actually is such a different of a few
>>> 100's of ms between our two timespec structures.
>>> 
>>> And it's not due to an error reported by any of the clock 
>>> functions either.
>> 
>> Ok, you do not call pthread_setschedparam to make the task run
>> with the SCHED_FIFO policy, do you set the policy by running the
>> program with chrt? Because starting with Xenomai 2.6.0, threads
>> with the SCHED_OTHER policy automatically return to secondary
>> mode after a primary mode syscall, so your task is essentially a
>> plain linux task. If you do run the program with chrt, I suggest
>> checking in /proc/xenomai/stat or /proc/xenomai/sched that the
>> task runs with the intended priority.
> 
> /me hides...
> 
> Yes, it was just that stupid mistake... Erm. I guess I owe you a
> drink if we ever meet :)
> 
> And now, I indeed get some negative latency values.
> 
> Which brings an extra question about this. Is the timer
> calibration supposed to get a minimum latency to 0 (meaning that
> with a properly calibrated timer, we would only get positive
> latencies), or that the average latency should be around 0 (which
> would mean that negative latencies would actually be frequent, but
> would break the clock_nanosleep documented behaviour).
> 
> I'm actually seeing the former, but trying the latter only brings
> us quite close to having the calibration disabled entirely.

The calibration is left entirely to the user, so, you choose what is
best for your application. But indeed, if your application relies on
clock_nanosleep documented behaviour (should never wake-up early
except in case of signal), you want to set /proc/xenomai/latency value
to the minimum value measured by the latency test, minus a safety margin.

- -- 
                                                                Gilles.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iD8DBQFTx6tSGpcgE6m/fboRAr2DAJ47ysURGA5T27Sq4FrNpFfs59sySQCeMfTR
8XCWDd+NWn5d6VKP+Nh4t/A=
=sYTn
-----END PGP SIGNATURE-----


  reply	other threads:[~2014-07-17 10:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-01 10:27 [Xenomai] [PATCH] AT91: SAMA5D3: Adapt Ipipe for AIC5 Maxime Ripard
2014-07-01 10:59 ` Gilles Chanteperdrix
2014-07-01 14:15   ` Maxime Ripard
2014-07-01 19:35     ` Gilles Chanteperdrix
2014-07-04  9:27       ` Maxime Ripard
2014-07-05  8:13         ` Gilles Chanteperdrix
2014-07-07 16:02           ` Maxime Ripard
2014-07-07 16:07             ` Gilles Chanteperdrix
2014-07-08 12:55               ` Maxime Ripard
2014-07-08 14:04                 ` Maxime Ripard
2014-07-08 17:30                 ` Gilles Chanteperdrix
2014-07-10 15:05                   ` Maxime Ripard
2014-07-10 17:04                     ` Gilles Chanteperdrix
2014-07-16 16:18                       ` Maxime Ripard
2014-07-16 19:47                         ` Gilles Chanteperdrix
2014-07-17 10:18                           ` Maxime Ripard
2014-07-17 10:54                             ` Gilles Chanteperdrix [this message]
2014-07-17 11:59                               ` Maxime Ripard
2014-07-17 22:21                                 ` Gilles Chanteperdrix
2014-07-10 18:27                     ` Gilles Chanteperdrix
     [not found]                     ` <20140710172702.5ba6511c@free-electrons.com>
2014-07-10 18:30                       ` Gilles Chanteperdrix

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=53C7AB52.609@xenomai.org \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=boris@free-electrons.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=nicolas.ferre@atmel.com \
    --cc=thomas@free-electrons.com \
    --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.