Re: [XenPPC] [PATCH] Print backtrace on BUG

2006-09-21 Thread Segher Boessenkool

Bah, it's too early for GCC asm:

+asm(mr %0, 1 :  
=r (sp));  \
+asm(mflr %0 :  
=r (lr));   \
+asm(mflr %0; bl 1f; 1: mflr %1; mtlr %0 : =r (tp),  
=r (pc));\


asm(bl $+4 ; mflr %0; mtlr %1 : =r(pc) : r(lr));\

+show_backtrace(sp, lr,  
pc);   \
+__asm__ __volatile__  
( trap );  \

+} while ( 0 )


...and the one asm where you put volatile on is the only one that
doesn't need it :-)  (and no __ is needed either).

Alternatively (and preferred), you can make a single statement out
of the first three asm statements.


In fact, you _have_ to make those three into one; even volatile asms
can be reordered by the compiler, if there's no data dependency.

The trap asm is always volatile (it has no parameters); it can still
be reordered though.  You can use __builtin_trap() here instead.


Segher


___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


Re: [XenPPC] [PATCH] Print backtrace on BUG

2006-09-21 Thread Jimi Xenidis

hey Amos,
Please see how __warn() calls backtrace.
Also lets make this a full binding and call it __full_crash that way  
the backtrace will be labeled and useful since the first frames are  
dubious.

-JX
On Sep 20, 2006, at 11:41 PM, Amos Waterland wrote:


This makes Xen/PPC dump a backtrace when a BUG() is triggered.

Signed-off-by: Amos Waterland [EMAIL PROTECTED]

---

 config.h |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff -r 5418062d2da8 xen/include/asm-powerpc/powerpc64/config.h
--- a/xen/include/asm-powerpc/powerpc64/config.h
+++ b/xen/include/asm-powerpc/powerpc64/config.h
@@ -38,7 +38,15 @@

 #ifndef __ASSEMBLY__

-#define FORCE_CRASH() __asm__ __volatile__ ( trap )
+#define FORCE_CRASH 
() \
+do  
{  
 \
+unsigned long sp, lr, pc,  
tp; \
+asm(mr %0, 1 :  
=r (sp));  \
+asm(mflr %0 :  
=r (lr));   \
+asm(mflr %0; bl 1f; 1: mflr %1; mtlr %0 : =r (tp),  
=r (pc));\
+show_backtrace(sp, lr,  
pc);   \
+__asm__ __volatile__  
( trap );  \

+} while ( 0 )

 #endif /* __ASSEMBLY__ */


___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel



___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


Re: [XenPPC] [PATCH] Print backtrace on BUG

2006-09-21 Thread Jimi Xenidis

hmm, this brings up an interesting issues.

We curently do not print a regdump or backtrace is gdb is enabled,  
this is the reason why this patch exists.
We obviously do not want this noise with gdb because breakpoint will  
become seriously annoying and may even prohibit gdb from even working  
(tho TB's O-patch will help with this).


But I think on BUG() and Machine check we should always dump this  
info even before the debugger.


Thoughts?
-JX
On Sep 21, 2006, at 9:18 AM, Jimi Xenidis wrote:


hey Amos,
Please see how __warn() calls backtrace.
Also lets make this a full binding and call it __full_crash that  
way the backtrace will be labeled and useful since the first frames  
are dubious.

-JX
On Sep 20, 2006, at 11:41 PM, Amos Waterland wrote:


This makes Xen/PPC dump a backtrace when a BUG() is triggered.

Signed-off-by: Amos Waterland [EMAIL PROTECTED]

---

 config.h |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff -r 5418062d2da8 xen/include/asm-powerpc/powerpc64/config.h
--- a/xen/include/asm-powerpc/powerpc64/config.h
+++ b/xen/include/asm-powerpc/powerpc64/config.h
@@ -38,7 +38,15 @@

 #ifndef __ASSEMBLY__

-#define FORCE_CRASH() __asm__ __volatile__ ( trap )
+#define FORCE_CRASH 
() \
+do  
{ 
  \
+unsigned long sp, lr, pc,  
tp; \
+asm(mr %0, 1 :  
=r (sp));  \
+asm(mflr %0 :  
=r (lr));   \
+asm(mflr %0; bl 1f; 1: mflr %1; mtlr %0 : =r (tp),  
=r (pc));\
+show_backtrace(sp, lr,  
pc);   \
+__asm__ __volatile__  
( trap );  \

+} while ( 0 )

 #endif /* __ASSEMBLY__ */


___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel



___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel



___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


[XenPPC] [PATCH] Print backtrace on BUG

2006-09-20 Thread Amos Waterland
This makes Xen/PPC dump a backtrace when a BUG() is triggered.

Signed-off-by: Amos Waterland [EMAIL PROTECTED]

---

 config.h |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff -r 5418062d2da8 xen/include/asm-powerpc/powerpc64/config.h
--- a/xen/include/asm-powerpc/powerpc64/config.h
+++ b/xen/include/asm-powerpc/powerpc64/config.h
@@ -38,7 +38,15 @@
 
 #ifndef __ASSEMBLY__
 
-#define FORCE_CRASH() __asm__ __volatile__ ( trap )
+#define FORCE_CRASH() \
+do {  \
+unsigned long sp, lr, pc, tp; \
+asm(mr %0, 1 : =r (sp));  \
+asm(mflr %0 : =r (lr));   \
+asm(mflr %0; bl 1f; 1: mflr %1; mtlr %0 : =r (tp), =r (pc));\
+show_backtrace(sp, lr, pc);   \
+__asm__ __volatile__ ( trap );  \
+} while ( 0 )
 
 #endif /* __ASSEMBLY__ */
 

___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel