* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
@ 2007-10-24 14:55 ROSSIER Daniel
2007-10-24 15:30 ` Philippe Gerum
2007-10-24 15:56 ` Gilles Chanteperdrix
0 siblings, 2 replies; 23+ messages in thread
From: ROSSIER Daniel @ 2007-10-24 14:55 UTC (permalink / raw)
To: jan.kiszka; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 3026 bytes --]
Hi all,
I've found a bug in arch/arm/xenomai/switch.S which solved the problem below. It actually comes from the iWMMXT (Intel Wireless MMX) coprocessor which is an extension of the ARM core in Xscale processor (and of course which is not available in the AT91 series ;-).
When a thread switch occurs, rthal_thread_switch(in arch/arm/xenomai/switch.S) is called to perform switching of registers and stacks between threads. The PXA version must also perform a switch of MMX registers by invoking iwmmxt_task_switch(in arch/arm/kernel/iwmmxt.S). This is done in rthal_task_switch() as well.
However, between Linux 2.6.15 and Linux 2.6.20, the general scheme of low-level task switching procedure changed a little bit: it is now relying on a call chain notifier-based mechanism. Therefore, the iwmmxt_task_switch() function has been updated since the function is called now from the notifier, and not directly from __switch_to() as in 2.6.15. And the ipipe (ARM) patch did not take into account that.. and it fails.
So, as a first workaround, I simply duplicated the iwmmxt_task_switch() function making the version (from 2.6.15) proprietary to ipipe by renaming to iwmmxt_task_switch_from_ipipe(), and modified arch/arm/xenomai/switch.S accordingly (be careful, switch.S is a symlink and actually belongs to Xenomai tree (ksrc/arch/arm).
It seems to work so far, but further tests are needed (and will be done).
I attached a patch to be applied in the (xenomai-patched) Linux tree.
(Linux 2.6.20, xenomai from today svn).
Daniel
On Mon, 2007-10-22 at 19:07 +0200, Jan Kiszka wrote:
Patrick wrote:
> > Please ignore my first wrong mail ;-)
> >
> >
> >
> > Hi,
> >
> >
> >
> > I am trying to found the bug in xenomai for PXA270 machine (xenomai 2.3.4,
> > ipipe 1.7-06 and kernel 2.6.20).
> >
> >
> >
> > I have localised that the problem is coming when rt_task_create call
> > __ipipe_restore_pipeline_head (called by xnlock_put_irq_restore) in
> > ipipe/core.c.
> >
> > I think that the problem is the call to __clear_bit(IPIPE_STALL_FLAG,
> > &head->cpudata[cpuid].status);
>
> Is it the operation itself or the effect on cpudata.status? I mean, can
> you safely do a __clear_bit followed by a __set_bit, which would rule
> out an invalid memory access?
>
> >
> > If I don't execute this function on the rt_task_create the system doesn't
> > freeze (but my application doesn't work correctly).
> >
> >
> >
> > I don't know what the problem is. Do you have an idea or a suggestion?
>
> At least /me is lacking a full picture. So I would suggest, in order to
> ease the understanding of your scenario for everyone, to
>
> a) post your modification in form of a patch (diff -up).
> b) catch the problematic execution path with the ipipe tracer - now
> that it no longer fails lethally. Just put an ipipe_trace_freeze at
> a point that is unique and close to the hot spot (e.g. after
> rt_task_create.
>
> Jan
>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ipipe_iwmmxt.patch --]
[-- Type: text/x-patch; name="ipipe_iwmmxt.patch", Size: 1757 bytes --]
diff -Naur ../linux-2.6.20-col-xenomai.orig/arch/arm/kernel/iwmmxt.S ./arch/arm/kernel/iwmmxt.S
--- ../linux-2.6.20-col-xenomai.orig/arch/arm/kernel/iwmmxt.S 2007-10-24 15:24:54.000000000 +0200
+++ ./arch/arm/kernel/iwmmxt.S 2007-10-24 14:22:51.000000000 +0200
@@ -293,6 +293,25 @@
mrc p15, 0, r1, c2, c0, 0
sub pc, lr, r1, lsr #32 @ cpwait and return
+ENTRY(iwmmxt_task_switch_from_ipipe)
+
+ mrc p15, 0, r4, c15, c1, 0
+ tst r4, #0x3 @ CP0 and CP1 accessible?
+ bne 1f @ yes: block them for next task
+
+ ldr r5, =concan_owner
+ add r6, r2, #(TI_IWMMXT_STATE - TI_CPU_DOMAIN) @ get next task Concan save area
+ ldr r5, [r5] @ get current Concan owner
+ teq r5, r6 @ next task owns it?
+ movne pc, lr @ no: leave Concan disabled
+
+1: eor r4, r4, #3 @ flip Concan access
+ mcr p15, 0, r4, c15, c1, 0
+
+ mrc p15, 0, r4, c2, c0, 0
+ sub pc, lr, r4, lsr #32 @ cpwait and return
+
+
/*
* Remove Concan ownership of given task
*
diff -Naur ../linux-2.6.20-col-xenomai.orig/arch/arm/xenomai/switch.S ./arch/arm/xenomai/switch.S
--- ../linux-2.6.20-col-xenomai.orig/arch/arm/xenomai/switch.S 2007-10-24 14:25:59.000000000 +0200
+++ ./arch/arm/xenomai/switch.S 2007-10-24 14:57:49.000000000 +0200
@@ -59,6 +59,9 @@
add ip, r1, #TI_CPU_SAVE
ldr r3, [r2, #TI_TP_VALUE]
stmia ip!, {r4 - sl, fp, sp, lr} @ Store most regs on stack
ldr r6, [r2, #TI_CPU_DOMAIN]!
#if __LINUX_ARM_ARCH__ >= 6
#ifdef CONFIG_CPU_MPCORE
@@ -86,7 +89,7 @@
VFPFMXR FPEXC, r4
#endif
#if defined(CONFIG_IWMMXT)
- bl iwmmxt_task_switch
+ bl iwmmxt_task_switch_from_ipipe
#elif defined(CONFIG_CPU_XSCALE)
add r4, r2, #40 @ cpu_context_save->extra
ldmib r4, {r4, r5}
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-24 14:55 [Xenomai-core] Xenomai on Xscale (Linux 2.6.20) ROSSIER Daniel
@ 2007-10-24 15:30 ` Philippe Gerum
2007-10-24 16:25 ` Gilles Chanteperdrix
2007-10-24 15:56 ` Gilles Chanteperdrix
1 sibling, 1 reply; 23+ messages in thread
From: Philippe Gerum @ 2007-10-24 15:30 UTC (permalink / raw)
To: ROSSIER Daniel; +Cc: xenomai
ROSSIER Daniel wrote:
> Hi all,
>
> I've found a bug in arch/arm/xenomai/switch.S which solved the problem below. It actually comes from the iWMMXT (Intel Wireless MMX) coprocessor which is an extension of the ARM core in Xscale processor (and of course which is not available in the AT91 series ;-).
>
> When a thread switch occurs, rthal_thread_switch(in arch/arm/xenomai/switch.S) is called to perform switching of registers and stacks between threads. The PXA version must also perform a switch of MMX registers by invoking iwmmxt_task_switch(in arch/arm/kernel/iwmmxt.S). This is done in rthal_task_switch() as well.
>
> However, between Linux 2.6.15 and Linux 2.6.20, the general scheme of low-level task switching procedure changed a little bit: it is now relying on a call chain notifier-based mechanism. Therefore, the iwmmxt_task_switch() function has been updated since the function is called now from the notifier, and not directly from __switch_to() as in 2.6.15. And the ipipe (ARM) patch did not take into account that.. and it fails.
>
> So, as a first workaround, I simply duplicated the iwmmxt_task_switch() function making the version (from 2.6.15) proprietary to ipipe by renaming to iwmmxt_task_switch_from_ipipe(), and modified arch/arm/xenomai/switch.S accordingly (be careful, switch.S is a symlink and actually belongs to Xenomai tree (ksrc/arch/arm).
>
> It seems to work so far, but further tests are needed (and will be done).
>
> I attached a patch to be applied in the (xenomai-patched) Linux tree.
> (Linux 2.6.20, xenomai from today svn).
>
Task switching is not I-pipe's business, and we should refrain from
recycling code from older kernel versions into recent ones. AFAICS, we
only need to conform to some new internal API. Food for thought below:
--- ksrc/arch/arm/switch.S (revision 3095)
+++ ksrc/arch/arm/switch.S (working copy)
@@ -18,6 +18,7 @@
*/
#include <linux/linkage.h>
+#include <linux/version.h>
#include <asm/assembler.h>
#include <asm/asm-offsets.h>
@@ -86,7 +87,13 @@
VFPFMXR FPEXC, r4
#endif
#if defined(CONFIG_IWMMXT)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
+ mr r0, r2
bl iwmmxt_task_switch
+ mr r2, r0
+#else
+ bl iwmmxt_task_switch
+#endif
#elif defined(CONFIG_CPU_XSCALE)
add r4, r2, #40 @ cpu_context_save->extra
ldmib r4, {r4, r5}
--
Philippe.
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-24 15:30 ` Philippe Gerum
@ 2007-10-24 16:25 ` Gilles Chanteperdrix
2007-10-24 16:45 ` Philippe Gerum
0 siblings, 1 reply; 23+ messages in thread
From: Gilles Chanteperdrix @ 2007-10-24 16:25 UTC (permalink / raw)
To: rpm; +Cc: ROSSIER Daniel, xenomai
On 10/24/07, Philippe Gerum <rpm@xenomai.org> wrote:
> ROSSIER Daniel wrote:
> > Hi all,
> >
> > I've found a bug in arch/arm/xenomai/switch.S which solved the problem below. It actually comes from the iWMMXT (Intel Wireless MMX) coprocessor which is an extension of the ARM core in Xscale processor (and of course which is not available in the AT91 series ;-).
> >
> > When a thread switch occurs, rthal_thread_switch(in arch/arm/xenomai/switch.S) is called to perform switching of registers and stacks between threads. The PXA version must also perform a switch of MMX registers by invoking iwmmxt_task_switch(in arch/arm/kernel/iwmmxt.S). This is done in rthal_task_switch() as well.
> >
> > However, between Linux 2.6.15 and Linux 2.6.20, the general scheme of low-level task switching procedure changed a little bit: it is now relying on a call chain notifier-based mechanism. Therefore, the iwmmxt_task_switch() function has been updated since the function is called now from the notifier, and not directly from __switch_to() as in 2.6.15. And the ipipe (ARM) patch did not take into account that.. and it fails.
> >
> > So, as a first workaround, I simply duplicated the iwmmxt_task_switch() function making the version (from 2.6.15) proprietary to ipipe by renaming to iwmmxt_task_switch_from_ipipe(), and modified arch/arm/xenomai/switch.S accordingly (be careful, switch.S is a symlink and actually belongs to Xenomai tree (ksrc/arch/arm).
> >
> > It seems to work so far, but further tests are needed (and will be done).
> >
> > I attached a patch to be applied in the (xenomai-patched) Linux tree.
> > (Linux 2.6.20, xenomai from today svn).
> >
>
> Task switching is not I-pipe's business, and we should refrain from
> recycling code from older kernel versions into recent ones. AFAICS, we
> only need to conform to some new internal API. Food for thought below:
>
> --- ksrc/arch/arm/switch.S (revision 3095)
> +++ ksrc/arch/arm/switch.S (working copy)
> @@ -18,6 +18,7 @@
> */
>
> #include <linux/linkage.h>
> +#include <linux/version.h>
> #include <asm/assembler.h>
> #include <asm/asm-offsets.h>
>
> @@ -86,7 +87,13 @@
> VFPFMXR FPEXC, r4
> #endif
> #if defined(CONFIG_IWMMXT)
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
> + mr r0, r2
> bl iwmmxt_task_switch
> + mr r2, r0
> +#else
> + bl iwmmxt_task_switch
> +#endif
> #elif defined(CONFIG_CPU_XSCALE)
> add r4, r2, #40 @ cpu_context_save->extra
> ldmib r4, {r4, r5}
By greping THREAD_NOTIFY_SWITCH there appear to be other functions
which should be called upon task switch.
--
Gilles Chanteperdrix
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-24 16:25 ` Gilles Chanteperdrix
@ 2007-10-24 16:45 ` Philippe Gerum
2007-12-03 11:56 ` linux
0 siblings, 1 reply; 23+ messages in thread
From: Philippe Gerum @ 2007-10-24 16:45 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: ROSSIER Daniel, xenomai
Gilles Chanteperdrix wrote:
> On 10/24/07, Philippe Gerum <rpm@xenomai.org> wrote:
>> ROSSIER Daniel wrote:
>>> Hi all,
>>>
>>> I've found a bug in arch/arm/xenomai/switch.S which solved the problem below. It actually comes from the iWMMXT (Intel Wireless MMX) coprocessor which is an extension of the ARM core in Xscale processor (and of course which is not available in the AT91 series ;-).
>>>
>>> When a thread switch occurs, rthal_thread_switch(in arch/arm/xenomai/switch.S) is called to perform switching of registers and stacks between threads. The PXA version must also perform a switch of MMX registers by invoking iwmmxt_task_switch(in arch/arm/kernel/iwmmxt.S). This is done in rthal_task_switch() as well.
>>>
>>> However, between Linux 2.6.15 and Linux 2.6.20, the general scheme of low-level task switching procedure changed a little bit: it is now relying on a call chain notifier-based mechanism. Therefore, the iwmmxt_task_switch() function has been updated since the function is called now from the notifier, and not directly from __switch_to() as in 2.6.15. And the ipipe (ARM) patch did not take into account that.. and it fails.
>>>
>>> So, as a first workaround, I simply duplicated the iwmmxt_task_switch() function making the version (from 2.6.15) proprietary to ipipe by renaming to iwmmxt_task_switch_from_ipipe(), and modified arch/arm/xenomai/switch.S accordingly (be careful, switch.S is a symlink and actually belongs to Xenomai tree (ksrc/arch/arm).
>>>
>>> It seems to work so far, but further tests are needed (and will be done).
>>>
>>> I attached a patch to be applied in the (xenomai-patched) Linux tree.
>>> (Linux 2.6.20, xenomai from today svn).
>>>
>> Task switching is not I-pipe's business, and we should refrain from
>> recycling code from older kernel versions into recent ones. AFAICS, we
>> only need to conform to some new internal API. Food for thought below:
>>
>> --- ksrc/arch/arm/switch.S (revision 3095)
>> +++ ksrc/arch/arm/switch.S (working copy)
>> @@ -18,6 +18,7 @@
>> */
>>
>> #include <linux/linkage.h>
>> +#include <linux/version.h>
>> #include <asm/assembler.h>
>> #include <asm/asm-offsets.h>
>>
>> @@ -86,7 +87,13 @@
>> VFPFMXR FPEXC, r4
>> #endif
>> #if defined(CONFIG_IWMMXT)
>> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
>> + mr r0, r2
>> bl iwmmxt_task_switch
>> + mr r2, r0
>> +#else
>> + bl iwmmxt_task_switch
>> +#endif
>> #elif defined(CONFIG_CPU_XSCALE)
>> add r4, r2, #40 @ cpu_context_save->extra
>> ldmib r4, {r4, r5}
>
> By greping THREAD_NOTIFY_SWITCH there appear to be other functions
> which should be called upon task switch.
>
It looks like per-platform/per-feature stuff. In any case we can't iron
the notifier loop (and the leaf code called) to make it usable in
primary mode. So I'm afraid we likely need to deal with the few platform
dependent spots in our own switch code, since we know which
platform/feature we want to support.
--
Philippe.
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-24 16:45 ` Philippe Gerum
@ 2007-12-03 11:56 ` linux
2007-12-03 13:09 ` Gilles Chanteperdrix
2007-12-03 14:36 ` Patrick
0 siblings, 2 replies; 23+ messages in thread
From: linux @ 2007-12-03 11:56 UTC (permalink / raw)
To: xenomai
I want to use Xenomai on openembedded (2.6.20 or higher) dist. for PXA270 board (compulab CM-X270). The kernel freezes during boottime after the Xenomai nucleus etc is has started, is this bug the cause of this freezing? Must I make the modifications by hand, i can't find them in the svn!
Henk Geraads
--
This message was sent on behalf of linux@domain.hid at openSubscriber.com
http://www.opensubscriber.com/message/xenomai@xenomai.org
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-12-03 11:56 ` linux
@ 2007-12-03 13:09 ` Gilles Chanteperdrix
2007-12-03 14:36 ` Patrick
1 sibling, 0 replies; 23+ messages in thread
From: Gilles Chanteperdrix @ 2007-12-03 13:09 UTC (permalink / raw)
To: linux; +Cc: xenomai
On Dec 3, 2007 12:56 PM, <linux@domain.hid> wrote:
> I want to use Xenomai on openembedded (2.6.20 or higher) dist. for PXA270 board (compulab CM-X270). The kernel freezes during boottime after the Xenomai nucleus etc is has started, is this bug the cause of this freezing? Must I make the modifications by hand, i can't find them in the svn!
If you use xenomai trunk, the bug should be fixed. The fix is in
ksrc/arch/arm/switch.S
--
Gilles Chanteperdrix
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-12-03 11:56 ` linux
2007-12-03 13:09 ` Gilles Chanteperdrix
@ 2007-12-03 14:36 ` Patrick
1 sibling, 0 replies; 23+ messages in thread
From: Patrick @ 2007-12-03 14:36 UTC (permalink / raw)
To: xenomai
I use Xenomai with linux 2.6.20 too on PXA270 machine.
The bug is about context switching with iWMMX coprocessor of PXA and is
corrected in Xenomai 2.4-rc7.
Good luck.
Patrick
-----Message d'origine-----
De : xenomai-core-bounces@domain.hid [mailto:xenomai-core-bounces@domain.hid] De
la part de linux@domain.hid
Envoyé : lundi, 3. décembre 2007 12:56
À : xenomai@xenomai.org
Objet : Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
I want to use Xenomai on openembedded (2.6.20 or higher) dist. for PXA270
board (compulab CM-X270). The kernel freezes during boottime after the
Xenomai nucleus etc is has started, is this bug the cause of this freezing?
Must I make the modifications by hand, i can't find them in the svn!
Henk Geraads
--
This message was sent on behalf of linux@domain.hid at
openSubscriber.com
http://www.opensubscriber.com/message/xenomai@xenomai.org
_______________________________________________
Xenomai-core mailing list
Xenomai-core@domain.hid
https://mail.gna.org/listinfo/xenomai-core
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-24 14:55 [Xenomai-core] Xenomai on Xscale (Linux 2.6.20) ROSSIER Daniel
2007-10-24 15:30 ` Philippe Gerum
@ 2007-10-24 15:56 ` Gilles Chanteperdrix
1 sibling, 0 replies; 23+ messages in thread
From: Gilles Chanteperdrix @ 2007-10-24 15:56 UTC (permalink / raw)
To: ROSSIER Daniel; +Cc: xenomai
On 10/24/07, ROSSIER Daniel <Daniel.Rossier@domain.hid> wrote:
>
> Hi all,
>
> I've found a bug in arch/arm/xenomai/switch.S which solved the problem below. It actually comes from the iWMMXT (Intel Wireless MMX) coprocessor which is an extension of the ARM core in Xscale processor (and of course which is not available in the AT91 series ;-).
>
> When a thread switch occurs, rthal_thread_switch(in arch/arm/xenomai/switch.S) is called to perform switching of registers and stacks between threads. The PXA version must also perform a switch of MMX registers by invoking iwmmxt_task_switch(in arch/arm/kernel/iwmmxt.S). This is done in rthal_task_switch() as well.
>
> However, between Linux 2.6.15 and Linux 2.6.20, the general scheme of low-level task switching procedure changed a little bit: it is now relying on a call chain notifier-based mechanism. Therefore, the iwmmxt_task_switch() function has been updated since the function is called now from the notifier, and not directly from __switch_to() as in 2.6.15. And the ipipe (ARM) patch did not take into account that.. and it fails.
Shame to me, I somehow managed to miss this issue completely.
--
Gilles Chanteperdrix
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
@ 2007-10-22 16:53 Patrick
2007-10-22 17:07 ` Jan Kiszka
2007-10-22 19:36 ` Gilles Chanteperdrix
0 siblings, 2 replies; 23+ messages in thread
From: Patrick @ 2007-10-22 16:53 UTC (permalink / raw)
To: xenomai
[-- Attachment #1: Type: text/plain, Size: 642 bytes --]
Please ignore my first wrong mail ;-)
Hi,
I am trying to found the bug in xenomai for PXA270 machine (xenomai 2.3.4,
ipipe 1.7-06 and kernel 2.6.20).
I have localised that the problem is coming when rt_task_create call
__ipipe_restore_pipeline_head (called by xnlock_put_irq_restore) in
ipipe/core.c.
I think that the problem is the call to __clear_bit(IPIPE_STALL_FLAG,
&head->cpudata[cpuid].status);
If I don't execute this function on the rt_task_create the system doesn't
freeze (but my application doesn't work correctly).
I don't know what the problem is. Do you have an idea or a suggestion?
Thanks
Patrick
[-- Attachment #2: Type: text/html, Size: 4747 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-22 16:53 Patrick
@ 2007-10-22 17:07 ` Jan Kiszka
2007-10-22 19:36 ` Gilles Chanteperdrix
1 sibling, 0 replies; 23+ messages in thread
From: Jan Kiszka @ 2007-10-22 17:07 UTC (permalink / raw)
To: Patrick; +Cc: xenomai
Patrick wrote:
> Please ignore my first wrong mail ;-)
>
>
>
> Hi,
>
>
>
> I am trying to found the bug in xenomai for PXA270 machine (xenomai 2.3.4,
> ipipe 1.7-06 and kernel 2.6.20).
>
>
>
> I have localised that the problem is coming when rt_task_create call
> __ipipe_restore_pipeline_head (called by xnlock_put_irq_restore) in
> ipipe/core.c.
>
> I think that the problem is the call to __clear_bit(IPIPE_STALL_FLAG,
> &head->cpudata[cpuid].status);
Is it the operation itself or the effect on cpudata.status? I mean, can
you safely do a __clear_bit followed by a __set_bit, which would rule
out an invalid memory access?
>
> If I don't execute this function on the rt_task_create the system doesn't
> freeze (but my application doesn't work correctly).
>
>
>
> I don't know what the problem is. Do you have an idea or a suggestion?
At least /me is lacking a full picture. So I would suggest, in order to
ease the understanding of your scenario for everyone, to
a) post your modification in form of a patch (diff -up).
b) catch the problematic execution path with the ipipe tracer - now
that it no longer fails lethally. Just put an ipipe_trace_freeze at
a point that is unique and close to the hot spot (e.g. after
rt_task_create.
Jan
--
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-22 16:53 Patrick
2007-10-22 17:07 ` Jan Kiszka
@ 2007-10-22 19:36 ` Gilles Chanteperdrix
1 sibling, 0 replies; 23+ messages in thread
From: Gilles Chanteperdrix @ 2007-10-22 19:36 UTC (permalink / raw)
To: Patrick; +Cc: xenomai
Patrick wrote:
> Please ignore my first wrong mail ;-)
>
>
>
> Hi,
>
>
>
> I am trying to found the bug in xenomai for PXA270 machine (xenomai 2.3.4,
> ipipe 1.7-06 and kernel 2.6.20).
>
>
>
> I have localised that the problem is coming when rt_task_create call
> __ipipe_restore_pipeline_head (called by xnlock_put_irq_restore) in
> ipipe/core.c.
>
> I think that the problem is the call to __clear_bit(IPIPE_STALL_FLAG,
> &head->cpudata[cpuid].status);
>
> If I don't execute this function on the rt_task_create the system doesn't
> freeze (but my application doesn't work correctly).
This point (xnlock_put_irqrestore in rt_task_create) is the point where
the escalation virq is handled in Xenomai domain and xnpod_schedule
switches to the new task. So, by not clearing the stall bit, you prevent
this virq from being handled. What comes after xnlock_put_irqrestore
should be xnpod_schedule_handler in pod.c.
--
Gilles Chanteperdrix.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
@ 2007-10-11 16:35 ROSSIER Daniel
2007-10-11 17:00 ` Philippe Gerum
2007-10-11 17:02 ` Jan Kiszka
0 siblings, 2 replies; 23+ messages in thread
From: ROSSIER Daniel @ 2007-10-11 16:35 UTC (permalink / raw)
To: xenomai
Hi everyone,
I'm taking over the original thread from Patrick concerning the port of
Xenomai on Xscale with Linux 2.6.20. Briefly summarized, the boot
process actually freezes after a while right after the nucleus has been
started.
I've investigated the issue over the last hours, and I came up with the
following conclusion: it seems that the problem is due to a endless loop
in do_gettimeofday in arch/arm/kernel/time.c. Here is the code:
"...
do {
seq = read_seqbegin_irqsave(&xtime_lock, flags);
usec = system_timer->offset();
sec = xtime.tv_sec;
usec += xtime.tv_nsec / 1000;
} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
..."
If I remove the do { } while loop with the call to
read_seqbegin_irqsave(), then the boot process is going ahead (I got a
suspicious error like "I-pipe: Detected illicit call from domain
'Xenomai' " but it might well be normal with such a modification.
I checked with the code from a 2.6.15 kernel, and it is basically the
same structure.
Any idea about the cause of this problem?
I checked the timer IRQs and other pipeline activity, and everything
seems to be OK. By the way, if I disable the nucleus, Linux is working
properly (timer not being stolen by I-pipe).
Thanks in advance for any help.
Cheers
Daniel
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-11 16:35 ROSSIER Daniel
@ 2007-10-11 17:00 ` Philippe Gerum
2007-10-12 12:28 ` Daniel Rossier
2007-10-11 17:02 ` Jan Kiszka
1 sibling, 1 reply; 23+ messages in thread
From: Philippe Gerum @ 2007-10-11 17:00 UTC (permalink / raw)
To: ROSSIER Daniel; +Cc: xenomai
On Thu, 2007-10-11 at 18:35 +0200, ROSSIER Daniel wrote:
> Hi everyone,
>
> I'm taking over the original thread from Patrick concerning the port of
> Xenomai on Xscale with Linux 2.6.20. Briefly summarized, the boot
> process actually freezes after a while right after the nucleus has been
> started.
>
> I've investigated the issue over the last hours, and I came up with the
> following conclusion: it seems that the problem is due to a endless loop
> in do_gettimeofday in arch/arm/kernel/time.c. Here is the code:
>
> "...
> do {
> seq = read_seqbegin_irqsave(&xtime_lock, flags);
> usec = system_timer->offset();
> sec = xtime.tv_sec;
> usec += xtime.tv_nsec / 1000;
> } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
> ..."
>
> If I remove the do { } while loop with the call to
> read_seqbegin_irqsave(), then the boot process is going ahead (I got a
> suspicious error like "I-pipe: Detected illicit call from domain
> 'Xenomai' " but it might well be normal with such a modification.
>
> I checked with the code from a 2.6.15 kernel, and it is basically the
> same structure.
>
> Any idea about the cause of this problem?
>
That's typical of someone from the real-time (Xenomai) domain spuriously
calling into this routine, which is illegal.
The usual scenario for the lockup to happen is:
- Linux task A calls into some code grabbing the xtime lock for writing
- Xenomai preempts task A before it releases the seqlock, e.g. to
process an interrupt
- some code on behalf of the Xenomai IRQ handler calls into
do_gettimeofday, which is wrong
- the culprit gets a reader lock sequence token, which will never match
the quiescent state. This will cause an infinite loop, since task A
can't get out the critical section to put the sequence in a quiescent
state again, until the Xenomai code relinquishes the CPU. Catch #22.
You likely need to chase the code who triggers the "Detected illicit
domain" message, likely in some code also calling do_gettimeofday().
> I checked the timer IRQs and other pipeline activity, and everything
> seems to be OK. By the way, if I disable the nucleus, Linux is working
> properly (timer not being stolen by I-pipe).
>
> Thanks in advance for any help.
>
> Cheers
> Daniel
>
> _______________________________________________
> Xenomai-core mailing list
> Xenomai-core@domain.hid
> https://mail.gna.org/listinfo/xenomai-core
--
Philippe.
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-11 17:00 ` Philippe Gerum
@ 2007-10-12 12:28 ` Daniel Rossier
2007-10-12 12:43 ` Gilles Chanteperdrix
0 siblings, 1 reply; 23+ messages in thread
From: Daniel Rossier @ 2007-10-12 12:28 UTC (permalink / raw)
To: rpm; +Cc: xenomai
Philippe Gerum wrote:
> On Thu, 2007-10-11 at 18:35 +0200, ROSSIER Daniel wrote:
> > Hi everyone,
> >
> > I'm taking over the original thread from Patrick concerning the
> > port of Xenomai on Xscale with Linux 2.6.20. Briefly summarized,
> > the boot process actually freezes after a while right after the
> > nucleus has been started.
> >
> > I've investigated the issue over the last hours, and I came up with
> > the following conclusion: it seems that the problem is due to a
> > endless loop in do_gettimeofday in arch/arm/kernel/time.c. Here is
> > the code:
> >
> > "... do { seq = read_seqbegin_irqsave(&xtime_lock, flags); usec =
> > system_timer->offset(); sec = xtime.tv_sec; usec += xtime.tv_nsec /
> > 1000; } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
> > ..."
> >
> > If I remove the do { } while loop with the call to
> > read_seqbegin_irqsave(), then the boot process is going ahead (I
> > got a suspicious error like "I-pipe: Detected illicit call from
> > domain 'Xenomai' " but it might well be normal with such a
> > modification.
> >
> > I checked with the code from a 2.6.15 kernel, and it is basically
> > the same structure.
> >
> > Any idea about the cause of this problem?
> >
>
> That's typical of someone from the real-time (Xenomai) domain
> spuriously calling into this routine, which is illegal.
>
> The usual scenario for the lockup to happen is: - Linux task A calls
> into some code grabbing the xtime lock for writing - Xenomai preempts
> task A before it releases the seqlock, e.g. to process an interrupt -
> some code on behalf of the Xenomai IRQ handler calls into
> do_gettimeofday, which is wrong - the culprit gets a reader lock
> sequence token, which will never match the quiescent state. This will
> cause an infinite loop, since task A can't get out the critical
> section to put the sequence in a quiescent state again, until the
> Xenomai code relinquishes the CPU. Catch #22.
>
> You likely need to chase the code who triggers the "Detected illicit
> domain" message, likely in some code also calling do_gettimeofday().
>
Ok I'll do it. What I find weird is that the the do_gettimeofday() is
called by xnpod_start_timer(kernel/xenomai/nucleus/pod.c). It is
therefore called from the RT domain
but at the initialization time. My interpretation is that the timer
interrupts arrived during the invokation
of xnpod_start_timer(), which are propagated to the Linux domain. There,
the timer handler
is probably accessing do_gettimeofday() - to be proved - before the
xnarch_start_timer() has finished, which may (but should not) lead to a
potential deadend...
> > I checked the timer IRQs and other pipeline activity, and
> > everything seems to be OK. By the way, if I disable the nucleus,
> > Linux is working properly (timer not being stolen by I-pipe).
> >
> > Thanks in advance for any help.
> >
> > Cheers Daniel
> >
> > _______________________________________________ Xenomai-core
> > mailing list Xenomai-core@domain.hid
> > https://mail.gna.org/listinfo/xenomai-core
Daniel
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-12 12:28 ` Daniel Rossier
@ 2007-10-12 12:43 ` Gilles Chanteperdrix
0 siblings, 0 replies; 23+ messages in thread
From: Gilles Chanteperdrix @ 2007-10-12 12:43 UTC (permalink / raw)
To: Daniel Rossier; +Cc: xenomai
On 10/12/07, Daniel Rossier <daniel.rossier@domain.hid> wrote:
> Philippe Gerum wrote:
> > On Thu, 2007-10-11 at 18:35 +0200, ROSSIER Daniel wrote:
> > > Hi everyone,
> > >
> > > I'm taking over the original thread from Patrick concerning the
> > > port of Xenomai on Xscale with Linux 2.6.20. Briefly summarized,
> > > the boot process actually freezes after a while right after the
> > > nucleus has been started.
> > >
> > > I've investigated the issue over the last hours, and I came up with
> > > the following conclusion: it seems that the problem is due to a
> > > endless loop in do_gettimeofday in arch/arm/kernel/time.c. Here is
> > > the code:
> > >
> > > "... do { seq = read_seqbegin_irqsave(&xtime_lock, flags); usec =
> > > system_timer->offset(); sec = xtime.tv_sec; usec += xtime.tv_nsec /
> > > 1000; } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
> > > ..."
> > >
> > > If I remove the do { } while loop with the call to
> > > read_seqbegin_irqsave(), then the boot process is going ahead (I
> > > got a suspicious error like "I-pipe: Detected illicit call from
> > > domain 'Xenomai' " but it might well be normal with such a
> > > modification.
> > >
> > > I checked with the code from a 2.6.15 kernel, and it is basically
> > > the same structure.
> > >
> > > Any idea about the cause of this problem?
> > >
> >
> > That's typical of someone from the real-time (Xenomai) domain
> > spuriously calling into this routine, which is illegal.
> >
> > The usual scenario for the lockup to happen is: - Linux task A calls
> > into some code grabbing the xtime lock for writing - Xenomai preempts
> > task A before it releases the seqlock, e.g. to process an interrupt -
> > some code on behalf of the Xenomai IRQ handler calls into
> > do_gettimeofday, which is wrong - the culprit gets a reader lock
> > sequence token, which will never match the quiescent state. This will
> > cause an infinite loop, since task A can't get out the critical
> > section to put the sequence in a quiescent state again, until the
> > Xenomai code relinquishes the CPU. Catch #22.
> >
> > You likely need to chase the code who triggers the "Detected illicit
> > domain" message, likely in some code also calling do_gettimeofday().
> >
>
> Ok I'll do it. What I find weird is that the the do_gettimeofday() is
> called by xnpod_start_timer(kernel/xenomai/nucleus/pod.c). It is
xnpod_start_timer is called at module initialization time or by
threads running in secondary mode, so, calling do_gettimeofday should
not cause any problem. xnpod_start_timer documentation states this
very clearly.
--
Gilles Chanteperdrix
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-11 16:35 ROSSIER Daniel
2007-10-11 17:00 ` Philippe Gerum
@ 2007-10-11 17:02 ` Jan Kiszka
2007-10-12 11:48 ` Daniel Rossier
1 sibling, 1 reply; 23+ messages in thread
From: Jan Kiszka @ 2007-10-11 17:02 UTC (permalink / raw)
To: ROSSIER Daniel; +Cc: xenomai
ROSSIER Daniel wrote:
> Hi everyone,
>
> I'm taking over the original thread from Patrick concerning the port of
> Xenomai on Xscale with Linux 2.6.20. Briefly summarized, the boot
> process actually freezes after a while right after the nucleus has been
> started.
>
> I've investigated the issue over the last hours, and I came up with the
> following conclusion: it seems that the problem is due to a endless loop
> in do_gettimeofday in arch/arm/kernel/time.c. Here is the code:
>
> "...
> do {
> seq = read_seqbegin_irqsave(&xtime_lock, flags);
> usec = system_timer->offset();
> sec = xtime.tv_sec;
> usec += xtime.tv_nsec / 1000;
> } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
> ..."
>
> If I remove the do { } while loop with the call to
> read_seqbegin_irqsave(), then the boot process is going ahead (I got a
> suspicious error like "I-pipe: Detected illicit call from domain
> 'Xenomai' " but it might well be normal with such a modification.
Please post the full oops about that "illicit call". It may point to an
otherwise hidden invalid usage of Linux services over the Xenomai domain
and explain the lock-up.
Jan
--
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-11 17:02 ` Jan Kiszka
@ 2007-10-12 11:48 ` Daniel Rossier
2007-10-12 12:34 ` Gilles Chanteperdrix
0 siblings, 1 reply; 23+ messages in thread
From: Daniel Rossier @ 2007-10-12 11:48 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai
Jan Kiszka wrote:
> ROSSIER Daniel wrote:
> > Hi everyone,
> >
> > I'm taking over the original thread from Patrick concerning the
> > port of Xenomai on Xscale with Linux 2.6.20. Briefly summarized,
> > the boot process actually freezes after a while right after the
> > nucleus has been started.
> >
> > I've investigated the issue over the last hours, and I came up with
> > the following conclusion: it seems that the problem is due to a
> > endless loop in do_gettimeofday in arch/arm/kernel/time.c. Here is
> > the code:
> >
> > "... do { seq = read_seqbegin_irqsave(&xtime_lock, flags); usec =
> > system_timer->offset(); sec = xtime.tv_sec; usec += xtime.tv_nsec /
> > 1000; } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
> > ..."
> >
> > If I remove the do { } while loop with the call to
> > read_seqbegin_irqsave(), then the boot process is going ahead (I
> > got a suspicious error like "I-pipe: Detected illicit call from
> > domain 'Xenomai' " but it might well be normal with such a
> > modification.
>
> Please post the full oops about that "illicit call". It may point to
> an otherwise hidden invalid usage of Linux services over the Xenomai
> domain and explain the lock-up.
Sure; here is the output message:
"
I-pipe: Detected illicit call from domain 'Xenomai'
into a service reserved for domain 'Linux' and below.
[<c0027328>] (show_stack+0x0/0x40) from [<c005d590>]
(ipipe_check_context+0x88/0xa4)
[<c005d508>] (ipipe_check_context+0x0/0xa4) from [<c002d9e4>]
(__ipipe_mach_set_dec+0x24/0x7c)
r5 = 54503BD0 r4 = 00003029
[<c002d9c0>] (__ipipe_mach_set_dec+0x0/0x7c) from [<c00681e0>]
(xntimer_do_tick_aperiodic+0x2f4/0x33c)
r4 = 00003029
[<c0067eec>] (xntimer_do_tick_aperiodic+0x0/0x33c) from [<c0062b48>]
(xnpod_announce_tick+0x24/0xb8)
[<c0062b24>] (xnpod_announce_tick+0x0/0xb8) from [<c00604ec>]
(xnintr_irq_handler+0x50/0x1b8)
r6 = 00005E73 r5 = C02FA3D4 r4 = C02F8220
[<c006049c>] (xnintr_irq_handler+0x0/0x1b8) from [<c0060670>]
(xnintr_clock_handler+0x1c/0x24)
[<c0060654>] (xnintr_clock_handler+0x0/0x24) from [<c005dc0c>]
(__ipipe_sync_stage+0x1f8/0x27c)
[<c005da14>] (__ipipe_sync_stage+0x0/0x27c) from [<c005dd10>]
(ipipe_suspend_domain+0x80/0xb0)
[<c005dc90>] (ipipe_suspend_domain+0x0/0xb0) from [<c005dd9c>]
(__ipipe_walk_pipeline+0x5c/0xc0)
r6 = 00000000 r5 = C02D72C0 r4 = C02F8220
[<c005dd40>] (__ipipe_walk_pipeline+0x0/0xc0) from [<c005e264>]
(__ipipe_restore_pipeline_head+0xac/0xc8)
r8 = 00000000 r7 = C0068228 r6 = 00000000 r5 = 00989680
r4 = C02FB37C
[<c005e1b8>] (__ipipe_restore_pipeline_head+0x0/0xc8) from [<c0062430>]
(xnpod_start_timer+0x2e8/0x33c)
[<c0062148>] (xnpod_start_timer+0x0/0x33c) from [<c00624c4>]
(xnpod_reset_timer+0x40/0x54)
[<c0062484>] (xnpod_reset_timer+0x0/0x54) from [<c0065c7c>]
(xnpod_init+0x42c/0x478)
r4 = 00000000
[<c0065850>] (xnpod_init+0x0/0x478) from [<c006a934>]
(__native_skin_init+0x20/0xf8)
[<c006a914>] (__native_skin_init+0x0/0xf8) from [<c00220c4>]
(init+0x98/0x27c)
r4 = C001CA04
[<c002202c>] (init+0x0/0x27c) from [<c003c588>] (do_exit+0x0/0x898)
r7 = 00000000 r6 = 00000000 r5 = 00000000 r4 = 00000000
"
>
> Jan
>
Daniel
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-12 11:48 ` Daniel Rossier
@ 2007-10-12 12:34 ` Gilles Chanteperdrix
2007-10-12 12:46 ` Daniel Rossier
0 siblings, 1 reply; 23+ messages in thread
From: Gilles Chanteperdrix @ 2007-10-12 12:34 UTC (permalink / raw)
To: Daniel Rossier; +Cc: xenomai
On 10/12/07, Daniel Rossier <daniel.rossier@domain.hid> wrote:
> Jan Kiszka wrote:
> > ROSSIER Daniel wrote:
> > > Hi everyone,
> > >
> > > I'm taking over the original thread from Patrick concerning the
> > > port of Xenomai on Xscale with Linux 2.6.20. Briefly summarized,
> > > the boot process actually freezes after a while right after the
> > > nucleus has been started.
> > >
> > > I've investigated the issue over the last hours, and I came up with
> > > the following conclusion: it seems that the problem is due to a
> > > endless loop in do_gettimeofday in arch/arm/kernel/time.c. Here is
> > > the code:
> > >
> > > "... do { seq = read_seqbegin_irqsave(&xtime_lock, flags); usec =
> > > system_timer->offset(); sec = xtime.tv_sec; usec += xtime.tv_nsec /
> > > 1000; } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
> > > ..."
> > >
> > > If I remove the do { } while loop with the call to
> > > read_seqbegin_irqsave(), then the boot process is going ahead (I
> > > got a suspicious error like "I-pipe: Detected illicit call from
> > > domain 'Xenomai' " but it might well be normal with such a
> > > modification.
> >
> > Please post the full oops about that "illicit call". It may point to
> > an otherwise hidden invalid usage of Linux services over the Xenomai
> > domain and explain the lock-up.
>
> Sure; here is the output message:
> "
> I-pipe: Detected illicit call from domain 'Xenomai'
> into a service reserved for domain 'Linux' and below.
> [<c0027328>] (show_stack+0x0/0x40) from [<c005d590>]
> (ipipe_check_context+0x88/0xa4)
> [<c005d508>] (ipipe_check_context+0x0/0xa4) from [<c002d9e4>]
> (__ipipe_mach_set_dec+0x24/0x7c)
> r5 = 54503BD0 r4 = 00003029
> [<c002d9c0>] (__ipipe_mach_set_dec+0x0/0x7c) from [<c00681e0>]
> (xntimer_do_tick_aperiodic+0x2f4/0x33c)
> r4 = 00003029
This does not make sense, __ipipe_mach_set_dec is a very simple
function that should not trigger this illicit call.
--
Gilles Chanteperdrix
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-12 12:34 ` Gilles Chanteperdrix
@ 2007-10-12 12:46 ` Daniel Rossier
2007-10-12 13:14 ` Gilles Chanteperdrix
0 siblings, 1 reply; 23+ messages in thread
From: Daniel Rossier @ 2007-10-12 12:46 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai
Gilles Chanteperdrix wrote:
> On 10/12/07, Daniel Rossier <daniel.rossier@domain.hid> wrote:
> > Jan Kiszka wrote:
> >> ROSSIER Daniel wrote:
> >>> Hi everyone,
> >>>
> >>> I'm taking over the original thread from Patrick concerning the
> >>> port of Xenomai on Xscale with Linux 2.6.20. Briefly
> >>> summarized, the boot process actually freezes after a while
> >>> right after the nucleus has been started.
> >>>
> >>> I've investigated the issue over the last hours, and I came up
> >>> with the following conclusion: it seems that the problem is due
> >>> to a endless loop in do_gettimeofday in arch/arm/kernel/time.c.
> >>> Here is the code:
> >>>
> >>> "... do { seq = read_seqbegin_irqsave(&xtime_lock, flags); usec
> >>> = system_timer->offset(); sec = xtime.tv_sec; usec +=
> >>> xtime.tv_nsec / 1000; } while
> >>> (read_seqretry_irqrestore(&xtime_lock, seq, flags)); ..."
> >>>
> >>> If I remove the do { } while loop with the call to
> >>> read_seqbegin_irqsave(), then the boot process is going ahead
> >>> (I got a suspicious error like "I-pipe: Detected illicit call
> >>> from domain 'Xenomai' " but it might well be normal with such a
> >>> modification.
> >> Please post the full oops about that "illicit call". It may point
> >> to an otherwise hidden invalid usage of Linux services over the
> >> Xenomai domain and explain the lock-up.
> > Sure; here is the output message: " I-pipe: Detected illicit call
> > from domain 'Xenomai' into a service reserved for domain 'Linux'
> > and below. [<c0027328>] (show_stack+0x0/0x40) from [<c005d590>]
> > (ipipe_check_context+0x88/0xa4) [<c005d508>]
> > (ipipe_check_context+0x0/0xa4) from [<c002d9e4>]
> > (__ipipe_mach_set_dec+0x24/0x7c) r5 = 54503BD0 r4 = 00003029
> > [<c002d9c0>] (__ipipe_mach_set_dec+0x0/0x7c) from [<c00681e0>]
> > (xntimer_do_tick_aperiodic+0x2f4/0x33c) r4 = 00003029
>
> This does not make sense, __ipipe_mach_set_dec is a very simple
> function that should not trigger this illicit call.
>
Exactly Gilles! Now I solved this bug. Having a look at the
__ipipe_mach_set_dec() showed me
an invokation to write_seqlock(&xtime_lock) !! I don't know why...
As Philippe said, it is not allowed. I changed with
local_irq_save_hw(flags) (as it is in the 2.6.15) and there is no
deadlock anymore...
Unfortunately, it still freezes a bit later, but I can go forward. I'll
be reporting my investigations.
Thanks a lot
Daniel
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-12 12:46 ` Daniel Rossier
@ 2007-10-12 13:14 ` Gilles Chanteperdrix
2007-10-13 15:34 ` ROSSIER Daniel
2007-10-22 16:38 ` Patrick
0 siblings, 2 replies; 23+ messages in thread
From: Gilles Chanteperdrix @ 2007-10-12 13:14 UTC (permalink / raw)
To: Daniel Rossier; +Cc: xenomai
On 10/12/07, Daniel Rossier <daniel.rossier@domain.hid> wrote:
> Gilles Chanteperdrix wrote:
> > On 10/12/07, Daniel Rossier <daniel.rossier@domain.hid> wrote:
> > > Jan Kiszka wrote:
> > >> ROSSIER Daniel wrote:
> > >>> Hi everyone,
> > >>>
> > >>> I'm taking over the original thread from Patrick concerning the
> > >>> port of Xenomai on Xscale with Linux 2.6.20. Briefly
> > >>> summarized, the boot process actually freezes after a while
> > >>> right after the nucleus has been started.
> > >>>
> > >>> I've investigated the issue over the last hours, and I came up
> > >>> with the following conclusion: it seems that the problem is due
> > >>> to a endless loop in do_gettimeofday in arch/arm/kernel/time.c.
> > >>> Here is the code:
> > >>>
> > >>> "... do { seq = read_seqbegin_irqsave(&xtime_lock, flags); usec
> > >>> = system_timer->offset(); sec = xtime.tv_sec; usec +=
> > >>> xtime.tv_nsec / 1000; } while
> > >>> (read_seqretry_irqrestore(&xtime_lock, seq, flags)); ..."
> > >>>
> > >>> If I remove the do { } while loop with the call to
> > >>> read_seqbegin_irqsave(), then the boot process is going ahead
> > >>> (I got a suspicious error like "I-pipe: Detected illicit call
> > >>> from domain 'Xenomai' " but it might well be normal with such a
> > >>> modification.
> > >> Please post the full oops about that "illicit call". It may point
> > >> to an otherwise hidden invalid usage of Linux services over the
> > >> Xenomai domain and explain the lock-up.
> > > Sure; here is the output message: " I-pipe: Detected illicit call
> > > from domain 'Xenomai' into a service reserved for domain 'Linux'
> > > and below. [<c0027328>] (show_stack+0x0/0x40) from [<c005d590>]
> > > (ipipe_check_context+0x88/0xa4) [<c005d508>]
> > > (ipipe_check_context+0x0/0xa4) from [<c002d9e4>]
> > > (__ipipe_mach_set_dec+0x24/0x7c) r5 = 54503BD0 r4 = 00003029
> > > [<c002d9c0>] (__ipipe_mach_set_dec+0x0/0x7c) from [<c00681e0>]
> > > (xntimer_do_tick_aperiodic+0x2f4/0x33c) r4 = 00003029
> >
> > This does not make sense, __ipipe_mach_set_dec is a very simple
> > function that should not trigger this illicit call.
> >
>
> Exactly Gilles! Now I solved this bug. Having a look at the
> __ipipe_mach_set_dec() showed me
> an invokation to write_seqlock(&xtime_lock) !! I don't know why...
>
> As Philippe said, it is not allowed. I changed with
> local_irq_save_hw(flags) (as it is in the 2.6.15) and there is no
> deadlock anymore...
I read I-pipe 2.6.20 arm 1.7-06, and there is no
write_seq_lock(&xtime_lock) either. Are you sure the patch applied
cleanly ?
--
Gilles Chanteperdrix
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-12 13:14 ` Gilles Chanteperdrix
@ 2007-10-13 15:34 ` ROSSIER Daniel
2007-10-13 17:06 ` Gilles Chanteperdrix
2007-10-22 16:38 ` Patrick
1 sibling, 1 reply; 23+ messages in thread
From: ROSSIER Daniel @ 2007-10-13 15:34 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai
On Fri, 2007-10-12 at 15:14 +0200, Gilles Chanteperdrix wrote:
On 10/12/07, Daniel Rossier <daniel.rossier@domain.hid> wrote:
> > Gilles Chanteperdrix wrote:
> > > On 10/12/07, Daniel Rossier <daniel.rossier@domain.hid> wrote:
> > > > Jan Kiszka wrote:
> > > >> ROSSIER Daniel wrote:
> > > >>> Hi everyone,
> > > >>>
> > > >>> I'm taking over the original thread from Patrick concerning the
> > > >>> port of Xenomai on Xscale with Linux 2.6.20. Briefly
> > > >>> summarized, the boot process actually freezes after a while
> > > >>> right after the nucleus has been started.
> > > >>>
> > > >>> I've investigated the issue over the last hours, and I came up
> > > >>> with the following conclusion: it seems that the problem is due
> > > >>> to a endless loop in do_gettimeofday in arch/arm/kernel/time.c.
> > > >>> Here is the code:
> > > >>>
> > > >>> "... do { seq = read_seqbegin_irqsave(&xtime_lock, flags); usec
> > > >>> = system_timer->offset(); sec = xtime.tv_sec; usec +=
> > > >>> xtime.tv_nsec / 1000; } while
> > > >>> (read_seqretry_irqrestore(&xtime_lock, seq, flags)); ..."
> > > >>>
> > > >>> If I remove the do { } while loop with the call to
> > > >>> read_seqbegin_irqsave(), then the boot process is going ahead
> > > >>> (I got a suspicious error like "I-pipe: Detected illicit call
> > > >>> from domain 'Xenomai' " but it might well be normal with such a
> > > >>> modification.
> > > >> Please post the full oops about that "illicit call". It may point
> > > >> to an otherwise hidden invalid usage of Linux services over the
> > > >> Xenomai domain and explain the lock-up.
> > > > Sure; here is the output message: " I-pipe: Detected illicit call
> > > > from domain 'Xenomai' into a service reserved for domain 'Linux'
> > > > and below. [<c0027328>] (show_stack+0x0/0x40) from [<c005d590>]
> > > > (ipipe_check_context+0x88/0xa4) [<c005d508>]
> > > > (ipipe_check_context+0x0/0xa4) from [<c002d9e4>]
> > > > (__ipipe_mach_set_dec+0x24/0x7c) r5 = 54503BD0 r4 = 00003029
> > > > [<c002d9c0>] (__ipipe_mach_set_dec+0x0/0x7c) from [<c00681e0>]
> > > > (xntimer_do_tick_aperiodic+0x2f4/0x33c) r4 = 00003029
> > >
> > > This does not make sense, __ipipe_mach_set_dec is a very simple
> > > function that should not trigger this illicit call.
> > >
> >
> > Exactly Gilles! Now I solved this bug. Having a look at the
> > __ipipe_mach_set_dec() showed me
> > an invokation to write_seqlock(&xtime_lock) !! I don't know why...
> >
> > As Philippe said, it is not allowed. I changed with
> > local_irq_save_hw(flags) (as it is in the 2.6.15) and there is no
> > deadlock anymore...
>
> I read I-pipe 2.6.20 arm 1.7-06, and there is no
> write_seq_lock(&xtime_lock) either. Are you sure the patch applied
> cleanly ?
>
>
>
Yeap! Shame on me. I had to go to fast with manipulations and pasted a wrong line. BUT, I found the real bug, and this time I checked with the original patch ;-). (btw, everything was coherent in the bug tracking, small consolation!)
Now, there is actually a mistake in arch/arm/mach-pxa/time.c
The __ipipe_mach_get_tsc() function failed because a bad declaration of "union tsc_reg". The two fields (long high, long low) have been decomposed with an intermediate short mid field. The PXA version of get_tsc() function does not use the "mid" field as it is the case with the AT91 version of get_tsc() from the at91 processor.
Hence, I simply put the two high/low fields as two longs, and it works.
Here is the new version of this type:
union tsc_reg {
#ifdef __BIG_ENDIAN
struct {
unsigned long high;
/*unsigned short mid;*/
/*unsigned short low;*/
unsigned long low;
};
#else /* __LITTLE_ENDIAN */
struct {
unsigned long low;
/*unsigned short low;*/
/*unsigned short mid;*/
unsigned long high;
};
#endif /* __LITTLE_ENDIAN */
unsigned long long full;
};
We will continue to test Xenomai on the PXA over the next weeks with the PXA/DSP board for automation applications developed by Patrick for his diploma work.
Thanks for your help and support.
Cheers
Daniel
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-13 15:34 ` ROSSIER Daniel
@ 2007-10-13 17:06 ` Gilles Chanteperdrix
0 siblings, 0 replies; 23+ messages in thread
From: Gilles Chanteperdrix @ 2007-10-13 17:06 UTC (permalink / raw)
To: ROSSIER Daniel; +Cc: xenomai
ROSSIER Daniel wrote:
>
> On Fri, 2007-10-12 at 15:14 +0200, Gilles Chanteperdrix wrote:
> On 10/12/07, Daniel Rossier <daniel.rossier@domain.hid> wrote:
> > > Gilles Chanteperdrix wrote:
> > > > On 10/12/07, Daniel Rossier <daniel.rossier@domain.hid> wrote:
> > > > > Jan Kiszka wrote:
> > > > >> ROSSIER Daniel wrote:
> > > > >>> Hi everyone,
> > > > >>>
> > > > >>> I'm taking over the original thread from Patrick concerning the
> > > > >>> port of Xenomai on Xscale with Linux 2.6.20. Briefly
> > > > >>> summarized, the boot process actually freezes after a while
> > > > >>> right after the nucleus has been started.
> > > > >>>
> > > > >>> I've investigated the issue over the last hours, and I came up
> > > > >>> with the following conclusion: it seems that the problem is due
> > > > >>> to a endless loop in do_gettimeofday in arch/arm/kernel/time.c.
> > > > >>> Here is the code:
> > > > >>>
> > > > >>> "... do { seq = read_seqbegin_irqsave(&xtime_lock, flags); usec
> > > > >>> = system_timer->offset(); sec = xtime.tv_sec; usec +=
> > > > >>> xtime.tv_nsec / 1000; } while
> > > > >>> (read_seqretry_irqrestore(&xtime_lock, seq, flags)); ..."
> > > > >>>
> > > > >>> If I remove the do { } while loop with the call to
> > > > >>> read_seqbegin_irqsave(), then the boot process is going ahead
> > > > >>> (I got a suspicious error like "I-pipe: Detected illicit call
> > > > >>> from domain 'Xenomai' " but it might well be normal with such a
> > > > >>> modification.
> > > > >> Please post the full oops about that "illicit call". It may point
> > > > >> to an otherwise hidden invalid usage of Linux services over the
> > > > >> Xenomai domain and explain the lock-up.
> > > > > Sure; here is the output message: " I-pipe: Detected illicit call
> > > > > from domain 'Xenomai' into a service reserved for domain 'Linux'
> > > > > and below. [<c0027328>] (show_stack+0x0/0x40) from [<c005d590>]
> > > > > (ipipe_check_context+0x88/0xa4) [<c005d508>]
> > > > > (ipipe_check_context+0x0/0xa4) from [<c002d9e4>]
> > > > > (__ipipe_mach_set_dec+0x24/0x7c) r5 = 54503BD0 r4 = 00003029
> > > > > [<c002d9c0>] (__ipipe_mach_set_dec+0x0/0x7c) from [<c00681e0>]
> > > > > (xntimer_do_tick_aperiodic+0x2f4/0x33c) r4 = 00003029
> > > >
> > > > This does not make sense, __ipipe_mach_set_dec is a very simple
> > > > function that should not trigger this illicit call.
> > > >
> > >
> > > Exactly Gilles! Now I solved this bug. Having a look at the
> > > __ipipe_mach_set_dec() showed me
> > > an invokation to write_seqlock(&xtime_lock) !! I don't know why...
> > >
> > > As Philippe said, it is not allowed. I changed with
> > > local_irq_save_hw(flags) (as it is in the 2.6.15) and there is no
> > > deadlock anymore...
> >
> > I read I-pipe 2.6.20 arm 1.7-06, and there is no
> > write_seq_lock(&xtime_lock) either. Are you sure the patch applied
> > cleanly ?
> >
> >
> >
> Yeap! Shame on me. I had to go to fast with manipulations and pasted a wrong line. BUT, I found the real bug, and this time I checked with the original patch ;-). (btw, everything was coherent in the bug tracking, small consolation!)
>
> Now, there is actually a mistake in arch/arm/mach-pxa/time.c
> The __ipipe_mach_get_tsc() function failed because a bad declaration of "union tsc_reg". The two fields (long high, long low) have been decomposed with an intermediate short mid field. The PXA version of get_tsc() function does not use the "mid" field as it is the case with the AT91 version of get_tsc() from the at91 processor.
>
> Hence, I simply put the two high/low fields as two longs, and it works.
>
> Here is the new version of this type:
>
> union tsc_reg {
> #ifdef __BIG_ENDIAN
> struct {
> unsigned long high;
> /*unsigned short mid;*/
> /*unsigned short low;*/
> unsigned long low;
> };
> #else /* __LITTLE_ENDIAN */
> struct {
> unsigned long low;
> /*unsigned short low;*/
> /*unsigned short mid;*/
> unsigned long high;
> };
> #endif /* __LITTLE_ENDIAN */
> unsigned long long full;
> };
adeos-ipipe-2.6.20-arm-1.7-05 had this problem, it is solved in
adeos-ipipe-2.6.20-arm-1.7-06.
--
Gilles Chanteperdrix.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Xenomai-core] Xenomai on Xscale (Linux 2.6.20)
2007-10-12 13:14 ` Gilles Chanteperdrix
2007-10-13 15:34 ` ROSSIER Daniel
@ 2007-10-22 16:38 ` Patrick
1 sibling, 0 replies; 23+ messages in thread
From: Patrick @ 2007-10-22 16:38 UTC (permalink / raw)
To: xenomai
Hi,
I am trying to found the bug in xenomai for PXA270 machine (xenomai 2.3.4,
ipipe 1.7-06 and kernel 2.6.20).
I have localised than when rt_task_create call __ipipe_restore_pipeline_head
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2007-12-03 14:36 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-24 14:55 [Xenomai-core] Xenomai on Xscale (Linux 2.6.20) ROSSIER Daniel
2007-10-24 15:30 ` Philippe Gerum
2007-10-24 16:25 ` Gilles Chanteperdrix
2007-10-24 16:45 ` Philippe Gerum
2007-12-03 11:56 ` linux
2007-12-03 13:09 ` Gilles Chanteperdrix
2007-12-03 14:36 ` Patrick
2007-10-24 15:56 ` Gilles Chanteperdrix
-- strict thread matches above, loose matches on Subject: below --
2007-10-22 16:53 Patrick
2007-10-22 17:07 ` Jan Kiszka
2007-10-22 19:36 ` Gilles Chanteperdrix
2007-10-11 16:35 ROSSIER Daniel
2007-10-11 17:00 ` Philippe Gerum
2007-10-12 12:28 ` Daniel Rossier
2007-10-12 12:43 ` Gilles Chanteperdrix
2007-10-11 17:02 ` Jan Kiszka
2007-10-12 11:48 ` Daniel Rossier
2007-10-12 12:34 ` Gilles Chanteperdrix
2007-10-12 12:46 ` Daniel Rossier
2007-10-12 13:14 ` Gilles Chanteperdrix
2007-10-13 15:34 ` ROSSIER Daniel
2007-10-13 17:06 ` Gilles Chanteperdrix
2007-10-22 16:38 ` Patrick
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.