From: Jan Kiszka <jan.kiszka@siemens.com>
To: Philippe Gerum <rpm@xenomai.org>, Xenomai <xenomai@xenomai.org>
Subject: [Xenomai] [PATCH] rtdm: Restrict/clarify usage of rtdm_irq_request/free/enable/disable
Date: Thu, 20 Sep 2012 14:32:32 +0200 [thread overview]
Message-ID: <505B0CE0.4080100@siemens.com> (raw)
We cannot support line enabling/disabling over non-Linux contexts for
all IRQ types (e.g.: changes to legacy MSIs). Requesting and releasing
IRQs includes enabling/disabling them, so we better avoid conflicts by
restricting the usage of rtdm_irq_request/free.
On the other hand, there are users of rtdm_irq_enable/disable over
interrupt context for supported IRQ types. Therefore, clarify the
documentation of those functions that even more extreme care has to be
applied when relying on them.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
include/rtdm/rtdm_driver.h | 1 +
ksrc/skins/rtdm/drvlib.c | 16 ++++++++++------
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/include/rtdm/rtdm_driver.h b/include/rtdm/rtdm_driver.h
index 68135e4..3006d59 100644
--- a/include/rtdm/rtdm_driver.h
+++ b/include/rtdm/rtdm_driver.h
@@ -899,6 +899,7 @@ int rtdm_irq_request(rtdm_irq_t *irq_handle, unsigned int irq_no,
#ifndef DOXYGEN_CPP /* Avoid static inline tags for RTDM in doxygen */
static inline int rtdm_irq_free(rtdm_irq_t *irq_handle)
{
+ XENO_ASSERT(RTDM, xnpod_root_p(), return -EPERM;);
return xnintr_detach(irq_handle);
}
diff --git a/ksrc/skins/rtdm/drvlib.c b/ksrc/skins/rtdm/drvlib.c
index 4b74042..e5c470c 100644
--- a/ksrc/skins/rtdm/drvlib.c
+++ b/ksrc/skins/rtdm/drvlib.c
@@ -1617,8 +1617,7 @@ EXPORT_SYMBOL_GPL(rtdm_mutex_timedlock);
* This service can be called from:
*
* - Kernel module initialization/cleanup code
- * - Kernel-based task
- * - User-space task (RT, non-RT)
+ * - User-space task (non-RT)
*
* Rescheduling: never.
*/
@@ -1628,6 +1627,8 @@ int rtdm_irq_request(rtdm_irq_t *irq_handle, unsigned int irq_no,
{
int err;
+ XENO_ASSERT(RTDM, xnpod_root_p(), return -EPERM;);
+
xnintr_init(irq_handle, device_name, irq_no, handler, NULL, flags);
err = xnintr_attach(irq_handle, arg);
@@ -1661,8 +1662,7 @@ EXPORT_SYMBOL_GPL(rtdm_irq_request);
* This service can be called from:
*
* - Kernel module initialization/cleanup code
- * - Kernel-based task
- * - User-space task (RT, non-RT)
+ * - User-space task (non-RT)
*
* Rescheduling: never.
*/
@@ -1679,7 +1679,9 @@ int rtdm_irq_free(rtdm_irq_t *irq_handle);
* interrupt masking at device level (via corresponding control registers etc.)
* over masking at line level. Keep in mind that the latter is incompatible
* with IRQ line sharing and can also be more costly as interrupt controller
- * access requires broader synchronization.
+ * access requires broader synchronization. Also, certain IRQ types may not
+ * allow the invocation over RT and interrupt contexts. The caller is
+ * responsible for excluding such conflicts.
*
* Environments:
*
@@ -1705,7 +1707,9 @@ int rtdm_irq_enable(rtdm_irq_t *irq_handle);
* interrupt masking at device level (via corresponding control registers etc.)
* over masking at line level. Keep in mind that the latter is incompatible
* with IRQ line sharing and can also be more costly as interrupt controller
- * access requires broader synchronization.
+ * access requires broader synchronization. Also, certain IRQ types may not
+ * allow the invocation over RT and interrupt contexts. The caller is
+ * responsible for excluding such conflicts.
*
* Environments:
*
--
1.7.3.4
reply other threads:[~2012-09-20 12:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=505B0CE0.4080100@siemens.com \
--to=jan.kiszka@siemens.com \
--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.