Skip to contentSkip to conversation

Xenomai on Xscale (Linux 2.6.20)

Xenomai-core ROSSIER Daniel 5 participants 12 messages Oct 11, 2007 – Oct 22, 2007

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 25 lines · ROSSIER Daniel

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.

Quoted 5 lines

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().

Quoted 13 lines

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
[email protected]
https://mail.gna.org/listinfo/xenomai-core

Signature · 1 line
Philippe.
#2 lore raw
Quoted 43 lines · Philippe Gerum
Quoted 23 lines · ROSSIER Daniel

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.

Quoted 5 lines

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.

Quoted 3 lines

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...

Quoted 11 lines
Quoted 11 lines

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 [email protected]
https://mail.gna.org/listinfo/xenomai-core

Daniel

#3 lore raw
Quoted 44 lines · Daniel Rossier
Quoted 43 lines · Philippe Gerum
Quoted 23 lines · ROSSIER Daniel

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.

Quoted 5 lines

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.

Quoted 6 lines
Quoted 3 lines

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.

Signature · 1 line
                                               Gilles Chanteperdrix
#4 lore raw
In reply to ROSSIER Daniel
Quoted 18 lines · ROSSIER Daniel

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));
Quoted 6 lines

..."

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

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#5 lore raw
Quoted 24 lines · Jan Kiszka
Quoted 17 lines · ROSSIER Daniel

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)); ..."

Quoted 5 lines

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.

Quoted 3 lines

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
"

Quoted 3 lines

Jan

Daniel

#6 lore raw
Quoted 29 lines · Daniel Rossier
Quoted 24 lines · Jan Kiszka
Quoted 17 lines · ROSSIER Daniel

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)); ..."

Quoted 5 lines

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.

Quoted 3 lines

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.

Quoted 12 lines

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.

Signature · 1 line
                                               Gilles Chanteperdrix
#7 lore raw
Quoted 37 lines · Gilles Chanteperdrix
Quoted 27 lines · Daniel Rossier
Quoted 18 lines · Jan Kiszka
Quoted 17 lines · ROSSIER Daniel

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)); ..."

Quoted 8 lines
Quoted 5 lines

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.

Quoted 8 lines

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

Quoted 3 lines

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

#8 lore raw
Quoted 42 lines · Daniel Rossier
Quoted 37 lines · Gilles Chanteperdrix
Quoted 27 lines · Daniel Rossier
Quoted 18 lines · Jan Kiszka
Quoted 17 lines · ROSSIER Daniel

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)); ..."

Quoted 8 lines
Quoted 5 lines

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.

Quoted 8 lines

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

Quoted 3 lines

This does not make sense, __ipipe_mach_set_dec is a very simple function that should not trigger this illicit call.

Quoted 7 lines

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 ?

Signature · 1 line
                                               Gilles Chanteperdrix
#9 lore raw

On Fri, 2007-10-12 at 15:14 +0200, Gilles Chanteperdrix wrote:

Quoted 46 lines · Daniel Rossier
Quoted 46 lines
Quoted 37 lines · Gilles Chanteperdrix
Quoted 27 lines · Daniel Rossier
Quoted 18 lines · Jan Kiszka
Quoted 17 lines · ROSSIER Daniel

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)); ..."

Quoted 8 lines
Quoted 5 lines

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.

Quoted 8 lines

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

Quoted 3 lines

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...

Quoted 10 lines
Quoted 3 lines

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

#10 lore raw
Quoted 78 lines · ROSSIER Daniel

On Fri, 2007-10-12 at 15:14 +0200, Gilles Chanteperdrix wrote:

Quoted 46 lines · Daniel Rossier
Quoted 46 lines
Quoted 37 lines · Gilles Chanteperdrix
Quoted 27 lines · Daniel Rossier
Quoted 18 lines · Jan Kiszka
Quoted 17 lines · ROSSIER Daniel

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)); ..."

Quoted 8 lines
Quoted 5 lines

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.

Quoted 8 lines

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

Quoted 3 lines

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...

Quoted 10 lines
Quoted 3 lines

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 {
Quoted 8 lines
		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.

Signature · 1 line
					    Gilles Chanteperdrix.
#11 lore raw
In reply to Gilles Chanteperdrix

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