From: Carsten Emde <C.Emde@osadl.org>
To: John Morris <john@zultron.com>
Cc: linux-rt-users@vger.kernel.org
Subject: Re: Detecting PREEMPT_RT
Date: Sun, 20 Jan 2013 02:43:13 +0100 [thread overview]
Message-ID: <50FB4BB1.7070005@osadl.org> (raw)
In-Reply-To: <50FB36A0.7000702@zultron.com>
John,
> I'm part of a project that recently added PREEMPT_RT support (as well as
> Xenomai) to LinuxCNC/EMC2.
>
> The next sub-project is a 'universal binary'. The LCNC real-time module
> will run some checks to determine what RT systems, if any, are available
> on the running kernel, and then load the appropriate RT support module.
>
> We wish to distinguish between PREEMPT_RT and non-RT kernels because
> LCNC must confirm that the kernel really does have realtime
> capabilities, if that's what the user expects, and print big warning
> messages if not. LCNC drives machines that weigh many tons and spins
> spindles at 24k RPM, so this is important!
>
> The RT PREEMPT HOWTO discusses checking the kernel here:
>
> https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO#Checking_the_Kernel
>
> One method is to use string matching against the kernel version, which
> I'm a bit suspicious of.
Unfortunately, this wiki article is old and unmaintained. You're
probably right to be a bit suspicious when checking for the "-rt" suffix
of the kernel release (uname -r). But looking for the occurrence of
"PREEMPT RT" in the kernel version (uname -v) should work. An
application may use the system call uname() and check the version
element of the utsname structure.
In addition you may want to make sure the system has high-resolution
timers. If so, the timers in /proc/timer_list have ".resolution: 1
nsecs". An application may use the function check_timer() from
cyclictest for this purpose:
static int check_timer(void)
{
struct timespec ts;
if (clock_getres(CLOCK_MONOTONIC, &ts))
return 1;
return (ts.tv_sec != 0 || ts.tv_nsec != 1);
}
Hope this helps,
-Carsten.
next prev parent reply other threads:[~2013-01-20 1:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-20 0:13 Detecting PREEMPT_RT John Morris
2013-01-20 1:43 ` Carsten Emde [this message]
2013-01-20 15:52 ` Michael Haberler
2013-01-20 17:32 ` Carsten Emde
2013-01-20 18:39 ` John Morris
2013-01-20 20:18 ` Carsten Emde
2013-01-21 11:36 ` John Kacur
2013-01-21 12:14 ` Michael Haberler
2013-01-21 12:17 ` John Kacur
2013-01-22 10:47 ` Michael Haberler
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=50FB4BB1.7070005@osadl.org \
--to=c.emde@osadl.org \
--cc=john@zultron.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 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.