From: Jan Kiszka <jan.kiszka@domain.hid>
To: Philippe Gerum <rpm@xenomai.org>
Cc: Alexis Berlemont <berlemont.hauw@domain.hid>,
xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] [PATCH v3 02/24] RTDM: Add rtdm_rt_capable() service
Date: Sun, 18 Apr 2010 15:40:16 +0200 [thread overview]
Message-ID: <4BCB0BC0.3000101@domain.hid> (raw)
In-Reply-To: <1271597409.16659.37.camel@domain.hid>
[-- Attachment #1: Type: text/plain, Size: 2121 bytes --]
Philippe Gerum wrote:
> On Sun, 2010-04-18 at 15:26 +0200, Philippe Gerum wrote:
>> On Sun, 2010-04-18 at 15:12 +0200, Jan Kiszka wrote:
>>> From: Jan Kiszka <jan.kiszka@domain.hid>
>>>
>>> This adds rtdm_rt_capable(), a function that can be used by drivers to
>>> detect callers that could issue a service request also from the
>>> (typically preferred) real-time context. If that is the case, the driver
>>> can trigger a restart of the request if the current context is not
>>> real-time.
>>>
>>> CC: Philippe Gerum <rpm@xenomai.org>
>>> CC: Alexis Berlemont <berlemont.hauw@domain.hid>
>>> Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
>>> ---
>>> include/rtdm/rtdm_driver.h | 6 ++++++
>>> ksrc/skins/rtdm/drvlib.c | 25 +++++++++++++++++++++++++
>>> 2 files changed, 31 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/include/rtdm/rtdm_driver.h b/include/rtdm/rtdm_driver.h
>>> index 0fc1496..45be404 100644
>>> --- a/include/rtdm/rtdm_driver.h
>>> +++ b/include/rtdm/rtdm_driver.h
>>> @@ -1296,6 +1296,12 @@ static inline int rtdm_in_rt_context(void)
>>> {
>>> return (rthal_current_domain != rthal_root_domain);
>>> }
>>> +
>>> +static inline int rtdm_rt_capable(void)
>>> +{
>>> + return xnpod_shadow_p();
>>> +}
>>> +
>> This won't do what your comment states; xnpod_shadow_p() would always
>> return false on behalf of a relaxed shadow, since it tests the status
>> bits of the current Xenomai thread, which has to be the root one in that
>> case. xnpod_shadow_p is to be used in primary context only, to
>> distinguish between kernel-based and userland Xenomai callers.
>>
>> What you want is probably something like:
>>
>> static inline int rtdm_rt_capable(void)
>> {
>> return xnshadow_thread(current) != NULL;
>> }
>
> Btw, the predicate as you defined it would not work over kernel-based
> Xenomai threads. rtdm_rt_capable() is ambiguous here.
(!xnpod_root_p() || xnshadow_thread(current) != NULL) ?
That would also avoid dereferencing current in a potentially unsafe
context (if we still have such problematic archs).
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
next prev parent reply other threads:[~2010-04-18 13:40 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-18 13:12 [Xenomai-core] [PATCH v3 00/24] [git pull v3] RTDM fixes and reworks Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 01/24] RTDM: Fix potential NULL pointer dereference Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 02/24] RTDM: Add rtdm_rt_capable() service Jan Kiszka
2010-04-18 13:26 ` Philippe Gerum
2010-04-18 13:30 ` Philippe Gerum
2010-04-18 13:40 ` Jan Kiszka [this message]
2010-04-18 21:09 ` Philippe Gerum
2010-04-19 7:31 ` Jan Kiszka
2010-04-19 7:37 ` Philippe Gerum
2010-04-19 7:39 ` Philippe Gerum
2010-04-18 13:30 ` Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 03/24] RTDM: Bump API version and document changes Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 04/24] Revert "rtdm: tag syscalls as conforming" Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 05/24] RTDM: Deprecate open_rt, socket_rt, and close_rt Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 06/24] RTIPC: Fix memory leak on failing socket creation Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 07/24] RTIPC: Drop support for RT socket creation/deletion Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 08/24] RTCAN: Drop support for socket creation/deletion in real-time Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 09/24] 16550A: Drop support for device opening/closing " Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 10/24] Analogy: Drop support for " Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 11/24] RTDM: Instrument rtdm_context_lock/unlock to detect misuses Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 12/24] RTDM: Add rtdm_context_put() Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 13/24] Fix historic msleep wrapping Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 14/24] irqbench: Fix x86-64 build Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 15/24] irqbench: Refactor user space helpers Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 16/24] irqbench: Auto-detect bases of port address and IRQ values Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 17/24] rttest: Resolved test device conflicts via separate name spaces Jan Kiszka
2010-04-18 17:13 ` Gilles Chanteperdrix
2010-04-18 17:28 ` Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 18/24] testing: Clean up Kconfig rules Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 19/24] RTIPC: Drop unused wrapper around close_lock_count Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 20/24] RTDM: Document device close procedure Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 21/24] Add list_first_entry wrapper for older kernels Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 22/24] Add legacy kernel support for delayed_work Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 23/24] RTDM: Early fd release with poll-free context reference tracking Jan Kiszka
2010-04-18 17:18 ` Gilles Chanteperdrix
2010-04-18 17:28 ` Jan Kiszka
2010-04-18 13:12 ` [Xenomai-core] [PATCH v3 24/24] RTDM: Add basic unit test Jan Kiszka
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=4BCB0BC0.3000101@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=berlemont.hauw@domain.hid \
--cc=rpm@xenomai.org \
--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.