From: Jan Kiszka <jan.kiszka@domain.hid>
To: "Li Yi (Adam)" <liyiadam@domain.hid>
Cc: xenomai-help <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] Sychronize between Linux and Xenomai domain
Date: Mon, 10 Jul 2006 11:07:17 +0200 [thread overview]
Message-ID: <44B218C5.9000804@domain.hid> (raw)
In-Reply-To: <4546494d0607100148s1f5476e3tb3f58d7ae48d4a72@domain.hid>
[-- Attachment #1: Type: text/plain, Size: 1769 bytes --]
Li Yi (Adam) wrote:
> Thanks Jan.
>
> You mentioned:
> "Depends on what you have to protect. The easiest way for short code
> passages are still spinlocks with hard IRQ protection (under RTDM:
> rtdm_lock_xxx). "
>
> I read the code of rtdm_lock_xxx and find it mapped to spin_lock. If I
> understand correctly,
>
> a RTDM driver using:
> rtdm_lock_get(&my_lock);
>
> a normal linux driver using
> spin_lock(&my_lock);
>
> Can be used to protect some shared data structure between RTDM real-time
> driver in Xenomai Domain
> and a normal Linux driver, right?
Yep. See also real-world examples in existing RTDM drivers.
>
> I just started to write a RTDM driver, and I am not sure what existing
> linux
> kernel services
> I can use in the RTDM driver, e.g, wait queue, semaphores, request_dma(),
> free_dma(), etc.
> I have concern that the RTDM driver may not synchronize with linux kernel,
> since it will
> preempt Linux kernel whenever the HW interrupt is not masked.
> Is there any guideline there?
Keep in mind that Linux may have been preempted AT ANY POINT when your
driver executes some code in hard real-time mode. Therefore, calling
almost all Linux services from RT context must be considered unsafe
(unfortunately, it often works fine in practice, just fails/crashes
"magically" from time to time).
But it's usually not required to do so as most of Linux interaction can
be performed during init/cleanup. Just register your open/socket and
close handler as "_nrt" so that they are only executed in pure Linux or
secondary mode, and you can run whatever Linux service you like.
If you encounter any Linux service that you have to call for your driver
from IRQ or RT context, please report.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
next prev parent reply other threads:[~2006-07-10 9:07 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-10 6:16 [Xenomai-help] Sychronize between Linux and Xenomai domain Li Yi (Adam)
2006-07-10 7:11 ` Jan Kiszka
2006-07-10 8:48 ` Li Yi (Adam)
2006-07-10 9:07 ` Jan Kiszka [this message]
2006-07-10 9:31 ` Li Yi (Adam)
2006-07-10 9:44 ` Jan Kiszka
2006-07-11 4:25 ` Li Yi (Adam)
2006-07-11 6:14 ` Jan Kiszka
2006-07-11 6:48 ` Li Yi (Adam)
2006-07-11 6:53 ` Li Yi (Adam)
2006-07-11 7:29 ` Jan Kiszka
2006-07-11 7:43 ` Li Yi (Adam)
2006-07-11 7:47 ` Jan Kiszka
2006-07-12 1:51 ` Li Yi (Adam)
2006-07-12 6:34 ` Jan Kiszka
2006-07-12 7:34 ` Li Yi (Adam)
2006-07-12 7:51 ` Jan Kiszka
2006-07-12 8:24 ` Li Yi (Adam)
2006-07-12 8:51 ` Jan Kiszka
2006-07-14 8:37 ` Philippe Gerum
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=44B218C5.9000804@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=liyiadam@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.