From: Philippe Gerum <rpm@xenomai.org>
To: Jan Kiszka <jan.kiszka@domain.hid>
Cc: Alexis Berlemont <berlemont.hauw@domain.hid>,
xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] [PATCH v4 02/25] RTDM: Add rtdm_rt_capable() service
Date: Tue, 20 Apr 2010 00:15:41 +0200 [thread overview]
Message-ID: <1271715341.16659.170.camel@domain.hid> (raw)
In-Reply-To: <c6fc15b891bca9854ca9e6f8f7d07960bfcec6a2.1271672940.git.jan.kiszka@domain.hid>
On Mon, 2010-04-19 at 12:28 +0200, Jan Kiszka wrote:
> 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..d124157 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_root_p() || xnshadow_thread(current) != NULL);
> +}
> +
This patch still has fundamental flaw, the service would not work
correctly and would actually return the wrong value, in case it is used
deeply buried into some helper code, traversed by asynchronous Xenomai
contexts. At the very least, you should avoid this by binding that
service to a valid rtdm_dev_context, so that you know that it is called
from a context that is correct in the first place, where a
rtdm_dev_context reference is available.
I.e.
static inline int rtdm_rt_capable(struct rtdm_dev_context *context), and
extract the information from that context structure. That would avoid a
lot of headaches down the road to your user base.
--
Philippe.
next prev parent reply other threads:[~2010-04-19 22:15 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-19 10:28 [Xenomai-core] [PATCH v4 00/25] [git pull v4] RTDM fixes and reworks Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 01/25] RTDM: Fix potential NULL pointer dereference Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 02/25] RTDM: Add rtdm_rt_capable() service Jan Kiszka
2010-04-19 22:15 ` Philippe Gerum [this message]
2010-04-19 23:43 ` Jan Kiszka
2010-04-20 8:19 ` Philippe Gerum
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 03/25] RTDM: Bump API version and document changes Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 04/25] Revert "rtdm: tag syscalls as conforming" Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 05/25] RTDM: Deprecate open_rt, socket_rt, and close_rt Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 06/25] RTIPC: Fix memory leak on failing socket creation Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 07/25] RTIPC: Drop support for RT socket creation/deletion Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 08/25] RTCAN: Drop support for socket creation/deletion in real-time Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 09/25] 16550A: Drop support for device opening/closing " Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 10/25] Analogy: Drop support for " Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 11/25] RTDM: Instrument rtdm_context_lock/unlock to detect misuses Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 12/25] RTDM: Add rtdm_context_put() Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 13/25] Fix historic msleep wrapping Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 14/25] irqbench: Fix x86-64 build Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 15/25] irqbench: Refactor user space helpers Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 16/25] irqbench: Auto-detect bases of port address and IRQ values Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 17/25] rttest: Resolved test device conflicts via separate name spaces Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 18/25] testing: Clean up Kconfig rules Jan Kiszka
2010-04-19 10:28 ` [Xenomai-core] [PATCH v4 19/25] RTIPC: Drop unused wrapper around close_lock_count Jan Kiszka
2010-04-19 10:29 ` [Xenomai-core] [PATCH v4 20/25] RTDM: Document device close procedure Jan Kiszka
2010-04-19 10:29 ` [Xenomai-core] [PATCH v4 21/25] Add list_first_entry wrapper for older kernels Jan Kiszka
2010-04-19 10:29 ` [Xenomai-core] [PATCH v4 22/25] Add legacy kernel support for delayed_work Jan Kiszka
2010-04-19 10:29 ` [Xenomai-core] [PATCH v4 23/25] RTDM: Early fd release with poll-free context reference tracking Jan Kiszka
2010-04-19 10:29 ` [Xenomai-core] [PATCH v4 24/25] RTDM: Add basic unit test Jan Kiszka
2010-04-19 10:29 ` [Xenomai-core] [PATCH v4 25/25] RTDM: Use non-atomic bitops for used_fildes Jan Kiszka
2010-04-19 16:19 ` [Xenomai-core] [PATCH v4 00/25] [git pull v4] RTDM fixes and reworks Gilles Chanteperdrix
2010-04-19 16:46 ` Jan Kiszka
2010-04-19 16:53 ` Gilles Chanteperdrix
2010-04-19 17:04 ` 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=1271715341.16659.170.camel@domain.hid \
--to=rpm@xenomai.org \
--cc=berlemont.hauw@domain.hid \
--cc=jan.kiszka@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.