* [Xenomai] [PATCH] nucleus: Convert intrlock to a sleeping Linux lock
@ 2012-10-17 11:19 Jan Kiszka
2012-10-18 4:37 ` Gilles Chanteperdrix
2012-10-18 17:40 ` [Xenomai] [PATCH v2] " Jan Kiszka
0 siblings, 2 replies; 6+ messages in thread
From: Jan Kiszka @ 2012-10-17 11:19 UTC (permalink / raw)
To: Xenomai
All users of this lock are supposed to run over Linux context already.
Moreover, latest I-pipe patches complain that ipipe_virtualize_irq is
called with the Xenomai domain stalled. So convert this lock to a
sleeping Linux variant to avoid that alarm.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
ksrc/nucleus/intr.c | 22 +++++++++-------------
1 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/ksrc/nucleus/intr.c b/ksrc/nucleus/intr.c
index c75fcac..4747de1 100644
--- a/ksrc/nucleus/intr.c
+++ b/ksrc/nucleus/intr.c
@@ -39,7 +39,7 @@
#define XNINTR_MAX_UNHANDLED 1000
-DEFINE_PRIVATE_XNLOCK(intrlock);
+static DEFINE_BINARY_SEMAPHORE(intrlock);
#ifdef CONFIG_XENO_OPT_STATS
xnintr_t nkclock; /* Only for statistics */
@@ -709,7 +709,6 @@ EXPORT_SYMBOL_GPL(xnintr_destroy);
int xnintr_attach(xnintr_t *intr, void *cookie)
{
int ret;
- spl_t s;
trace_mark(xn_nucleus, irq_attach, "irq %u name %s",
intr->irq, intr->name);
@@ -721,7 +720,7 @@ int xnintr_attach(xnintr_t *intr, void *cookie)
xnarch_set_irq_affinity(intr->irq, nkaffinity);
#endif /* CONFIG_SMP */
- xnlock_get_irqsave(&intrlock, s);
+ down(&intrlock);
if (__testbits(intr->flags, XN_ISR_ATTACHED)) {
ret = -EBUSY;
@@ -735,7 +734,7 @@ int xnintr_attach(xnintr_t *intr, void *cookie)
__setbits(intr->flags, XN_ISR_ATTACHED);
xnintr_stat_counter_inc();
out:
- xnlock_put_irqrestore(&intrlock, s);
+ up(&intrlock);
return ret;
}
@@ -775,11 +774,10 @@ EXPORT_SYMBOL_GPL(xnintr_attach);
int xnintr_detach(xnintr_t *intr)
{
int ret;
- spl_t s;
trace_mark(xn_nucleus, irq_detach, "irq %u", intr->irq);
- xnlock_get_irqsave(&intrlock, s);
+ down(&intrlock);
if (!__testbits(intr->flags, XN_ISR_ATTACHED)) {
ret = -EINVAL;
@@ -794,7 +792,7 @@ int xnintr_detach(xnintr_t *intr)
xnintr_stat_counter_dec();
out:
- xnlock_put_irqrestore(&intrlock, s);
+ up(&intrlock);
return ret;
}
@@ -920,13 +918,12 @@ int xnintr_query_next(int irq, xnintr_iterator_t *iterator, char *name_buf)
xnticks_t last_switch;
int cpu_no = iterator->cpu + 1;
int err = 0;
- spl_t s;
if (cpu_no == xnarch_num_online_cpus())
cpu_no = 0;
iterator->cpu = cpu_no;
- xnlock_get_irqsave(&intrlock, s);
+ down(&intrlock);
if (iterator->list_rev != xnintr_list_rev) {
err = -EAGAIN;
@@ -969,7 +966,7 @@ int xnintr_query_next(int irq, xnintr_iterator_t *iterator, char *name_buf)
iterator->prev = intr;
unlock_and_exit:
- xnlock_put_irqrestore(&intrlock, s);
+ up(&intrlock);
return err;
}
@@ -983,7 +980,6 @@ static inline int format_irq_proc(unsigned int irq,
struct xnvfile_regular_iterator *it)
{
struct xnintr *intr;
- spl_t s;
if (irq == XNARCH_TIMER_IRQ) {
xnvfile_puts(it, " [timer]");
@@ -1005,7 +1001,7 @@ static inline int format_irq_proc(unsigned int irq,
return 0;
}
- xnlock_get_irqsave(&intrlock, s);
+ down(&intrlock);
intr = xnintr_shirq_first(irq);
if (intr) {
@@ -1018,7 +1014,7 @@ static inline int format_irq_proc(unsigned int irq,
} while (intr);
}
- xnlock_put_irqrestore(&intrlock, s);
+ up(&intrlock);
return 0;
}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Xenomai] [PATCH] nucleus: Convert intrlock to a sleeping Linux lock
2012-10-17 11:19 [Xenomai] [PATCH] nucleus: Convert intrlock to a sleeping Linux lock Jan Kiszka
@ 2012-10-18 4:37 ` Gilles Chanteperdrix
2012-10-18 6:11 ` Jan Kiszka
2012-10-18 17:40 ` [Xenomai] [PATCH v2] " Jan Kiszka
1 sibling, 1 reply; 6+ messages in thread
From: Gilles Chanteperdrix @ 2012-10-18 4:37 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Xenomai
On 10/17/2012 01:19 PM, Jan Kiszka wrote:
> All users of this lock are supposed to run over Linux context already.
> Moreover, latest I-pipe patches complain that ipipe_virtualize_irq is
> called with the Xenomai domain stalled. So convert this lock to a
> sleeping Linux variant to avoid that alarm.
Do we really really want such a change in the stable branch?
--
Gilles.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai] [PATCH] nucleus: Convert intrlock to a sleeping Linux lock
2012-10-18 4:37 ` Gilles Chanteperdrix
@ 2012-10-18 6:11 ` Jan Kiszka
2012-10-18 6:21 ` Gilles Chanteperdrix
0 siblings, 1 reply; 6+ messages in thread
From: Jan Kiszka @ 2012-10-18 6:11 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: Xenomai
On 2012-10-18 06:37, Gilles Chanteperdrix wrote:
> On 10/17/2012 01:19 PM, Jan Kiszka wrote:
>
>> All users of this lock are supposed to run over Linux context already.
>> Moreover, latest I-pipe patches complain that ipipe_virtualize_irq is
>> called with the Xenomai domain stalled. So convert this lock to a
>> sleeping Linux variant to avoid that alarm.
>
>
> Do we really really want such a change in the stable branch?
Yes because it fixes a bug (that prevents detecting other bugs).
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai] [PATCH] nucleus: Convert intrlock to a sleeping Linux lock
2012-10-18 6:11 ` Jan Kiszka
@ 2012-10-18 6:21 ` Gilles Chanteperdrix
2012-10-18 6:30 ` Jan Kiszka
0 siblings, 1 reply; 6+ messages in thread
From: Gilles Chanteperdrix @ 2012-10-18 6:21 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Xenomai
On 10/18/2012 08:11 AM, Jan Kiszka wrote:
> On 2012-10-18 06:37, Gilles Chanteperdrix wrote:
>> On 10/17/2012 01:19 PM, Jan Kiszka wrote:
>>
>>> All users of this lock are supposed to run over Linux context already.
>>> Moreover, latest I-pipe patches complain that ipipe_virtualize_irq is
>>> called with the Xenomai domain stalled. So convert this lock to a
>>> sleeping Linux variant to avoid that alarm.
>>
>>
>> Do we really really want such a change in the stable branch?
>
> Yes because it fixes a bug (that prevents detecting other bugs).
The commit log (quoted above) does not say that. It says that it fixes a
warning which really looks like a false positive, and that could be
disabled when compiling legacy versions of Xenomai.
--
Gilles.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai] [PATCH] nucleus: Convert intrlock to a sleeping Linux lock
2012-10-18 6:21 ` Gilles Chanteperdrix
@ 2012-10-18 6:30 ` Jan Kiszka
0 siblings, 0 replies; 6+ messages in thread
From: Jan Kiszka @ 2012-10-18 6:30 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: Xenomai
On 2012-10-18 08:21, Gilles Chanteperdrix wrote:
> On 10/18/2012 08:11 AM, Jan Kiszka wrote:
>> On 2012-10-18 06:37, Gilles Chanteperdrix wrote:
>>> On 10/17/2012 01:19 PM, Jan Kiszka wrote:
>>>
>>>> All users of this lock are supposed to run over Linux context already.
>>>> Moreover, latest I-pipe patches complain that ipipe_virtualize_irq is
>>>> called with the Xenomai domain stalled. So convert this lock to a
>>>> sleeping Linux variant to avoid that alarm.
>>>
>>>
>>> Do we really really want such a change in the stable branch?
>>
>> Yes because it fixes a bug (that prevents detecting other bugs).
>
> The commit log (quoted above) does not say that.
I can improve that.
> It says that it fixes a
> warning which really looks like a false positive, and that could be
> disabled when compiling legacy versions of Xenomai.
Nope as the warning is system wide. And we depend on that self-check to
stabilize I-pipe and Xenomai over new kernel versions.
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Xenomai] [PATCH v2] nucleus: Convert intrlock to a sleeping Linux lock
2012-10-17 11:19 [Xenomai] [PATCH] nucleus: Convert intrlock to a sleeping Linux lock Jan Kiszka
2012-10-18 4:37 ` Gilles Chanteperdrix
@ 2012-10-18 17:40 ` Jan Kiszka
1 sibling, 0 replies; 6+ messages in thread
From: Jan Kiszka @ 2012-10-18 17:40 UTC (permalink / raw)
To: Xenomai
All users of this lock are supposed to run over Linux context already.
Moreover, latest I-pipe patches complain that ipipe_virtualize_irq is
called with the Xenomai domain stalled which invalidates that useful
internal bug check. So convert this lock to a sleeping Linux variant to
avoid the alarm.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
Changes in v2:
- Improved commit message, no code changes
ksrc/nucleus/intr.c | 22 +++++++++-------------
1 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/ksrc/nucleus/intr.c b/ksrc/nucleus/intr.c
index c75fcac..4747de1 100644
--- a/ksrc/nucleus/intr.c
+++ b/ksrc/nucleus/intr.c
@@ -39,7 +39,7 @@
#define XNINTR_MAX_UNHANDLED 1000
-DEFINE_PRIVATE_XNLOCK(intrlock);
+static DEFINE_BINARY_SEMAPHORE(intrlock);
#ifdef CONFIG_XENO_OPT_STATS
xnintr_t nkclock; /* Only for statistics */
@@ -709,7 +709,6 @@ EXPORT_SYMBOL_GPL(xnintr_destroy);
int xnintr_attach(xnintr_t *intr, void *cookie)
{
int ret;
- spl_t s;
trace_mark(xn_nucleus, irq_attach, "irq %u name %s",
intr->irq, intr->name);
@@ -721,7 +720,7 @@ int xnintr_attach(xnintr_t *intr, void *cookie)
xnarch_set_irq_affinity(intr->irq, nkaffinity);
#endif /* CONFIG_SMP */
- xnlock_get_irqsave(&intrlock, s);
+ down(&intrlock);
if (__testbits(intr->flags, XN_ISR_ATTACHED)) {
ret = -EBUSY;
@@ -735,7 +734,7 @@ int xnintr_attach(xnintr_t *intr, void *cookie)
__setbits(intr->flags, XN_ISR_ATTACHED);
xnintr_stat_counter_inc();
out:
- xnlock_put_irqrestore(&intrlock, s);
+ up(&intrlock);
return ret;
}
@@ -775,11 +774,10 @@ EXPORT_SYMBOL_GPL(xnintr_attach);
int xnintr_detach(xnintr_t *intr)
{
int ret;
- spl_t s;
trace_mark(xn_nucleus, irq_detach, "irq %u", intr->irq);
- xnlock_get_irqsave(&intrlock, s);
+ down(&intrlock);
if (!__testbits(intr->flags, XN_ISR_ATTACHED)) {
ret = -EINVAL;
@@ -794,7 +792,7 @@ int xnintr_detach(xnintr_t *intr)
xnintr_stat_counter_dec();
out:
- xnlock_put_irqrestore(&intrlock, s);
+ up(&intrlock);
return ret;
}
@@ -920,13 +918,12 @@ int xnintr_query_next(int irq, xnintr_iterator_t *iterator, char *name_buf)
xnticks_t last_switch;
int cpu_no = iterator->cpu + 1;
int err = 0;
- spl_t s;
if (cpu_no == xnarch_num_online_cpus())
cpu_no = 0;
iterator->cpu = cpu_no;
- xnlock_get_irqsave(&intrlock, s);
+ down(&intrlock);
if (iterator->list_rev != xnintr_list_rev) {
err = -EAGAIN;
@@ -969,7 +966,7 @@ int xnintr_query_next(int irq, xnintr_iterator_t *iterator, char *name_buf)
iterator->prev = intr;
unlock_and_exit:
- xnlock_put_irqrestore(&intrlock, s);
+ up(&intrlock);
return err;
}
@@ -983,7 +980,6 @@ static inline int format_irq_proc(unsigned int irq,
struct xnvfile_regular_iterator *it)
{
struct xnintr *intr;
- spl_t s;
if (irq == XNARCH_TIMER_IRQ) {
xnvfile_puts(it, " [timer]");
@@ -1005,7 +1001,7 @@ static inline int format_irq_proc(unsigned int irq,
return 0;
}
- xnlock_get_irqsave(&intrlock, s);
+ down(&intrlock);
intr = xnintr_shirq_first(irq);
if (intr) {
@@ -1018,7 +1014,7 @@ static inline int format_irq_proc(unsigned int irq,
} while (intr);
}
- xnlock_put_irqrestore(&intrlock, s);
+ up(&intrlock);
return 0;
}
--
1.7.3.4
--
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-10-18 17:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-17 11:19 [Xenomai] [PATCH] nucleus: Convert intrlock to a sleeping Linux lock Jan Kiszka
2012-10-18 4:37 ` Gilles Chanteperdrix
2012-10-18 6:11 ` Jan Kiszka
2012-10-18 6:21 ` Gilles Chanteperdrix
2012-10-18 6:30 ` Jan Kiszka
2012-10-18 17:40 ` [Xenomai] [PATCH v2] " Jan Kiszka
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.