From: Frank Rowand <frowand.list@gmail.com>
To: Camera.Geomatics@leica-geosystems.com
Cc: linux-rt-users@vger.kernel.org
Subject: Re: Latency measurement with oscilloscope, randomly high latency times
Date: Thu, 18 Dec 2014 20:14:52 -0800 [thread overview]
Message-ID: <5493A63C.5030005@gmail.com> (raw)
In-Reply-To: <OFDF470C3A.9CBABFAA-ONC1257DB2.005370FE-C1257DB2.00538C5D@leica-geosystems.com>
On 12/18/2014 7:12 AM, Camera.Geomatics@leica-geosystems.com wrote:
> Hi
>
> We try to achieve hard real time requirements with a
> FPGA->IRQ->ISR->User-Space->Kernel-Module->FPGA loop.
>
> Kernel IRQ handler which toggles IO pins is executed by a Hardware
> interrupt every 200us (FPGA). Priority is set to 99 via chrt ?f ?p99
> pid-module.
>
> Problem:
> The test is working (Pins are toggled in time, <50us), but for some reason
>
> we have randomly (every 2-3sec) big latency times of several ms.
Often, the easiest way to identify the big latencies is to run
cyclictest, using its debug facilities such as ftrace triggering.
For a several ms latency you might want to start with hwlatdetect
to check for SMIs. But it is possible to get large latencies
from other causes than SMIs.
But I would start with adjusting the IRQ handler priority, as you
suspected you might need to (see below).
>
> We sometimes get already interrupted in our IRQ handler (which we
> registered with request_irq) before we wakeup our user space task.
>
> Kernel Version: linux-socfpga 3.10.37-ltsi-rt37
> Development board: Altera Cyclone V SoC Development Kit
>
> Do we have to somehow set the priority 99 for the IRQ handler seperately?
> Is there any kind of priority inheritance from user space task to kernel
> module?
First off, you should not use priority 99 unless you _really_ understand
what that is doing to the other kernel threads that are priority 99 (they
have that priority for a reason).
Yes, you need to set the priority of your IRQ handler thread to the
value that you decide is appropriate. If your IRQ handler or the
other parts of your real time application depend on services from
other kernel threads, you may need to adjust the priority of those
threads.
"The user space task" is causing the kernel module to execute by doing
a system call, correct? Thus the current task while executing the
kernel module code is the "user space task", so the priority is the
"user space task" priority. This is assuming that there is nothing
in the path from the syscall to the kernel module acting on the FPGA
that is asynchronous (for example, the kernel module could pass a
message to a kernel thread that acts on the FPGA).
>
> Best Regards
> Hannes
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
prev parent reply other threads:[~2014-12-19 4:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-18 15:12 Latency measurement with oscilloscope, randomly high latency times Camera.Geomatics
2014-12-19 4:14 ` Frank Rowand [this message]
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=5493A63C.5030005@gmail.com \
--to=frowand.list@gmail.com \
--cc=Camera.Geomatics@leica-geosystems.com \
--cc=linux-rt-users@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).