Sporadic PC freeze after rt_task_start
Quoted 6 lines
Mathias, I guess this test has not been run with the nucleus debug option enabled. Any chance to get a disassembly of the
rpi_poproutine as compiled into your kernel, so that we could check if we are really stuck on this lock, or rather on some infinite walk into a corrupted RPI list?
I tried last week with debug on and I did not get the freeze...
However, I will try again. I will enable all Xeno debug options (CONFIG_XENO_OPT_DEBUG, CONFIG_XENO_OPT_DEBUG_NUCLEUS, CONFIG_XENO_OPT_DEBUG_QUEUE, CONFIG_XENO_OPT_WATCHDOG) and run the test again...
For this test I leave CONFIG_XENO_OPT_RPIDISABLE unset (default).
I hope to have more information on the results tomorrow morning...
Regards
Mathias
Signature · 9 lines
Mathias Koehrer [email protected] Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: günstig und schnell mit DSL - das All-Inclusive-Paket für clevere Doppel-Sparer, nur 39,85 € inkl. DSL- und ISDN-Grundgebühr! http://www.arcor.de/rd/emf-dsl-2
Quoted 6 lines · M. Koehrer
Quoted 6 lines
Mathias, I guess this test has not been run with the nucleus debug option enabled. Any chance to get a disassembly of the
rpi_poproutine as compiled into your kernel, so that we could check if we are really stuck on this lock, or rather on some infinite walk into a corrupted RPI list?
Quoted 7 lines
I tried last week with debug on and I did not get the freeze...
However, I will try again. I will enable all Xeno debug options (CONFIG_XENO_OPT_DEBUG,CONFIG_XENO_OPT_DEBUG_NUCLEUS,CONFIG_XENO_OPT_DEBUG_QUEUE,CONFIG_XENO_OPT_WATCHDOG) and run the test again...For this test I leave
CONFIG_XENO_OPT_RPIDISABLEunset (default).
Yes.
Quoted 2 lines
I hope to have more information on the results tomorrow morning...
Ok, thanks. Meanwhile, there is some more thought on our side to fix the locking sequence. Catch-22 looks so close.
Quoted 4 lines
Regards
Mathias
Signature · 1 line
Philippe.
Hi all,
I got a freeze after 30 minutes running...
The bad thing is, that the PC was frozen but no Oops message was printed out... This did not help at all...
I will run my system again with nmi_disable=1 (and the kernel debug active) to see if I can catch a freeze...
Regards
Mathias
Quoted 19 lines
Quoted 4 lines
Quoted 4 lines
Mathias, I guess this test has not been run with the nucleus debug option enabled. Any chance to get a disassembly of the
rpi_poproutine as compiled into your kernel, so that we could check if we are really stuck on this lock, or rather on some infinite walk into a corruptedRPI
Quoted 3 lines
Quoted 1 line
list?
I tried last week with debug on and I did not get the freeze... However, I will try again. I will enable all Xeno debug options
(
CONFIG_XENO_OPT_DEBUG,Quoted 5 lines
CONFIG_XENO_OPT_DEBUG_NUCLEUS,CONFIG_XENO_OPT_DEBUG_QUEUE,CONFIG_XENO_OPT_WATCHDOG) and run the test again...For this test I leave
CONFIG_XENO_OPT_RPIDISABLEunset (default).Yes.
Quoted 2 lines
I hope to have more information on the results tomorrow morning...
Signature · 9 lines
Mathias Koehrer [email protected] Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: günstig und schnell mit DSL - das All-Inclusive-Paket für clevere Doppel-Sparer, nur 39,85 € inkl. DSL- und ISDN-Grundgebühr! http://www.arcor.de/rd/emf-dsl-2
[Xenomai-core] RPI is good for you
Mathias,
Could you try applying the attached patch against v2.3.2, and run your box using the failing configuration. This patch is a _preliminary_ attempt at fixing two major issues, it is not complete, and may not even be fully correct since it does not address all the pending issues yet. Still, I would be interested to know whether I'm on the right path, and if it changes something to your problem, without making your box jump out of the window, that is.
TIA,
Signature · 1 line
Philippe.
skins/psos+/task.c +0 -7
@@ -288,13 +288,6 @@ goto unlock_and_exit; } -#if defined(__KERNEL__) && defined(CONFIG_XENO_OPT_PERVASIVE ) -if (xnthread_user_task (&task->threadbase) !=NULL - && !xnthread_test_state (&task->threadbase,XNDORMANT ) - && (!xnpod_primary_p () || task !=psos_current_task ())) -xnshadow_send_sig (&task->threadbase,SIGKILL ,1 ); -#endif /* __KERNEL__ && CONFIG_XENO_OPT_PERVASIVE */ -xnpod_delete_thread (&task->threadbase); unlock_and_exit:
skins/vxworks/taskLib.c +0 -7
@@ -285,13 +285,6 @@ goto error; } -#if defined(__KERNEL__) && defined(CONFIG_XENO_OPT_PERVASIVE ) -if (xnthread_user_task (&task->threadbase) !=NULL - && !xnthread_test_state (&task->threadbase,XNDORMANT ) - && (!xnpod_primary_p () || task !=wind_current_task ())) -xnshadow_send_sig (&task->threadbase,SIGKILL ,1 ); -#endif /* __KERNEL__ && CONFIG_XENO_OPT_PERVASIVE */ -xnpod_delete_thread (&task->threadbase);xnlock_put_irqrestore (&nklock, s);
skins/native/task.c +0 -23
@@ -581,29 +581,6 @@if (err) goto unlock_and_exit; -#if defined(__KERNEL__) && defined(CONFIG_XENO_OPT_PERVASIVE ) -/* rt_task_delete() might be called for cleaning up a just -created shadow task which has not been successfully mapped, -so make sure we have an associated Linux mate before trying -to send it a signal. This will also prevent any action on -kernel-based Xenomai threads for which the user TCB -extension is always NULL. -We don't send any signal to dormant threads because GDB -(6.x) has some problems dealing with vanishing threads -under some circumstances, likely when asynchronous -cancellation is in effect. In most cases, this is a -non-issue since pthread_cancel() is requested from the skin -interface library in parallel on the target thread, but -when calling rt_task_delete() from kernel space against a -created but unstarted user-space task, the Linux thread -mated to the Xenomai shadow might linger unexpectedly on -the startup barrier. */ -if (xnthread_user_task (&task->thread_base) !=NULL - && !xnthread_test_state (&task->thread_base,XNDORMANT ) - && (!xnpod_primary_p () || task !=xeno_current_task ())) -xnshadow_send_sig (&task->thread_base,SIGKILL ,1 ); -#endif /* __KERNEL__ && CONFIG_XENO_OPT_PERVASIVE */ -/* Does not return if task is current. */ xnpod_delete_thread (&task->thread_base);
nucleus/pod.c +27 -2
@@ -1245,10 +1245,35 @@if (xnthread_test_state (thread,XNZOMBIE )) goto unlock_and_exit;/* No double-deletion. */ + sched = thread->sched; + +#if defined(__KERNEL__) && defined(CONFIG_XENO_OPT_PERVASIVE ) +/* xnpod_delete_thread() might be called for cleaning up a +just created shadow task which has not been successfully +mapped, so make sure we have an associated Linux mate +before trying to send it a signal. This will also prevent +any action on kernel-based Xenomai threads for which the +user TCB extension is always NULL. We don't send any +signal to dormant threads because GDB (6.x) has some +problems dealing with vanishing threads under some +circumstances, likely when asynchronous cancellation is in +effect. In most cases, this is a non-issue since +pthread_cancel() is requested from the skin interface +library in parallel on the target thread, but when calling +xnpod_delete_thread() from kernel space against a created +but unstarted user-space task, the Linux thread mated to +the Xenomai shadow might linger unexpectedly on the startup +barrier. */ +if (xnthread_user_task (thread) !=NULL + && !xnthread_test_state (thread,XNDORMANT ) + && (!xnpod_primary_p () || thread != sched->runthread)) { +xnshadow_send_sig (thread,SIGKILL ,1 ); + goto unlock_and_exit; + } +#endif /* __KERNEL__ && CONFIG_XENO_OPT_PERVASIVE */ +xnltt_log_event (xeno_ev_thrdelete, thread->name); - sched = thread->sched; -removeq (&nkpod->threadq, &thread->glink); nkpod->threadq_rev++;
nucleus/shadow.c +5 -4
@@ -837,7 +837,8 @@if (kthread_should_stop ())break ; -xnlock_get_irqsave (&nklock, s); +/* Real-time shadow TCBs are always removed on behalf +of the killed thread. */ thread = gk->thread;
@@ -846,6 +847,8 @@pending request, just ignore the latter. */ if (xnthread_user_task (thread)->state ==TASK_INTERRUPTIBLE ) { +rpi_pop (thread); +xnlock_get_irqsave (&nklock, s);#ifdef CONFIG_SMP /* If the task changed its CPU while in secondary mode, change the CPU of the underlying Xenomai shadow too. We
@@ -855,14 +858,12 @@ thread->sched =xnpod_sched_slot (cpu);#endif /* CONFIG_SMP */ xnpod_resume_thread (thread,XNRELAX ); -rpi_pop (thread);#ifdef CONFIG_XENO_OPT_ISHIELD disengage_irq_shield ();#endif /* CONFIG_XENO_OPT_ISHIELD */ xnpod_schedule (); +xnlock_put_irqrestore (&nklock, s); } - -xnlock_put_irqrestore (&nklock, s); }return 0 ;
Re: [Xenomai-core] RPI is good for you
Hi Philippe,
I have done my tests on 2.3.1 and I tried to apply the patch on 2.3.1 which worked (with some line offset in the patch...).
I wait now for any result.
So far everything is running fine. No issues.
More later.
Regards
Mathias
Quoted 17 lines
Mathias,
Could you try applying the attached patch against v2.3.2, and run your box using the failing configuration. This patch is a _preliminary_ attempt at fixing two major issues, it is not complete, and may not even be fully correct since it does not address all the pending issues yet. Still, I would be interested to know whether I'm on the right path, and if it changes something to your problem, without making your box jump out of the window, that is.
TIA,
Signature · 1 line
Philippe.
Signature · 9 lines
Mathias Koehrer [email protected] Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: günstig und schnell mit DSL - das All-Inclusive-Paket für clevere Doppel-Sparer, nur 39,85 € inkl. DSL- und ISDN-Grundgebühr! http://www.arcor.de/rd/emf-dsl-2
Re: [Xenomai-core] RPI is good for you
Hi Philippe,
I left my test running for a couple of hours - no freeze so far...
However, I have to do some other stuff on this machine, I have to stop the test now...
Regards
Mathias
Quoted 45 lines
Hi Philippe,
I have done my tests on 2.3.1 and I tried to apply the patch on 2.3.1 which worked
(with some line offset in the patch...).
I wait now for any result.
So far everything is running fine. No issues.More later.
Regards
Mathias
Quoted 17 lines
Mathias,
Could you try applying the attached patch against v2.3.2, and run your box using the failing configuration. This patch is a _preliminary_ attempt at fixing two major issues, it is not complete, and may not even be fully correct since it does not address all the pending issues yet. Still, I would be interested to know whether I'm on the right path, and if it changes something to your problem, without making your box jump out of the window, that is.
TIA,
Signature · 1 line
Philippe.Signature · 9 lines
Mathias Koehrer [email protected] Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: günstig und schnell mit DSL - das All-Inclusive-Paket für clevere Doppel-Sparer, nur 39,85 € inkl. DSL- und ISDN-Grundgebühr! http://www.arcor.de/rd/emf-dsl-2
Signature · 9 lines
Mathias Koehrer [email protected] Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: günstig und schnell mit DSL - das All-Inclusive-Paket für clevere Doppel-Sparer, nur 39,85 € inkl. DSL- und ISDN-Grundgebühr! http://www.arcor.de/rd/emf-dsl-2
Re: [Xenomai-core] RPI is good for you
On Fri, 2007-07-20 at 13:54 +0200, M. Koehrer wrote:
Quoted 5 lines
Hi Philippe,
I left my test running for a couple of hours - no freeze so far...However, I have to do some other stuff on this machine, I have to stop the test now...
Ok, thanks for the feedback. I will send an extended patch later today, so that you could test it on a longer period when you see fit.
TIA,
Quoted 50 lines
Regards
Mathias
Quoted 45 lines
Hi Philippe,
I have done my tests on 2.3.1 and I tried to apply the patch on 2.3.1 which worked
(with some line offset in the patch...).
I wait now for any result.
So far everything is running fine. No issues.More later.
Regards
Mathias
Quoted 17 lines
Mathias,
Could you try applying the attached patch against v2.3.2, and run your box using the failing configuration. This patch is a _preliminary_ attempt at fixing two major issues, it is not complete, and may not even be fully correct since it does not address all the pending issues yet. Still, I would be interested to know whether I'm on the right path, and if it changes something to your problem, without making your box jump out of the window, that is.
TIA,
Signature · 1 line
Philippe.Signature · 9 lines
Mathias Koehrer [email protected] Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: günstig und schnell mit DSL - das All-Inclusive-Paket für clevere Doppel-Sparer, nur 39,85 € inkl. DSL- und ISDN-Grundgebühr! http://www.arcor.de/rd/emf-dsl-2
Signature · 1 line
Philippe.
Re: [Xenomai-core] RPI is good for you
Quoted 9 lines · Philippe Gerum
Quoted 5 lines · M. Koehrer
Hi Philippe,
I left my test running for a couple of hours - no freeze so far...However, I have to do some other stuff on this machine, I have to stop the test now...
Ok, thanks for the feedback. I will send an extended patch later today, so that you could test it on a longer period when you see fit.
It took me a bit longer than expected, but here is a patch which addresses all the pending issues with RPI, hopefully (applies against 2.3.1 stock).
The good thing about Jan grumbling at me, is that this usually makes me look at the big picture anew. And the RPI picture was not that nice, that's a fact.
Beside the locking sequence issue, the ex-aequo #1 problem was that CPU migration of Linux tasks causing a RPI boost had some very nasty side-effects on RPI management, and would create all sort of funky situations I'm too shameful to talk about, except under the generic term of "horrendous mess".
Now, regarding the deadlock issue, suppressing the RPI-specific locking entirely would have been the best solution, but unfortunately, the migration scheme makes this out of reach, at least without resorting to some hairy and likely unreliable implementation. Therefore, the solution I came with consists of making the RPI lock a per-cpu thing, so that most RPI routines are actually grabbing a _local_ lock wrt the current CPU, those routines being allowed hold the nklock as they wish. When some per-CPU RPI lock is accessed from a remote CPU, it is guaranteed that _no nklock_ may be held nested. Actually, the remote case only occurs once, in rpi_clear_remote(), and all its callers are guaranteed to be nklock-free (a debug assertion even enforces that).
For the migration issue, the RPI transitions have been ironed out to make sure we deal properly with all the subtleties of the Linux load balancer.
Mathias, please let me know if the attached patch improves the situation on your side.
Signature · 1 line
Philippe.
include/asm-generic/system.h +6 -0
@@ -374,6 +374,11 @@ static inline int xnarch_send_ipi (xnarc return rthal_send_ipi(RTHAL_SERVICE_IPI0, cpumask); } +static inline int xnlock_is_owner (xnlock_t *lock) +{ +return atomic_read (&lock->owner) ==xnarch_current_cpu (); +} +#else /* !CONFIG_SMP */ #define xnlock_init (lock) do { } while(0)
@@ -383,6 +388,7 @@ static inline int xnarch_send_ipi (xnarc#define xnlock_put_irqrestore (lock,x) rthal_local_irq_restore(x)#define xnlock_clear_irqoff (lock) rthal_local_irq_disable()#define xnlock_clear_irqon (lock) rthal_local_irq_enable() +#define xnlock_is_owner (lock) 1static inline int xnarch_send_ipi (xnarch_cpumask_t cpumask) {
include/nucleus/core.h +3 -4
@@ -33,9 +33,11 @@/* Visible priority range supported by the core pod. */ #define XNCORE_MIN_PRIO 0#define XNCORE_MAX_PRIO 257 +/* Base priority of the root thread for the core pod. */ +#define XNCORE_IDLE_PRIO -1/* Total number of priority levels (including the hidden root one) */ -#define XNCORE_NR_PRIO (XNCORE_MAX_PRIO - XNCORE_MIN_PRIO + 2) +#define XNCORE_NR_PRIO (XNCORE_MAX_PRIO - XNCORE_IDLE_PRIO + 1)/* Priority sub-range used by core APIs. */ #define XNCORE_LOW_PRIO 0
@@ -44,9 +46,6 @@/* Priority of IRQ servers in user-space. */ #define XNCORE_IRQ_PRIO XNCORE_MAX_PRIO -/* Base priority of the root thread for the core pod. */ -#define XNCORE_BASE_PRIO -1 -#ifdef __KERNEL__#ifdef __cplusplus
include/nucleus/pod.h +5 -0
@@ -336,6 +336,11 @@ static inline void xnpod_renice_root(intxnlock_put_irqrestore (&nklock, s); } +static inline int xnpod_root_priority (void ) +{ +return xnthread_current_priority (xnpod_current_root ()); +} +static inline int xnpod_get_qdir (xnpod_t *pod) {/* Returns the queuing direction of threads for a given pod */
include/nucleus/queue.h +14 -6
@@ -104,7 +104,8 @@ do { \while (curr != &(__qslot)->head && nelems < (__qslot)->elems) \ curr = curr->last, nelems++; \if (curr != &(__qslot)->head || nelems != (__qslot)->elems) \ -xnpod_fatal ("corrupted queue, qslot->elems=%d, qslot=%p at %s:%d" , \ +xnpod_fatal ("corrupted queue, qslot->elems=%d/%d, qslot=%p at %s:%d" , \ + nelems, \ (__qslot)->elems, \ __qslot, \ __FILE__,__LINE__); \
@@ -746,14 +747,22 @@ static inline xnpholder_t *findmlqh(xnmlstatic inline xnpholder_t *getheadmlq (xnmlqueue_t *mlqslot) { +xnpholder_t *pholder;xnqueue_t *queue;if (emptymlq_p (mlqslot))return NULL ; queue = &mlqslot->queue[ffsmlq (mlqslot)]; - -return (xnpholder_t *)getheadq (queue); + holder = (xnpholder_t *)getheadq (queue); + +XENO_ASSERT (QUEUES , holder, +xnpod_fatal + ("corrupted multi-level queue, qslot=%p at %s:%d" , mlqslot, + __FILE__, __LINE__); + ); + +return holder; }static inline xnpholder_t *getmlq (xnmlqueue_t *mlqslot)
@@ -775,12 +784,11 @@ static inline xnpholder_t *getmlq(xnmlqu __FILE__,__LINE__); ); - hi = idx /BITS_PER_LONG ; - lo = idx %BITS_PER_LONG ; - mlqslot->elems--;if (emptyq_p (queue)) { + hi = idx /BITS_PER_LONG ; + lo = idx %BITS_PER_LONG ;__clrbits (mlqslot->lomap[hi],1 << lo);if (mlqslot->lomap[hi] ==0 )__clrbits (mlqslot->himap,1 << hi);
include/nucleus/thread.h +1 -3
@@ -168,9 +168,7 @@ typedef struct xnthread {xnholder_t glink;/* Thread holder in global queue */ -/* We don't want side-effects on laddr here! */ -#define link2thread (laddr,link) \ -((xnthread_t *)(((char *)laddr) - (int)(&((xnthread_t *)0)->link))) +#define link2thread (ln, fld) container_of(ln, xnthread_t, fld)xnpqueue_t claimq;/* Owned resources claimed by others (PIP) */
ksrc/nucleus/pod.c +44 -2
54 lines not on this page · raw message
ksrc/nucleus/shadow.c +248 -158
639 lines not on this page · raw message
ksrc/skins/native/task.c +0 -23
@@ -581,29 +581,6 @@ int rt_task_delete(RT_TASK *task)if (err) goto unlock_and_exit; -#if defined(__KERNEL__) && defined(CONFIG_XENO_OPT_PERVASIVE ) -/* rt_task_delete() might be called for cleaning up a just -created shadow task which has not been successfully mapped, -so make sure we have an associated Linux mate before trying -to send it a signal. This will also prevent any action on -kernel-based Xenomai threads for which the user TCB -extension is always NULL. -We don't send any signal to dormant threads because GDB -(6.x) has some problems dealing with vanishing threads -under some circumstances, likely when asynchronous -cancellation is in effect. In most cases, this is a -non-issue since pthread_cancel() is requested from the skin -interface library in parallel on the target thread, but -when calling rt_task_delete() from kernel space against a -created but unstarted user-space task, the Linux thread -mated to the Xenomai shadow might linger unexpectedly on -the startup barrier. */ -if (xnthread_user_task (&task->thread_base) !=NULL - && !xnthread_test_state (&task->thread_base,XNDORMANT ) - && (!xnpod_primary_p () || task !=xeno_current_task ())) -xnshadow_send_sig (&task->thread_base,SIGKILL ,1 ); -#endif /* __KERNEL__ && CONFIG_XENO_OPT_PERVASIVE */ -/* Does not return if task is current. */ xnpod_delete_thread (&task->thread_base);
ksrc/skins/psos+/task.c +0 -7
@@ -284,13 +284,6 @@ u_long t_delete(u_long tid) goto unlock_and_exit; } -#if defined(__KERNEL__) && defined(CONFIG_XENO_OPT_PERVASIVE ) -if (xnthread_user_task (&task->threadbase) !=NULL - && !xnthread_test_state (&task->threadbase,XNDORMANT ) - && (!xnpod_primary_p () || task !=psos_current_task ())) -xnshadow_send_sig (&task->threadbase,SIGKILL ,1 ); -#endif /* __KERNEL__ && CONFIG_XENO_OPT_PERVASIVE */ -xnpod_delete_thread (&task->threadbase); unlock_and_exit:
ksrc/skins/vxworks/taskLib.c +0 -7
@@ -285,13 +285,6 @@ STATUS taskDelete(TASK_ID task_id) goto error; } -#if defined(__KERNEL__) && defined(CONFIG_XENO_OPT_PERVASIVE ) -if (xnthread_user_task (&task->threadbase) !=NULL - && !xnthread_test_state (&task->threadbase,XNDORMANT ) - && (!xnpod_primary_p () || task !=wind_current_task ())) -xnshadow_send_sig (&task->threadbase,SIGKILL ,1 ); -#endif /* __KERNEL__ && CONFIG_XENO_OPT_PERVASIVE */ -xnpod_delete_thread (&task->threadbase);xnlock_put_irqrestore (&nklock, s);
Re: [Xenomai-core] RPI is good for you
Quoted 8 lines · Philippe Gerum
Quoted 7 lines · Philippe Gerum
Quoted 5 lines · M. Koehrer
Hi Philippe,
I left my test running for a couple of hours - no freeze so far...However, I have to do some other stuff on this machine, I have to stop the test now...
Quoted 7 lines
Quoted 2 lines
Ok, thanks for the feedback. I will send an extended patch later today, so that you could test it on a longer period when you see fit.
It took me a bit longer than expected, but here is a patch which addresses all the pending issues with RPI, hopefully (applies against 2.3.1 stock).
Here is a fix for a typo if you happen to use the scalable scheduler.
nucleus/queue.h renamed from nucleus/queue.h~ +1 -1
@@ -744,7 +744,7 @@static inline xnpholder_t *getheadmlq (xnmlqueue_t *mlqslot) { -xnpholder_t *pholder; +xnpholder_t *holder;xnqueue_t *queue;if (emptymlq_p (mlqslot))
Signature · 1 line
Philippe.
[Xenomai-core] r2773 mistake? x86_64 adeos patch
Hi!
We are trying to compile xenomai for x86_64. Yesterday, revision r2773 "Add Adeos 2.6.22/x86_64", added the file adeos-ipie-2.6.22-x86_64-1.1-00.patch.
However it appears that the patch is only patching files in arch/i386/ instead of arch/x86_64...
Or am I doing something wrong?
Thanks
jeffk
Re: [Xenomai-core] r2773 mistake? x86_64 adeos patch
Quoted 9 lines · Jeff Koftinoff
Hi!
We are trying to compile xenomai for
x86_64. Yesterday, revision r2773 "Add Adeos 2.6.22/x86_64", added the file adeos-ipie-2.6.22- x86_64-1.1-00.patch.However it appears that the patch is only patching files in
arch/i386/ instead ofarch/x86_64...
Ahem, Oops... Fixed now. Sorry.
Quoted 5 lines
Or am I doing something wrong?
Thanks
jeffk
Signature · 1 line
Philippe.
Re: [Xenomai-core] RPI is good for you
In reply to Philippe GerumQuoted 22 lines · Philippe Gerum
Quoted 8 lines · Philippe Gerum
Quoted 7 lines · Philippe Gerum
Quoted 5 lines · M. Koehrer
Hi Philippe,
I left my test running for a couple of hours - no freeze so far...However, I have to do some other stuff on this machine, I have to stop the test now...
Quoted 7 lines
Quoted 2 lines
Ok, thanks for the feedback. I will send an extended patch later today, so that you could test it on a longer period when you see fit.
It took me a bit longer than expected, but here is a patch which addresses all the pending issues with RPI, hopefully (applies against 2.3.1 stock).
Here is a fix for a typo if you happen to use the scalable scheduler.
nucleus/queue.h line 750
Quoted 8 lines
nucleus/queue.h renamed from nucleus/queue.h~ +1
-1@@ -744,7 +744,7 @@static inline xnpholder_t *getheadmlq (xnmlqueue_t *mlqslot) { -xnpholder_t *pholder; +xnpholder_t *holder;xnqueue_t *queue;if (emptymlq_p (mlqslot))
This other fix is needed to cope with a tiny migration window which exists while creating a thread, and which may affect RPI.
nucleus/shadow.c +6 -4
@@ -386,10 +386,12 @@* the gatekeeper's RPI slot for the current CPU. */ if (unlikely (threadin->rpi ==NULL )) { -xnlock_get_irqsave (&rpislot->lock, s); -sched_insertpqf (&rpislot->threadq, &threadin->xlink, newprio); - threadin->rpi = rpislot; -xnlock_put_irqrestore (&rpislot->lock, s); +if (!xnthread_test_state (threadin,XNDORMANT )) { +xnlock_get_irqsave (&rpislot->lock, s); +sched_insertpqf (&rpislot->threadq, &threadin->xlink, newprio); + threadin->rpi = rpislot; +xnlock_put_irqrestore (&rpislot->lock, s); + } }else if (unlikely (threadin->rpi != rpislot))/* We hold no lock here. */ rpi_migrate (threadin);
Signature · 1 line
Philippe.
Re: [Xenomai-core] RPI is good for you
In reply to Philippe GerumHi Philippe,
I have attached this patch to my application. So far it looks really good. However, I leave my test running to be sure that it works.
Regards
Mathias
Quoted 50 lines · Philippe Gerum
Quoted 5 lines · M. Koehrer
Quoted 4 lines
Hi Philippe,
I left my test running for a couple of hours - no freeze so far...However, I have to do some other stuff on this machine, I have to stop
the test now...
Quoted 4 lines
Quoted 1 line
Ok, thanks for the feedback. I will send an extended patch later today, so that you could test it on a longer period when you see fit.
It took me a bit longer than expected, but here is a patch which addresses all the pending issues with RPI, hopefully (applies against 2.3.1 stock).
The good thing about Jan grumbling at me, is that this usually makes me look at the big picture anew. And the RPI picture was not that nice, that's a fact.
Beside the locking sequence issue, the ex-aequo #1 problem was that CPU migration of Linux tasks causing a RPI boost had some very nasty side-effects on RPI management, and would create all sort of funky situations I'm too shameful to talk about, except under the generic term of "horrendous mess".
Now, regarding the deadlock issue, suppressing the RPI-specific locking entirely would have been the best solution, but unfortunately, the migration scheme makes this out of reach, at least without resorting to some hairy and likely unreliable implementation. Therefore, the solution I came with consists of making the RPI lock a per-cpu thing, so that most RPI routines are actually grabbing a _local_ lock wrt the current CPU, those routines being allowed hold the nklock as they wish. When some per-CPU RPI lock is accessed from a remote CPU, it is guaranteed that
_nonklock_may be held nested. Actually, the remote case only occurs once, inrpi_clear_remote(), and all its callers are guaranteed to be nklock-free (a debug assertion even enforces that).For the migration issue, the RPI transitions have been ironed out to make sure we deal properly with all the subtleties of the Linux load balancer.
Mathias, please let me know if the attached patch improves the situation on your side.
Signature · 1 line
Philippe.
Signature · 9 lines
Mathias Koehrer [email protected] Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT FÜR ALLE NEUEINSTEIGER Jetzt bei Arcor: günstig und schnell mit DSL - das All-Inclusive-Paket für clevere Doppel-Sparer, nur 34,95 € inkl. DSL- und ISDN-Grundgebühr! http://www.arcor.de/rd/emf-dsl-2
Re: [Xenomai-core] RPI is good for you
Hi Philippe,
as I have mentioned yesterday, I have applied your (first) patch to Xenomai (I did not apply the other additional patches). And yes, my application was running fine without freeze in an overnight test. Not only the tiny test application but also the complex real time application that was the root cause for everything.
That is really a great improvement. Will this fix end up shortly in a maintenance version of Xenomai? I would appreciate that as this is a severe bug that should have a fix published as soon as possible.
Thanks a lot for the excellent support!
Regards
Mathias
Quoted 56 lines
Hi Philippe,
I have attached this patch to my application. So far it looks really good. However, I leave my test running to be sure that it works.
Regards
Mathias
Quoted 6 lines · Philippe Gerum
Quoted 5 lines · M. Koehrer
Quoted 4 lines
Hi Philippe,
I left my test running for a couple of hours - no freeze so far...However, I have to do some other stuff on this machine, I have to
stop
Quoted 39 lines
the test now...
Quoted 4 lines
Quoted 1 line
Ok, thanks for the feedback. I will send an extended patch later today, so that you could test it on a longer period when you see fit.
It took me a bit longer than expected, but here is a patch which addresses all the pending issues with RPI, hopefully (applies against 2.3.1 stock).
The good thing about Jan grumbling at me, is that this usually makes me look at the big picture anew. And the RPI picture was not that nice, that's a fact.
Beside the locking sequence issue, the ex-aequo #1 problem was that CPU migration of Linux tasks causing a RPI boost had some very nasty side-effects on RPI management, and would create all sort of funky situations I'm too shameful to talk about, except under the generic term of "horrendous mess".
Now, regarding the deadlock issue, suppressing the RPI-specific locking entirely would have been the best solution, but unfortunately, the migration scheme makes this out of reach, at least without resorting to some hairy and likely unreliable implementation. Therefore, the solution I came with consists of making the RPI lock a per-cpu thing, so that most RPI routines are actually grabbing a _local_ lock wrt the current CPU, those routines being allowed hold the nklock as they wish. When some per-CPU RPI lock is accessed from a remote CPU, it is guaranteed that
_nonklock_may be held nested. Actually, the remote case only occurs once, inrpi_clear_remote(), and all its callers are guaranteed to be nklock-free (a debug assertion even enforces that).For the migration issue, the RPI transitions have been ironed out to make sure we deal properly with all the subtleties of the Linux load balancer.
Mathias, please let me know if the attached patch improves the situation on your side.
Signature · 9 lines
Mathias Koehrer [email protected] Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT FÜR ALLE NEUEINSTEIGER Jetzt bei Arcor: günstig und schnell mit DSL - das All-Inclusive-Paket für clevere Doppel-Sparer, nur 34,95 € inkl. DSL- und ISDN-Grundgebühr! http://www.arcor.de/rd/emf-dsl-2
Re: [Xenomai-core] RPI is good for you
Quoted 4 lines · M. Koehrer
Hi Philippe,
as I have mentioned yesterday, I have applied your (first) patch to Xenomai (I did not apply the other additional patches).
The third one would be needed to run the same code against the trunk, due to some difference in CPU affinity management between v2.3.x and -devel, but I had no problem running the lockup test for six hours without it over v2.3.x.
Quoted 6 lines
And yes, my application was running fine without freeze in an
overnight test. Not only the tiny test application but also the complex real time application that was the root cause for everything.
That is really a great improvement. Will this fix end up shortly in a maintenance version of Xenomai? I would appreciate that as this is a severe bug that should have a fix published as soon as possible.
Yes, it is already merged into the maintenance and -devel branch, and v2.3.3 will be released shortly, since this is indeed a deadly bug.
Quoted 2 lines
Thanks a lot for the excellent support!
No problem. The lockup test you sent did make a huge difference and actually allowed me to focus on solving the issue immediately, instead of trying to find a way to reproduce it first. Thanks for this.
Quoted 63 lines
Regards
Mathias
Quoted 56 lines
Hi Philippe,
I have attached this patch to my application. So far it looks really good. However, I leave my test running to be sure that it works.
Regards
Mathias
Quoted 6 lines · Philippe Gerum
Quoted 5 lines · M. Koehrer
Quoted 4 lines
Hi Philippe,
I left my test running for a couple of hours - no freeze so far...However, I have to do some other stuff on this machine, I have to
stop
Quoted 39 lines
the test now...
Quoted 4 lines
Quoted 1 line
Ok, thanks for the feedback. I will send an extended patch later today, so that you could test it on a longer period when you see fit.
It took me a bit longer than expected, but here is a patch which addresses all the pending issues with RPI, hopefully (applies against 2.3.1 stock).
The good thing about Jan grumbling at me, is that this usually makes me look at the big picture anew. And the RPI picture was not that nice, that's a fact.
Beside the locking sequence issue, the ex-aequo #1 problem was that CPU migration of Linux tasks causing a RPI boost had some very nasty side-effects on RPI management, and would create all sort of funky situations I'm too shameful to talk about, except under the generic term of "horrendous mess".
Now, regarding the deadlock issue, suppressing the RPI-specific locking entirely would have been the best solution, but unfortunately, the migration scheme makes this out of reach, at least without resorting to some hairy and likely unreliable implementation. Therefore, the solution I came with consists of making the RPI lock a per-cpu thing, so that most RPI routines are actually grabbing a _local_ lock wrt the current CPU, those routines being allowed hold the nklock as they wish. When some per-CPU RPI lock is accessed from a remote CPU, it is guaranteed that
_nonklock_may be held nested. Actually, the remote case only occurs once, inrpi_clear_remote(), and all its callers are guaranteed to be nklock-free (a debug assertion even enforces that).For the migration issue, the RPI transitions have been ironed out to make sure we deal properly with all the subtleties of the Linux load balancer.
Mathias, please let me know if the attached patch improves the situation on your side.
Signature · 1 line
Philippe.
Re: [Xenomai-core] RPI is good for you
In reply to Philippe GerumQuoted 24 lines · Philippe Gerum
Quoted 8 lines · Philippe Gerum
Quoted 5 lines · M. Koehrer
Hi Philippe,
I left my test running for a couple of hours - no freeze so far...However, I have to do some other stuff on this machine, I have to stop the test now...
Ok, thanks for the feedback. I will send an extended patch later today, so that you could test it on a longer period when you see fit.
It took me a bit longer than expected, but here is a patch which addresses all the pending issues with RPI, hopefully (applies against 2.3.1 stock).
The good thing about Jan grumbling at me, is that this usually makes me look at the big picture anew. And the RPI picture was not that nice, that's a fact.
Beside the locking sequence issue, the ex-aequo #1 problem was that CPU migration of Linux tasks causing a RPI boost had some very nasty side-effects on RPI management, and would create all sort of funky situations I'm too shameful to talk about, except under the generic term of "horrendous mess".
Quoted 11 lines
Now, regarding the deadlock issue, suppressing the RPI-specific locking entirely would have been the best solution, but unfortunately, the migration scheme makes this out of reach, at least without resorting to some hairy and likely unreliable implementation. Therefore, the solution I came with consists of making the RPI lock a per-cpu thing, so that most RPI routines are actually grabbing a _local_ lock wrt the current CPU, those routines being allowed hold the nklock as they wish. When some per-CPU RPI lock is accessed from a remote CPU, it is guaranteed that
_nonklock_may be held nested. Actually, the remote case only occurs once, inrpi_clear_remote(), and all its callers are guaranteed to be nklock-free (a debug assertion even enforces that).
Yeah, it is actually safe against deadlocks now. Still, I wonder why we can't design xnshadow_rpi_check like this:
... int need_renice = 0; xnlock_get_irqsave(&rpislot->lock, s); if (sched_emptypq_p(&rpislot->threadq) && xnpod_root_priority() != XNCORE_IDLE_PRIO) need_renice = 1; xnlock_put_irqrestore(&rpislot->lock, s); if (need_renice) xnpod_renice_root(XNCORE_IDLE_PRIO);
If we can avoid nesting (even if it's safe), we should do so. Or does this pattern here introduce new, ugly race possibility?
Jan
Re: [Xenomai-core] RPI is good for you
Quoted 33 lines · Jan Kiszka
Quoted 13 lines · Philippe Gerum
On Fri, 2007-07-20 at 14:16 +0200, Philippe Gerum wrote:
Now, regarding the deadlock issue, suppressing the RPI-specific locking entirely would have been the best solution, but unfortunately, the migration scheme makes this out of reach, at least without resorting to some hairy and likely unreliable implementation. Therefore, the solution I came with consists of making the RPI lock a per-cpu thing, so that most RPI routines are actually grabbing a _local_ lock wrt the current CPU, those routines being allowed hold the nklock as they wish. When some per-CPU RPI lock is accessed from a remote CPU, it is guaranteed that
_nonklock_may be held nested. Actually, the remote case only occurs once, inrpi_clear_remote(), and all its callers are guaranteed to be nklock-free (a debug assertion even enforces that).Yeah, it is actually safe against deadlocks now. Still, I wonder why we can't design
xnshadow_rpi_checklike this:... int need_renice = 0; xnlock_get_irqsave(&rpislot->lock, s); if (sched_emptypq_p(&rpislot->threadq) && xnpod_root_priority() != XNCORE_IDLE_PRIO) need_renice = 1; xnlock_put_irqrestore(&rpislot->lock, s); if (need_renice) xnpod_renice_root(XNCORE_IDLE_PRIO);
Quoted 2 lines
If we can avoid nesting (even if it's safe), we should do so. Or does this pattern here introduce new, ugly race possibility?
Yeah, this would work, because what we need actually is that xnshadow_rpi_check() runs with local interrupts off, which is the case since it is called on behalf of an IPI with hardware interrupts disabled. Otherwise, we would open a short window for this kind of scenario:
xnshadow_rpi_check
empty-p(RPI list)?
<IRQ> switch to some primary mode thread
primary mode thread relaxes
push other thread to RPI list
(spuriously) downgrade root thread priority
This said, we have no interest ATM to let hw interrupts flow when handling this IPI, so we could indeed flatten the locking sequence as you described, provided we also put some big fat warning into that piece of code too.
Signature · 1 line
Philippe.