Re: [RFC/PATCH 2/2] powerpc: irqtrace support to 64-bit powerpc

2007-10-22 Thread Johannes Berg
On Mon, 2007-10-15 at 17:28 +1000, Benjamin Herrenschmidt wrote:
 This adds the low level irq tracing hooks to the powerpc architecture
 needed to enable full lockdep functionality
 
 Some rework from Johannes initial version, removing the asm trampoline that
 isn't needed (thus improving perfs) and fixing a couple of bugs such as
 incorrect initial preempt_count on the softirq alternate stack.

Hmm. It breaks booting on my quad, I finally got around to testing
without this patch and it turns out that it caused the boot failure I
reported in another mail. This is with v2.6.23-6623-g55b70a0, a clean
tree boots fine but with these two patches applied and configured in it
fails during boot, hanging at some point, apparently when userspace is
entered.

On the other hand, it is fine with my original version. I'll have to
find some time to check the differences hunk by hunk I guess.

johannes


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [RFC/PATCH 2/2] powerpc: irqtrace support to 64-bit powerpc

2007-10-22 Thread Benjamin Herrenschmidt

On Mon, 2007-10-22 at 15:35 +0200, Johannes Berg wrote:
 On Mon, 2007-10-15 at 17:28 +1000, Benjamin Herrenschmidt wrote:
  This adds the low level irq tracing hooks to the powerpc architecture
  needed to enable full lockdep functionality
  
  Some rework from Johannes initial version, removing the asm trampoline that
  isn't needed (thus improving perfs) and fixing a couple of bugs such as
  incorrect initial preempt_count on the softirq alternate stack.
 
 Hmm. It breaks booting on my quad, I finally got around to testing
 without this patch and it turns out that it caused the boot failure I
 reported in another mail. This is with v2.6.23-6623-g55b70a0, a clean
 tree boots fine but with these two patches applied and configured in it
 fails during boot, hanging at some point, apparently when userspace is
 entered.
 
 On the other hand, it is fine with my original version. I'll have to
 find some time to check the differences hunk by hunk I guess.

Or I can try on my quad :-) I'll have a look. It did boot on some other
machines though. Funny.

Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[RFC/PATCH 2/2] powerpc: irqtrace support to 64-bit powerpc

2007-10-15 Thread Benjamin Herrenschmidt
This adds the low level irq tracing hooks to the powerpc architecture
needed to enable full lockdep functionality

Some rework from Johannes initial version, removing the asm trampoline that
isn't needed (thus improving perfs) and fixing a couple of bugs such as
incorrect initial preempt_count on the softirq alternate stack.

Signed-off-by: Johannes Berg [EMAIL PROTECTED]
Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]

---

 arch/powerpc/Kconfig|9 +
 arch/powerpc/kernel/entry_64.S  |   27 +++
 arch/powerpc/kernel/head_64.S   |   68 +---
 arch/powerpc/kernel/irq.c   |   17 --
 arch/powerpc/kernel/ppc_ksyms.c |4 --
 arch/powerpc/kernel/setup_64.c  |6 +++
 include/asm-powerpc/exception.h |7 ++--
 include/asm-powerpc/hw_irq.h|   13 ---
 include/asm-powerpc/irqflags.h  |   23 ++---
 include/asm-powerpc/rwsem.h |   34 +++-
 include/asm-powerpc/spinlock.h  |1 
 11 files changed, 155 insertions(+), 54 deletions(-)

Index: linux-work/arch/powerpc/Kconfig
===
--- linux-work.orig/arch/powerpc/Kconfig2007-10-15 17:10:11.0 
+1000
+++ linux-work/arch/powerpc/Kconfig 2007-10-15 17:11:09.0 +1000
@@ -50,6 +50,15 @@ config STACKTRACE_SUPPORT
bool
default y
 
+config TRACE_IRQFLAGS_SUPPORT
+   bool
+   depends on PPC64
+   default y
+
+config LOCKDEP_SUPPORT
+   bool
+   default y
+
 config RWSEM_GENERIC_SPINLOCK
bool
 
Index: linux-work/arch/powerpc/kernel/irq.c
===
--- linux-work.orig/arch/powerpc/kernel/irq.c   2007-10-15 17:10:11.0 
+1000
+++ linux-work/arch/powerpc/kernel/irq.c2007-10-15 17:11:09.0 
+1000
@@ -114,7 +114,7 @@ static inline void set_soft_enabled(unsi
: : r (enable), i (offsetof(struct paca_struct, soft_enabled)));
 }
 
-void local_irq_restore(unsigned long en)
+void raw_local_irq_restore(unsigned long en)
 {
/*
 * get_paca()-soft_enabled = en;
@@ -175,6 +175,7 @@ void local_irq_restore(unsigned long en)
 
__hard_irq_enable();
 }
+EXPORT_SYMBOL(raw_local_irq_restore);
 #endif /* CONFIG_PPC64 */
 
 int show_interrupts(struct seq_file *p, void *v)
@@ -311,8 +312,20 @@ void do_IRQ(struct pt_regs *regs)
handler = __do_IRQ;
irqtp-task = curtp-task;
irqtp-flags = 0;
+
+   /* Copy the softirq bits in preempt_count so that the
+* softirq checks work in the hardirq context.
+*/
+   irqtp-preempt_count =
+   (irqtp-preempt_count  ~SOFTIRQ_MASK) |
+   (curtp-preempt_count  SOFTIRQ_MASK);
+
call_handle_irq(irq, desc, irqtp, handler);
irqtp-task = NULL;
+
+   /* Set any flag that may have been set on the
+* alternate stack
+*/
if (irqtp-flags)
set_bits(irqtp-flags, curtp-flags);
} else
@@ -358,7 +371,7 @@ void irq_ctx_init(void)
memset((void *)softirq_ctx[i], 0, THREAD_SIZE);
tp = softirq_ctx[i];
tp-cpu = i;
-   tp-preempt_count = SOFTIRQ_OFFSET;
+   tp-preempt_count = 0;
 
memset((void *)hardirq_ctx[i], 0, THREAD_SIZE);
tp = hardirq_ctx[i];
Index: linux-work/arch/powerpc/kernel/ppc_ksyms.c
===
--- linux-work.orig/arch/powerpc/kernel/ppc_ksyms.c 2007-10-15 
17:10:11.0 +1000
+++ linux-work/arch/powerpc/kernel/ppc_ksyms.c  2007-10-15 17:11:09.0 
+1000
@@ -49,10 +49,6 @@
 #include asm/commproc.h
 #endif
 
-#ifdef CONFIG_PPC64
-EXPORT_SYMBOL(local_irq_restore);
-#endif
-
 #ifdef CONFIG_PPC32
 extern void transfer_to_handler(void);
 extern void do_IRQ(struct pt_regs *regs);
Index: linux-work/include/asm-powerpc/hw_irq.h
===
--- linux-work.orig/include/asm-powerpc/hw_irq.h2007-10-15 
17:10:12.0 +1000
+++ linux-work/include/asm-powerpc/hw_irq.h 2007-10-15 17:11:09.0 
+1000
@@ -27,7 +27,7 @@ static inline unsigned long local_get_fl
return flags;
 }
 
-static inline unsigned long local_irq_disable(void)
+static inline unsigned long raw_local_irq_disable(void)
 {
unsigned long flags, zero;
 
@@ -39,14 +39,15 @@ static inline unsigned long local_irq_di
return flags;
 }
 
-extern void local_irq_restore(unsigned long);
+extern void raw_local_irq_restore(unsigned long);
 extern void iseries_handle_interrupts(void);
 
-#define 

Re: [RFC/PATCH 2/2] powerpc: irqtrace support to 64-bit powerpc

2007-10-15 Thread Johannes Berg
On Mon, 2007-10-15 at 17:28 +1000, Benjamin Herrenschmidt wrote:
 This adds the low level irq tracing hooks to the powerpc architecture
 needed to enable full lockdep functionality
 
 Some rework from Johannes initial version, removing the asm trampoline that
 isn't needed (thus improving perfs) and fixing a couple of bugs such as
 incorrect initial preempt_count on the softirq alternate stack.

Cool. I always wanted to look into seeing if I could remove that but
never got around to it. Thanks!


 --- linux-work.orig/include/asm-powerpc/irqflags.h2007-10-15 
 17:10:12.0 +1000
 +++ linux-work/include/asm-powerpc/irqflags.h 2007-10-15 17:11:09.0 
 +1000
 
  /*
 - * Do the CPU's IRQ-state tracing from assembly code. We call a
 - * C function, so save all the C-clobbered registers:
 + * Most of the CPU's IRQ-state tracing is done from assembly code; we
 + * have to call a C function so call a wrapper that saves all the
 + * C-clobbered registers.
   */

That comment is now wrong, it should probably be removed.

johannes


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [RFC/PATCH 2/2] powerpc: irqtrace support to 64-bit powerpc

2007-10-15 Thread Benjamin Herrenschmidt

 
  --- linux-work.orig/include/asm-powerpc/irqflags.h  2007-10-15 
  17:10:12.0 +1000
  +++ linux-work/include/asm-powerpc/irqflags.h   2007-10-15 
  17:11:09.0 +1000
  
   /*
  - * Do the CPU's IRQ-state tracing from assembly code. We call a
  - * C function, so save all the C-clobbered registers:
  + * Most of the CPU's IRQ-state tracing is done from assembly code; we
  + * have to call a C function so call a wrapper that saves all the
  + * C-clobbered registers.
*/
 
 That comment is now wrong, it should probably be removed.

Ah yes, it's stale, I'll get rid of it. Thanks.

Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev