From: Philippe Gerum <rpm@xenomai.org>
To: "Umair Ali" <ali.umair@tut.fi>,
xenomai@xenomai.org, _=e2=80=8e?= <xenomai@xenomai.org>
Subject: Re: [Xenomai] Possible sync problem with timerfd and application
Date: Fri, 18 Dec 2015 10:22:14 +0100 [thread overview]
Message-ID: <5673D046.6090505@xenomai.org> (raw)
In-Reply-To: <2396B4D2166B62479FBBE370D4A7C1F30A716241@mb2010-1.intra.tut.fi>
On 12/17/2015 03:07 PM, Umair Ali wrote:
> Hello there,
>
> I am using the timerfd to produce the required sleep function for sending the raw ethernet packets using rtnet driver periodically. I read the file using the mmap() function and mlockall(MCL_CURRENT|MCL_FUTURE). My code is attached with this email. Gilles have already explained me with the jitter problem with timerfd but it is acceptable so far with me.
For the sake of clarity, Gilles told you about the requirement for
timerfd_create() to switch to secondary/linux mode for processing the
request, which may induce delays. He certainly did not told you that
reading from that Cobalt timerfd would induce jitter on a
well-performing Xenomai setup. You may convince yourself about this fact
by running the latency test: it is based on a sampling thread
synchronizing on a timerfd.
Unless you do observe high latencies with this test program, you should
probably assume a bug in the application rather than suspecting any core
operating system services, at least during the early stage of your
investigations.
Now the problem is that the code runs ok for more or less 30 secs. For
this period of running of code the jitter is acceptable. But after some
time the jitter increases very much and causes problem. I thought that
this may be because the timerfd has lost the synchronization with
application. Or timerfd is not working fine. I tried to use the poll()
and epoll() also but the problem persist. Can you guide me how i can
find the problem when running the application or do you need more
information regarding this problem. Please feel free to ask for more.
>
Your code is wrong: mixing regular linux systems calls like sendto()
over an AF_INET socket with Cobalt rt system calls will necessarily
induce delays in your loop, up to the amount of jitter sendto() may
suffer from the regular kernel.
Actually, I don't understand the reasoning behind that code. You want to
send a packet each 249 us precisely, but you do so traversing a
non-deterministic network stack, most likely over a probabilistic
(time-wise) medium, assuming this is 802.3 under the hood. You may want
to consider RTNet instead.
You are using a dual kernel system: real-time behavior is achievable
only if your application exclusively uses services from the real-time
co-kernel during the time-critical phases.
This is explained here:
http://xenomai.org/start-here/#How_does_Xenomai_deliver_real-time
--
Philippe.
next prev parent reply other threads:[~2015-12-18 9:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-17 14:07 [Xenomai] Possible sync problem with timerfd and application Umair Ali
2015-12-18 9:22 ` Philippe Gerum [this message]
2015-12-18 11:52 ` Umair Ali
2015-12-20 15:03 ` Gilles Chanteperdrix
2015-12-21 12:06 ` Umair Ali
2015-12-21 12:40 ` Gilles Chanteperdrix
2015-12-21 14:29 ` Umair Ali
2015-12-21 20:07 ` 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=5673D046.6090505@xenomai.org \
--to=rpm@xenomai.org \
--cc=ali.umair@tut.fi \
--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.