From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Jeff Weber <jweber@domain.hid>
Cc: Xenomai help <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] Linux system calls from RT kernel task
Date: Thu, 12 Apr 2007 16:24:01 +0200 [thread overview]
Message-ID: <461E4101.1030200@domain.hid> (raw)
In-Reply-To: <200704120818.00897.jweber@domain.hid>
Jeff Weber wrote:
> On Wednesday 11 April 2007 17:35, Dmitry Adamushko wrote:
>
>>On 11/04/07, Jeff Weber <jweber@domain.hid> wrote:
>>
>>>Are there any restrictions against calling the Linux kernel, namely
>>>do_gettimeofday(), from a Xenomai kernel task?
>>>
>>>Does the kernel space task switch from primary to secondary mode, just as
>>>a user space task would?
>>
>>No.
>
> Ok, so is a Xenomai kernel-based thread essentially locked into primary mode?
> And if so, would calls to rt_task_set_mode(T_PRIMARY,0,0) then be illegal?
>
>>Regarding the use of Linux kernel functions, consider it from the
>>point that your rt task (in general, any activity from the primary
>>domain) could have interrupted the Linux kernel at any (well, almost)
>>point.. i.e. some spin_locks can be held by the kernel and if you
>>happen to call a function from the primary domain that does use these
>>locks - well, nothing good is going to happen. In general, it's a no
>>go.
>
> What's the best general way to describe the list of functions that can use
> these locks, so I can avoid this scenario in the future?
The problem does not come only from locks. Real-time tasks can preempt
Linux at any time, and particularily at times when Linux data is not
consistent. So, if you want to play safe, do not use Linux kernel
functions from real-time kernel threads, only use Xenomai services (for
instance, the Xenomai service for getting the current date is
rt_timer_read or clock_gettime(CLOCK_REALTIME)). The exception to this
rule is printk.
--
Gilles Chanteperdrix
next prev parent reply other threads:[~2007-04-12 14:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-11 21:56 [Xenomai-help] Linux system calls from RT kernel task Jeff Weber
2007-04-11 22:35 ` Dmitry Adamushko
2007-04-12 13:18 ` Jeff Weber
2007-04-12 14:05 ` Philippe Gerum
2007-04-12 14:24 ` Gilles Chanteperdrix [this message]
2007-04-12 14:57 ` Jeff Weber
2007-04-12 15:17 ` 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=461E4101.1030200@domain.hid \
--to=gilles.chanteperdrix@xenomai.org \
--cc=jweber@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.