Module: xenomai-jki
Branch: for-upstream
Commit: 1254408cfc754a008d55a068e47a10d816e2c196
URL:    
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=1254408cfc754a008d55a068e47a10d816e2c196

Author: Jan Kiszka <[email protected]>
Date:   Wed Sep  1 17:35:21 2010 +0200

Drop nklock on panic

If we go to panic, namely run xnarch_halt, dropping the potentially held
nklock can help getting the last messages of the system out, at least on
SMP where some other CPU could then run klogd without potentially
getting stuck on a nklock-touching code path.

Signed-off-by: Jan Kiszka <[email protected]>

---

 include/asm-generic/system.h |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/include/asm-generic/system.h b/include/asm-generic/system.h
index 4b5ce95..6349f74 100644
--- a/include/asm-generic/system.h
+++ b/include/asm-generic/system.h
@@ -298,14 +298,17 @@ static inline unsigned long long 
xnarch_get_clock_freq(void)
 
 #define xnarch_get_cpu_tsc                     rthal_rdtsc
 
-#define xnarch_halt(emsg)                              \
-       do {                                            \
-               rthal_emergency_console();              \
-               xnarch_logerr("fatal: %s\n", emsg);     \
-               show_stack(NULL,NULL);                  \
-               xnarch_trace_panic_dump();              \
-               for (;;)                                \
-                       cpu_relax();                    \
+#define xnarch_halt(emsg)                                              \
+       do {                                                            \
+               DECLARE_EXTERN_XNLOCK(nklock);                          \
+               rthal_emergency_console();                              \
+               if (atomic_read(&nklock.owner) == xnarch_current_cpu()) \
+                       xnlock_clear_irqoff(&nklock);                   \
+               xnarch_logerr("fatal: %s\n", emsg);                     \
+               show_stack(NULL,NULL);                                  \
+               xnarch_trace_panic_dump();                              \
+               for (;;)                                                \
+                       cpu_relax();                                    \
        } while(0)
 
 static inline int xnarch_setimask (int imask)


_______________________________________________
Xenomai-git mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-git

Reply via email to