[patch 0/4] powerpc 2.6.21-rt1: fix build a breakage and some minor issues

2007-05-13 Thread Tsutomu OWA

Hi Ingo,

  Please apply.

  This series of patches fixes a build breakage and some minor issues
including oonverting spinlocks to raw ones, adding a need_resched_delayed 
check, etc. for powerpc64.

  This applies on top of linux-2.6.21 and patch-2.6.21-rt1.

  Compile and boot tested for both PREEMPT_NONE and PREEMPT_RT on Celleb.
  Compile tested for PREEMPT_DESKTOP.

  Thanks in advance.
-- owa
TOSHIBA,  Corprate Software Engineering Center.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2/4] powerpc 2.6.21-rt1: convert spinlocks to raw ones for Celleb.

2007-05-13 Thread Tsutomu OWA

Convert more spinlocks to raw ones for Celleb.

Signed-off-by: Tsutomu OWA <[EMAIL PROTECTED]>
-- owa

diff -rup linux-2.6.21-rt1/arch/powerpc/platforms/celleb/htab.c 
rt/arch/powerpc/platforms/celleb/htab.c
--- linux-2.6.21-rt1/arch/powerpc/platforms/celleb/htab.c   2007-04-26 
12:08:32.0 +0900
+++ rt/arch/powerpc/platforms/celleb/htab.c 2007-05-07 14:05:30.0 
+0900
@@ -40,7 +40,7 @@
 #define DBG_LOW(fmt...) do { } while(0)
 #endif
 
-static DEFINE_SPINLOCK(beat_htab_lock);
+static DEFINE_RAW_SPINLOCK(beat_htab_lock);
 
 static inline unsigned int beat_read_mask(unsigned hpte_group)
 {
--- linux-2.6.21-rt1/arch/powerpc/platforms/celleb/interrupt.c  2007-04-26 
12:08:32.0 +0900
+++ rt/arch/powerpc/platforms/celleb/interrupt.c2007-05-09 
17:02:33.0 +0900
@@ -30,7 +30,7 @@
 #include "beat_wrapper.h"
 
 #defineMAX_IRQSNR_IRQS
-static DEFINE_SPINLOCK(beatic_irq_mask_lock);
+static DEFINE_RAW_SPINLOCK(beatic_irq_mask_lock);
 static uint64_tbeatic_irq_mask_enable[(MAX_IRQS+255)/64];
 static uint64_tbeatic_irq_mask_ack[(MAX_IRQS+255)/64];
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 1/4] powerpc 2.6.21-rt1: fix a build breakage by adding __raw_*_relax() macros

2007-05-13 Thread Tsutomu OWA

Add missing macros to fix a build breakage for PREEMPT_DESKTOP.

Signed-off-by: Tsutomu OWA <[EMAIL PROTECTED]>
-- owa

diff -rup linux-2.6.21-rt1/include/asm-powerpc/spinlock.h 
rt/include/asm-powerpc/spinlock.h
--- linux-2.6.21-rt1/include/asm-powerpc/spinlock.h 2007-05-07 
14:08:12.0 +0900
+++ rt/include/asm-powerpc/spinlock.h   2007-05-07 16:56:41.0 +0900
@@ -289,5 +289,9 @@ static __inline__ void __raw_write_unloc
 #define _raw_read_relax(lock)  __rw_yield(lock)
 #define _raw_write_relax(lock) __rw_yield(lock)
 
+#define __raw_spin_relax(lock)  cpu_relax()
+#define __raw_read_relax(lock)  cpu_relax()
+#define __raw_write_relax(lock) cpu_relax()
+
 #endif /* __KERNEL__ */
 #endif /* __ASM_SPINLOCK_H */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 0/4] powerpc 2.6.21-rt1: reduce scheduling latency by changing tlb flush size

2007-05-13 Thread Tsutomu OWA

To reduce scheduling latecy by changing tlb flush size to 1.
Since tlb flush on Celleb is done by calling (an) expensive hypervisor call(s), 
it takes a long time to flush tlbs and causes scheduing latency.

As I don't know how long it takes on other platforms, it would be better to 
enclose it within #ifdef CONFIG_PPC_CELLEB.

Signed-off-by: Tsutomu OWA <[EMAIL PROTECTED]>
-- owa

diff -rup linux-2.6.21-rt1/include/asm-powerpc/tlbflush.h 
rt/include/asm-powerpc/tlbflush.h
--- linux-2.6.21-rt1/include/asm-powerpc/tlbflush.h 2007-04-26 
12:08:32.0 +0900
+++ rt/include/asm-powerpc/tlbflush.h   2007-05-07 14:23:50.0 +0900
@@ -25,7 +25,11 @@ struct mm_struct;
 #include 
 #include 
 
+#ifdef CONFIG_PREEMPT_RT
+#define PPC64_TLB_BATCH_NR 1 /* Since tlb flush takes long time, reduce it to 
1 when RT */
+#else
 #define PPC64_TLB_BATCH_NR 192
+#endif /* CONFIG_PREEMPT_RT */
 
 struct ppc64_tlb_batch {
unsigned long index;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 4/4] powerpc 2.6.21-rt1: reduce scheduling latency by changing tlb flush size

2007-05-13 Thread Tsutomu OWA

Oopps, Subject was wrong resending it.  Sorry.

To reduce scheduling latecy by changing tlb flush size to 1.
Since tlb flush on Celleb is done by calling (an) expensive hypervisor call(s), 
it takes a long time to flush tlbs and causes scheduing latency.

As I don't know how long it takes on other platforms, it would be better to 
enclose it within #ifdef CONFIG_PPC_CELLEB.

Signed-off-by: Tsutomu OWA <[EMAIL PROTECTED]>
-- owa

diff -rup linux-2.6.21-rt1/include/asm-powerpc/tlbflush.h 
rt/include/asm-powerpc/tlbflush.h
--- linux-2.6.21-rt1/include/asm-powerpc/tlbflush.h 2007-04-26 
12:08:32.0 +0900
+++ rt/include/asm-powerpc/tlbflush.h   2007-05-07 14:23:50.0 +0900
@@ -25,7 +25,11 @@ struct mm_struct;
 #include 
 #include 
 
+#ifdef CONFIG_PREEMPT_RT
+#define PPC64_TLB_BATCH_NR 1 /* Since tlb flush takes long time, reduce it to 
1 when RT */
+#else
 #define PPC64_TLB_BATCH_NR 192
+#endif /* CONFIG_PREEMPT_RT */
 
 struct ppc64_tlb_batch {
unsigned long index;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 3/4] powerpc 2.6.21-rt1: add a need_resched_delayed() check

2007-05-13 Thread Tsutomu OWA

Add a need_resched_delayed() check.
This was pointed by Sergei Shtylyov; 
  http://ozlabs.org/pipermail/linuxppc-dev/2007-March/033148.html

Signed-off-by: Tsutomu Owa <[EMAIL PROTECTED]>
-- owa

diff -rup linux-2.6.21-rt1/arch/powerpc/kernel/idle.c 
rt/arch/powerpc/kernel/idle.c
--- linux-2.6.21-rt1/arch/powerpc/kernel/idle.c 2007-05-07 14:08:12.0 
+0900
+++ rt/arch/powerpc/kernel/idle.c   2007-05-07 14:05:30.0 +0900
@@ -70,7 +70,9 @@ void cpu_idle(void)
local_irq_disable();
 
/* check again after disabling irqs */
-   if (!need_resched() && !cpu_should_die())
+   if (!need_resched() &&
+   !need_resched_delayed() &&
+   !cpu_should_die())
ppc_md.power_save();
 
local_irq_enable();


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 4/4] powerpc 2.6.21-rt1: reduce scheduling latency by changing tlb flush size

2007-05-14 Thread Tsutomu OWA

At Mon, 14 May 2007 08:51:46 +0200, Thomas Gleixner wrote:

> On Mon, 2007-05-14 at 15:38 +0900, Tsutomu OWA wrote:
> > As I don't know how long it takes on other platforms, it would be better to 
> > enclose it within #ifdef CONFIG_PPC_CELLEB.
> 
> Yes, that might be appropriate. Can you add this and resend please ?

  Certainly, and thanks for your comment.

To reduce scheduling latecy by changing tlb flush size to 1.
Since tlb flush on Celleb is done by calling (an) expensive hypervisor call(s), 
it takes a long time to flush tlbs and causes scheduing latency.

Signed-off-by: Tsutomu OWA <[EMAIL PROTECTED]>
-- owa

--- linux-2.6.21-rt1/include/asm-powerpc/tlbflush.h 2007-04-26 
12:08:32.0 +0900
+++ rt/include/asm-powerpc/tlbflush.h   2007-05-14 16:12:47.0 +0900
@@ -25,7 +25,12 @@ struct mm_struct;
 #include 
 #include 
 
+#if defined(CONFIG_PPC_CELLEB) && defined(CONFIG_PREEMPT_RT)
+/* Since tlb flush takes long time on Celleb, reduce it to 1 when Celleb && RT 
*/
+#define PPC64_TLB_BATCH_NR 1
+#else
 #define PPC64_TLB_BATCH_NR 192
+#endif /* defined(CONFIG_PPC_CELLEB) && defined(CONFIG_PREEMPT_RT) */
 
 struct ppc64_tlb_batch {
unsigned long index;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 0/5] powerpc 2.6.21-rt1] latency trace support for powerpc

2007-05-14 Thread Tsutomu OWA

Hi Ingo,

  Please consider for inclusion.

  This series of patches adds very basic latency trace support for powerpc.

  Compile, boot and trace tested (a little) on Celleb.

  Thanks in advance.

-- owa
TOSHIBA, Corprate Software Engineering Center.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 1/5] powerpc 2.6.21-rt1: add mcount() and _mcount()

2007-05-14 Thread Tsutomu OWA

add mcount() and _mcount() for latency trace support.

Signed-off-by: Tsutomu OWA <[EMAIL PROTECTED]>
-- owa

diff -rup linux-2.6.21-rt1/arch/powerpc/kernel/entry_64.S 
rt/arch/powerpc/kernel/entry_64.S
--- linux-2.6.21-rt1/arch/powerpc/kernel/entry_64.S 2007-05-07 
14:08:12.0 +0900
+++ rt/arch/powerpc/kernel/entry_64.S   2007-05-08 18:54:07.0 +0900
@@ -832,3 +832,63 @@ _GLOBAL(enter_prom)
ld  r0,16(r1)
mtlrr0
 blr
+
+#ifdef CONFIG_MCOUNT
+/*
+ * code almost taken from entry_32.S
+ */
+#define MCOUNT_FRAME_SIZE 32
+_GLOBAL(mcount)
+   stdur1,-MCOUNT_FRAME_SIZE(r1)
+   mflrr3
+
+   LOAD_REG_ADDR(r5,mcount_enabled)
+   lwz r5,0(r5)
+   std r3,MCOUNT_FRAME_SIZE+16(r1)
+   cmpwi   r5,0
+   beq 1f
+
+   /* r3 contains lr (eip), put parent lr (parent_eip) in r4 */
+   ld  r4,MCOUNT_FRAME_SIZE(r1)
+   ld  r4,16(r4)
+   bl  .__trace
+   nop
+1:
+   ld  r0,MCOUNT_FRAME_SIZE+16(r1)
+   mtlrr0
+   addir1,r1,MCOUNT_FRAME_SIZE
+   blr
+
+/*
+ * Based on glibc-2.4/sysdeps/powerpc/powerpc64/ppc-mcount.S
+ *
+ * We don't need to save the parameter-passing registers as gcc takes
+ * care of that for us.  Thus this function looks fairly normal.
+ * In fact, the generic code would work for us.
+ */
+_GLOBAL(_mcount)
+   /* return if we're in real mode. */
+   mfmsr   r3
+   andi.   r0,r3,MSR_IR|MSR_DR /* see if relocation is on? */
+   beqlr   /* if not, do nothing. */
+   /* we're in translation mode. keep going. */
+   mflrr3
+   ld  r11,0(r1)   /* load back chain ptr */
+   stdur1,-STACK_FRAME_OVERHEAD(r1)
+   std r3,STACK_FRAME_OVERHEAD+16(r1)
+   ld  r4,16(r11)  /* LR in back chain */
+   LOAD_REG_ADDR(r5,mcount_enabled)
+   lwz r5,0(r5)
+   cmpwi   r5,0/* see if mcount_enabled? */
+   beq 1f  /* if disabled, then skip */
+
+   /* r3 contains lr (eip), put parent lr (parent_eip) in r4 */
+   bl   .__trace
+   nop
+1:
+   ld  r0,STACK_FRAME_OVERHEAD+16(r1)  /* restore saved LR */
+   mtlrr0
+   addir1,r1,STACK_FRAME_OVERHEAD
+   blr
+
+#endif /* CONFIG_MCOUNT */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 2/5] powerpc 2.6.21-rt1: dummy functions and export _mcount to compile

2007-05-14 Thread Tsutomu OWA

add dummy functions save_stack_trace(), early_printk() for now and
export _mcount to compile.

Signed-off-by: Tsutomu OWA <[EMAIL PROTECTED]>
-- owa

diff -rup linux-2.6.21-rt1/arch/powerpc/kernel/setup_64.c 
rt/arch/powerpc/kernel/setup_64.c
--- linux-2.6.21-rt1/arch/powerpc/kernel/setup_64.c 2007-04-26 
12:08:32.0 +0900
+++ rt/arch/powerpc/kernel/setup_64.c   2007-05-08 18:50:46.0 +0900
@@ -606,3 +606,22 @@ struct ppc_pci_io ppc_pci_io;
 EXPORT_SYMBOL(ppc_pci_io);
 #endif /* CONFIG_PPC_INDIRECT_IO */
 
+#ifdef CONFIG_STACKTRACE
+#include 
+void notrace save_stack_trace(struct stack_trace *trace,
+ struct task_struct *task)
+{
+}
+#endif /* CONFIG_STACKTRACE */
+
+#ifdef CONFIG_EARLY_PRINTK
+void notrace early_printk(const char *fmt, ...)
+{
+   BUG();
+}
+#endif /* CONFIG_EARLY_PRINTK */
+
+#ifdef CONFIG_MCOUNT
+extern void _mcount(void);
+EXPORT_SYMBOL(_mcount);
+#endif /* CONFIG_MCOUNT */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 3/5] powerpc 2.6.21-rt1: mark raw_local_irq_restore() and timebase_read() as notrace

2007-05-14 Thread Tsutomu OWA

mark raw_local_irq_restore() and timebase_read() as notrace since
these are called from __trace().

Signed-off-by: Tsutomu OWA <[EMAIL PROTECTED]>
-- owa

diff -rup linux-2.6.21-rt1/arch/powerpc/kernel/irq.c 
rt/arch/powerpc/kernel/irq.c
--- linux-2.6.21-rt1/arch/powerpc/kernel/irq.c  2007-05-07 14:08:12.0 
+0900
+++ rt/arch/powerpc/kernel/irq.c2007-05-07 14:05:30.0 +0900
@@ -111,7 +111,7 @@ static inline void set_soft_enabled(unsi
: : "r" (enable), "i" (offsetof(struct paca_struct, soft_enabled)));
 }
 
-void raw_local_irq_restore(unsigned long en)
+void notrace raw_local_irq_restore(unsigned long en)
 {
/*
 * get_paca()->soft_enabled = en;
--- linux-2.6.21-rt1/arch/powerpc/kernel/time.c 2007-05-09 17:52:05.0 
+0900
+++ rt/arch/powerpc/kernel/time.c   2007-05-09 18:03:39.0 +0900
@@ -923,7 +923,7 @@ void div128_by_32(u64 dividend_high, u64
 
 #include 
 
-static cycle_t timebase_read(void)
+static cycle_t notrace timebase_read(void)
 {
return (cycle_t)get_tb();
 }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 4/5] powerpc 2.6.21-rt1: rename mcount variable in xmon to xmon_mcount

2007-05-14 Thread Tsutomu OWA

Rename variable name "mcount" in xmon to xmon_mcount, since it conflicts 
with mcount() function used by latency trace function.

Signed-off-by: Tsutomu OWA <[EMAIL PROTECTED]>
-- owa

diff -rup linux-2.6.21-rt1/arch/powerpc/xmon/xmon.c rt/arch/powerpc/xmon/xmon.c
--- linux-2.6.21-rt1/arch/powerpc/xmon/xmon.c   2007-05-07 14:08:12.0 
+0900
+++ rt/arch/powerpc/xmon/xmon.c 2007-05-07 14:05:30.0 +0900
@@ -2129,7 +2129,7 @@ print_address(unsigned long addr)
 static unsigned long mdest;/* destination address */
 static unsigned long msrc; /* source address */
 static unsigned long mval; /* byte value to set memory to */
-static unsigned long mcount;   /* # bytes to affect */
+static unsigned long xmon_mcount;  /* # bytes to affect */
 static unsigned long mdiffs;   /* max # differences to print */
 
 void
@@ -2141,19 +2141,20 @@ memops(int cmd)
scanhex((void *)(cmd == 's'? &mval: &msrc));
if( termch != '\n' )
termch = 0;
-   scanhex((void *)&mcount);
+   scanhex((void *)&xmon_mcount);
switch( cmd ){
case 'm':
-   memmove((void *)mdest, (void *)msrc, mcount);
+   memmove((void *)mdest, (void *)msrc, xmon_mcount);
break;
case 's':
-   memset((void *)mdest, mval, mcount);
+   memset((void *)mdest, mval, xmon_mcount);
break;
case 'd':
if( termch != '\n' )
termch = 0;
scanhex((void *)&mdiffs);
-   memdiffs((unsigned char *)mdest, (unsigned char *)msrc, mcount, 
mdiffs);
+   memdiffs((unsigned char *)mdest, (unsigned char *)msrc,
+xmon_mcount, mdiffs);
break;
}
 }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 5/5] powerpc 2.6.21-rt1] fix clocksource_timebase.shift value

2007-05-14 Thread Tsutomu OWA

Calculate clocksource_timebase.shift from tb_ticks_per_jiffy to get an
accurate translation, though I don't understand why current version of 
clocksource_timebase.shift could be constant...

Signed-off-by: Tsutomu OWA <[EMAIL PROTECTED]>
-- owa

--- linux-2.6.21-rt1/arch/powerpc/kernel/time.c 2007-05-09 18:05:57.0 
+0900
+++ rt/arch/powerpc/kernel/time.c   2007-05-09 18:06:24.0 +0900
@@ -945,6 +945,9 @@ static int __init init_timebase_clocksou
if (__USE_RTC())
return -ENODEV;
 
+#ifdef CONFIG_PPC64
+   clocksource_timebase.shift = tb_ticks_per_jiffy / 100;
+#endif
clocksource_timebase.mult = clocksource_hz2mult(tb_ticks_per_sec,
clocksource_timebase.shift);
return clocksource_register(&clocksource_timebase);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 4/4] powerpc 2.6.21-rt1: reduce scheduling latency by changing tlb flush size

2007-05-14 Thread Tsutomu OWA

At Mon, 14 May 2007 16:40:02 +0200, Arnd Bergmann wrote:
> 
> On Monday 14 May 2007, Tsutomu OWA wrote:
> > --- linux-2.6.21-rt1/include/asm-powerpc/tlbflush.h 2007-04-26 
> > 12:08:32.0 +0900
> > +++ rt/include/asm-powerpc/tlbflush.h   2007-05-14 16:12:47.0 +0900
> > @@ -25,7 +25,12 @@ struct mm_struct;
> >  #include 
> >  #include 
> >  
> > +#if defined(CONFIG_PPC_CELLEB) && defined(CONFIG_PREEMPT_RT)
> > +/* Since tlb flush takes long time on Celleb, reduce it to 1 when Celleb 
> > && RT */
> > +#define PPC64_TLB_BATCH_NR 1

> With this code, you get silent side-effects of enabling PPC_CELLEB
> along with another platform.

  Yeah, thank you for pointing it out.
  I'll send revised patch later.

> Maybe instead you should change the hpte_need_flush() to always flush
> when running on the celleb platform and PREEMPT_RT is enabled.

  Hmm... Is it in linux-2.6.21?  grep'ing it did not help... 

  Is http://patchwork.ozlabs.org/linuxppc/patch?id=10361 is the first place
where the hpte_need_flush() appears?

-- owa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 4/4] powerpc 2.6.21-rt1: reduce scheduling latency by changing tlb flush size

2007-05-14 Thread Tsutomu OWA

At Mon, 14 May 2007 16:40:02 +0200, Arnd Bergmann wrote:

> > +#if defined(CONFIG_PPC_CELLEB) && defined(CONFIG_PREEMPT_RT)
> > +/* Since tlb flush takes long time on Celleb, reduce it to 1 when Celleb 
> > && RT */
> > +#define PPC64_TLB_BATCH_NR 1

> With this code, you get silent side-effects of enabling PPC_CELLEB
> along with another platform.

> Maybe instead you should change the hpte_need_flush() to always flush
> when running on the celleb platform and PREEMPT_RT is enabled.

  OK, how about this one?

  thanks a lot!

Since flushing tlb needs expensive hypervisor call(s) on celleb,
always flush it on RT to reduce scheduling latency.

Signed-off-by: Tsutomu OWA <[EMAIL PROTECTED]>
-- owa

--- linux-2.6.21-rt1/arch/powerpc/mm/tlb_64.c   2007-05-07 14:08:12.0 
+0900
+++ rt/arch/powerpc/mm/tlb_64.c 2007-05-15 15:19:34.0 +0900
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
 
@@ -180,6 +181,18 @@ void hpte_update(struct mm_struct *mm, u
batch->vaddr[i] = (vsid << 28 ) | (addr & 0x0fff);
batch->pte[i] = __real_pte(__pte(pte), ptep);
batch->index = ++i;
+
+#ifdef CONFIG_PREEMPT_RT
+   /*
+* Since flushing tlb needs expensive hypervisor call(s) on celleb,
+* always flush it on RT to reduce scheduling latency.
+*/
+   if (machine_is(celleb)) {
+   flush_tlb_pending();
+   return;
+   }
+#endif /* CONFIG_PREEMPT_RT */
+
if (i >= PPC64_TLB_BATCH_NR)
flush_tlb_pending();
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 4/4] powerpc 2.6.21-rt1: reduce scheduling latency by changing tlb flush size

2007-05-15 Thread Tsutomu OWA

At Tue, 15 May 2007 17:38:27 +1000, Benjamin Herrenschmidt wrote:

> > +#ifdef CONFIG_PREEMPT_RT
> > +   /*
> > +* Since flushing tlb needs expensive hypervisor call(s) on celleb,
> > +* always flush it on RT to reduce scheduling latency.
> > +*/
> > +   if (machine_is(celleb)) {
> > +   flush_tlb_pending();
> > +   return;
> > +   }
> > +#endif /* CONFIG_PREEMPT_RT */

> Any reason to do that only on celleb ? :-)

  Well, at least it does not harm any other platforms :)

> Also, we might want to still batch, though in smaller amount. 

  Yeah, it's a good point.

>Have you 
> measured
> the time it takes ? We might want to modulate the amount based on wether we
> are using native hash tables or an hypervisor.

  Yes, here is the trace log.  Accordint it, flushing  9 entries takes about 
50us.
It means that flushing 192 (PPC64_TLB_BATCH_NR) entries takes 1ms.
Please note that tracing causes *roughly* 20-30% overhead, though.

  I'm afraid I don't have numbers w/ native version, but I suppose you have :)

# cat /proc/latency_trace
preemption latency trace v1.1.5 on 2.6.21-rt1

 latency: 60 us, #53/53, CPU#0 | (M:rt VP:0, KP:0, SP:1 HP:1 #P:1)
-
| task: inetd-358 (uid:0 nice:0 policy:0 rt_prio:0)
-
 => started at: .__switch_to+0xa8/0x178 
 => ended at:   .__start+0x4000/0x8 <>

 _--=> CPU#
/ _-=> irqs-off
   | / _=> need-resched
   || / _---=> hardirq/softirq 
   ||| / _--=> preempt-depth   
    /  
   | delay 
   cmd pid | time  |   caller  
  \   /|   \   |   /   
   inetd-358   0D..20us : .user_trace_start (.__switch_to)
   inetd-358   0D..20us : .rt_up (.user_trace_start)
   inetd-358   0D..31us : .rt_mutex_unlock (.rt_up)
   inetd-358   0D..32us : .__flush_tlb_pending (.__switch_to)
   inetd-358   0D..43us : .flush_hash_range (.__flush_tlb_pending)
   inetd-358   0D..43us : .flush_hash_page (.flush_hash_range)
   inetd-358   0D..44us : .beat_lpar_hpte_invalidate (.flush_hash_page)
   inetd-358   0D..45us : .__spin_lock_irqsave (.beat_lpar_hpte_invalidate)
   inetd-358   0D..56us+: .beat_lpar_hpte_getword0 
(.beat_lpar_hpte_invalidate)
   inetd-358   0D..5   13us : .__spin_unlock_irqrestore 
(.beat_lpar_hpte_invalidate)
   inetd-358   0D..4   13us : .flush_hash_page (.flush_hash_range)
   inetd-358   0D..4   14us : .beat_lpar_hpte_invalidate (.flush_hash_page)
   inetd-358   0D..4   14us : .__spin_lock_irqsave (.beat_lpar_hpte_invalidate)
   inetd-358   0D..5   15us+: .beat_lpar_hpte_getword0 
(.beat_lpar_hpte_invalidate)
   inetd-358   0D..5   18us : .__spin_unlock_irqrestore 
(.beat_lpar_hpte_invalidate)
   inetd-358   0D..4   19us : .flush_hash_page (.flush_hash_range)
   inetd-358   0D..4   20us : .beat_lpar_hpte_invalidate (.flush_hash_page)
   inetd-358   0D..4   20us : .__spin_lock_irqsave (.beat_lpar_hpte_invalidate)
   inetd-358   0D..5   21us+: .beat_lpar_hpte_getword0 
(.beat_lpar_hpte_invalidate)
   inetd-358   0D..5   24us : .__spin_unlock_irqrestore 
(.beat_lpar_hpte_invalidate)
   inetd-358   0D..4   25us : .flush_hash_page (.flush_hash_range)
   inetd-358   0D..4   25us : .beat_lpar_hpte_invalidate (.flush_hash_page)
   inetd-358   0D..4   26us : .__spin_lock_irqsave (.beat_lpar_hpte_invalidate)
   inetd-358   0D..5   26us+: .beat_lpar_hpte_getword0 
(.beat_lpar_hpte_invalidate)
   inetd-358   0D..5   30us : .__spin_unlock_irqrestore 
(.beat_lpar_hpte_invalidate)
   inetd-358   0D..4   30us : .flush_hash_page (.flush_hash_range)
   inetd-358   0D..4   31us : .beat_lpar_hpte_invalidate (.flush_hash_page)
   inetd-358   0D..4   31us : .__spin_lock_irqsave (.beat_lpar_hpte_invalidate)
   inetd-358   0D..5   32us+: .beat_lpar_hpte_getword0 
(.beat_lpar_hpte_invalidate)
   inetd-358   0D..5   36us : .__spin_unlock_irqrestore 
(.beat_lpar_hpte_invalidate)
   inetd-358   0D..4   36us : .flush_hash_page (.flush_hash_range)
   inetd-358   0D..4   37us : .beat_lpar_hpte_invalidate (.flush_hash_page)
   inetd-358   0D..4   37us : .__spin_lock_irqsave (.beat_lpar_hpte_invalidate)
   inetd-358   0D..5   38us+: .beat_lpar_hpte_getword0 
(.beat_lpar_hpte_invalidate)
   inetd-358   0D..5   41us : .__spin_unlock_irqrestore 
(.beat_lpar_hpte_invalidate)
   inetd-358   0D..4   42us : .flush_hash_page (.flush_hash_range)
   inetd-358   0D..4   42us : .beat_lpar_hpte_invalidate (.flush_hash_page)
   inetd-358   0D..4   43us : .__spin_lock_irqsave (.beat_lpar_hpte_invalidate)
   inetd-358   0D..5   43us+: .beat_lpar_hpte_getword0 
(.beat_lpar_hpte_invalidate)
   inetd-358   0D..5   47us : .__spin_unlock_irqrestore 
(.beat_lpar_hpte_invalidate)
   inetd-3

[PATCH] powerpc 2.6.21-rt6: replace preempt_schedule w/ preempt_schedule_irq

2007-05-22 Thread Tsutomu OWA

Hi Ingo and Thomas,

Please apply.

Replace preempt_schedule() w/ preempt_schedule_irq() in irq return path,
to avoid irq-entry recursion and stack overflow problems for powerpc64.
It hits when doing netperf from another machine to the machine running rt 
kernel.

This patch applies on top of linux-2.6.21 + patch-2.6.21-rt6.

Compile, boot and netperf tested on celleb.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
~ $ uname -a
Linux Linux 2.6.21-rt6 #1 SMP PREEMPT RT Tue May 22 19:18:00 JST 2007 ppc64 unkn
own
~ $ Unable to handle kernel paging request for data at address 0xc180004cd9b
0
Faulting instruction address: 0xc003da48
cpu 0x0: Vector: 300 (Data Access) at [cfffba00]
pc: c003da48: .resched_task+0x34/0xc4
lr: c00410b4: .try_to_wake_up+0x4cc/0x5a8
sp: cfffbc80
   msr: 90001032
   dar: c180004cd9b0
 dsisr: 4000
  current = 0xc244ed20
  paca= 0xc04cd980
pid   = 425, comm = netserver
enter ? for help
[cfffbd00] c00410b4 .try_to_wake_up+0x4cc/0x5a8
[cfffbde0] c00880c8 .redirect_hardirq+0x68/0x88
[cfffbe60] c008aec8 .handle_level_irq+0x13c/0x220
[cfffbf00] c0032538 .spider_irq_cascade+0x98/0xec
[cfffbf90] c0022280 .call_handle_irq+0x1c/0x2c
[c25abea0] c000c33c .do_IRQ+0xc8/0x17c
[c25abf30] c000444c hardware_interrupt_entry+0x18/0x4c
--- Exception: 501 (Hardware Interrupt) at c000afec 
.raw_local_irq_restore+0x3c/0x40
[link register   ] c03baaac .preempt_schedule+0xac/0xd0
[c25ac220] c03baa88 .preempt_schedule+0x88/0xd0 (unreliable)
[c25ac2b0] c0008bd8 do_work+0x38/0x5c
--- Exception: 501 (Hardware Interrupt) at c000afec .raw_local_irq_resto



--- Exception: 501 (Hardware Interrupt) at c000afec 
.raw_local_irq_restore+0x3c/0x40
[link register   ] c03baaac .preempt_schedule+0xac/0xd0
[c25af320] c03baa88 .preempt_schedule+0x88/0xd0 (unreliable)
[c25af3b0] c0008bd8 do_work+0x38/0x5c
--- Exception: 501 (Hardware Interrupt) at c002eb64 
.__copy_tofrom_user+0x164/0x580
[link register   ] c002f26c .copy_to_user+0x34/0x50
[c25af6a0] 05a8 (unreliable)
[c25af710] c0318674 .memcpy_toiovec+0x58/0xc4
[c25af7b0] c0318d4c .skb_copy_datagram_iovec+0x90/0x2d0
[c25af870] c0349bf4 .tcp_recvmsg+0x534/0x8d8
[c25af960] c0310fd8 .sock_common_recvmsg+0x5c/0x84
[c25af9f0] c030ea58 .sock_recvmsg+0x110/0x15c
[c25afc00] c03101b0 .sys_recvfrom+0xf0/0x174
[c25afd90] c032e20c .compat_sys_socketcall+0x178/0x214
[c25afe30] c0008608 syscall_exit+0x0/0x40
--- Exception: c01 (System Call) at 0fe86df0
SP (ffe709c0) is in userspace
0:mon> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

thanks in advance.
Signed-off-by: Tsutomu OWA <[EMAIL PROTECTED]>
-- owa

--- mcount/arch/powerpc/kernel/entry_64.S   2007-05-15 18:46:38.0 
+0900
+++ send/rt/arch/powerpc/kernel/entry_64.S  2007-05-15 15:44:40.0 
+0900
@@ -559,14 +559,9 @@ do_work:
cmpdi   r0,0
crandc  eq,cr1*4+eq,eq
bne restore
-   /* here we are preempting the current task */
 1:
-   li  r0,1
-   stb r0,PACASOFTIRQEN(r13)
-   stb r0,PACAHARDIRQEN(r13)
-   ori r10,r10,MSR_EE
-   mtmsrd  r10,1   /* reenable interrupts */
-   bl  .preempt_schedule
+   /* preempt_schedule_irq() expects interrupts disabled. */
+   bl  .preempt_schedule_irq
mfmsr   r10
clrrdi  r9,r1,THREAD_SHIFT
rldicl  r10,r10,48,1/* disable interrupts again */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] powerpc 2.6.21-rt6: revert spider_net

2007-05-22 Thread Tsutomu OWA

Hi Ingo and Thomas,

Please apply.

To revert spider_net.c to original one as it turns out that the patch 
I sent was unnecessary.  It was my mistake.

Compile, boot and netperf tested on celleb.

thanks for your time!

Signed-off-by: Tsutomu OWA <[EMAIL PROTECTED]>
-- owa

--- linux-2.6.21-rt3/drivers/net/spider_net.c   2007-05-21 15:19:42.0 
+0900
+++ rt/drivers/net/spider_net.c 2007-04-26 12:08:32.0 +0900
@@ -688,6 +688,7 @@ spider_net_prepare_tx_descr(struct spide
struct spider_net_descr *descr;
struct spider_net_hw_descr *hwdescr;
dma_addr_t buf;
+   unsigned long flags;
 
buf = pci_map_single(card->pdev, skb->data, skb->len, PCI_DMA_TODEVICE);
if (pci_dma_mapping_error(buf)) {
@@ -698,8 +699,10 @@ spider_net_prepare_tx_descr(struct spide
return -ENOMEM;
}
 
+   spin_lock_irqsave(&chain->lock, flags);
descr = card->tx_chain.head;
if (descr->next == chain->tail->prev) {
+   spin_unlock_irqrestore(&chain->lock, flags);
pci_unmap_single(card->pdev, buf, skb->len, PCI_DMA_TODEVICE);
return -ENOMEM;
}
@@ -714,6 +717,7 @@ spider_net_prepare_tx_descr(struct spide
 
hwdescr->dmac_cmd_status =
SPIDER_NET_DESCR_CARDOWNED | SPIDER_NET_DMAC_NOCS;
+   spin_unlock_irqrestore(&chain->lock, flags);
 
if (skb->protocol == htons(ETH_P_IP) && skb->ip_summed == 
CHECKSUM_PARTIAL)
switch (skb->nh.iph->protocol) {
@@ -738,6 +742,7 @@ spider_net_set_low_watermark(struct spid
 {
struct spider_net_descr *descr = card->tx_chain.tail;
struct spider_net_hw_descr *hwdescr;
+   unsigned long flags;
int status;
int cnt=0;
int i;
@@ -763,6 +768,7 @@ spider_net_set_low_watermark(struct spid
descr = descr->next;
 
/* Set the new watermark, clear the old watermark */
+   spin_lock_irqsave(&card->tx_chain.lock, flags);
descr->hwdescr->dmac_cmd_status |= SPIDER_NET_DESCR_TXDESFLG;
if (card->low_watermark && card->low_watermark != descr) {
hwdescr = card->low_watermark->hwdescr;
@@ -770,7 +776,7 @@ spider_net_set_low_watermark(struct spid
 hwdescr->dmac_cmd_status & ~SPIDER_NET_DESCR_TXDESFLG;
}
card->low_watermark = descr;
-
+   spin_unlock_irqrestore(&card->tx_chain.lock, flags);
return cnt;
 }
 
@@ -778,7 +784,6 @@ spider_net_set_low_watermark(struct spid
  * spider_net_release_tx_chain - processes sent tx descriptors
  * @card: adapter structure
  * @brutal: if set, don't care about whether descriptor seems to be in use
- * @locked: if set, tx_chain locked is held by caller.
  *
  * returns 0 if the tx ring is empty, otherwise 1.
  *
@@ -788,7 +793,7 @@ spider_net_set_low_watermark(struct spid
  * scheduled again (if we were scheduled) and will not loose initiative.
  */
 static int
-spider_net_release_tx_chain(struct spider_net_card *card, int brutal, int 
locked)
+spider_net_release_tx_chain(struct spider_net_card *card, int brutal)
 {
struct spider_net_descr_chain *chain = &card->tx_chain;
struct spider_net_descr *descr;
@@ -799,11 +804,9 @@ spider_net_release_tx_chain(struct spide
int status;
 
while (1) {
-   if (!locked)
-   spin_lock_irqsave(&chain->lock, flags);
+   spin_lock_irqsave(&chain->lock, flags);
if (chain->tail == chain->head) {
-   if (!locked)
-   spin_unlock_irqrestore(&chain->lock, flags);
+   spin_unlock_irqrestore(&chain->lock, flags);
return 0;
}
descr = chain->tail;
@@ -818,8 +821,7 @@ spider_net_release_tx_chain(struct spide
 
case SPIDER_NET_DESCR_CARDOWNED:
if (!brutal) {
-   if (!locked)
-   spin_unlock_irqrestore(&chain->lock, 
flags);
+   spin_unlock_irqrestore(&chain->lock, flags);
return 1;
}
 
@@ -840,8 +842,7 @@ spider_net_release_tx_chain(struct spide
default:
card->netdev_stats.tx_dropped++;
if (!brutal) {
-   if (!locked)
-   spin_unlock_irqrestore(&chain->lock, 
flags);
+   spin_unlock_irqrestore(&chain->lock, flags);
return 1;
}
}
@@ -851,9 +852,7 @@ spider_net_release_tx_chain(struct spide

Re: [patch 1/6 -rt] powerpc 2.6.20-rt8: add preemption checks for NEED_RESCHED_DELAYED.

2007-03-18 Thread Tsutomu OWA

Hi,

At Fri, 16 Mar 2007 22:20:27 +0300,
Sergei Shtylyov wrote:
> Argh, I've missed this one! :-(
> But shouldn't we also add !need_resched_delayed() to another place below?
> 
> if (ppc_md.power_save)  {
> [...]
>   if (!need_resched() && !cpu_should_die())

  Thanks for pointing it out.  Yes, it looks like needed.  
-- owa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 1/7 -rt] powerpc 2.6.20-rt8: fix compile error in bug.h

2007-03-06 Thread Tsutomu OWA

  To fix the following compile error by enclosing it in ifndef 
__ASSEMBLY__/endif.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
include/asm-generic/bug.h
include/asm-generic/bug.h: Assembler messages:
include/asm-generic/bug.h:7: Error: Unrecognized opcode: `extern'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Signed-off-by: Tsutomu Owa <[EMAIL PROTECTED]>
-- owa

diff -rup linux-rt8/include/asm-generic/bug.h rt/include/asm-generic/bug.h
--- linux-rt8/include/asm-generic/bug.h 2007-02-20 14:30:39.0 +0900
+++ rt/include/asm-generic/bug.h2007-02-20 15:48:42.0 +0900
@@ -3,7 +3,9 @@
 
 #include 
 
+#ifndef __ASSEMBLY__
 extern void __WARN_ON(const char *func, const char *file, const int line);
+#endif /* __ASSEMBLY__ */
 
 #ifdef CONFIG_BUG
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 2/7] powerpc 2.6.20-rt8: fix compile error (time.c)

2007-03-06 Thread Tsutomu OWA

To fix the following compile error by replacing the deleted structure
member "is_continuous" with "flags".

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
arch/powerpc/kernel/time.c
arch/powerpc/kernel/time.c:938: error: unknown field 'is_continuous' specified 
in initializer
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Signed-off-by: Tsutomu Owa <[EMAIL PROTECTED]>

-- owa

diff -rup linux-rt8/arch/powerpc/kernel/time.c rt/arch/powerpc/kernel/time.c
--- linux-rt8/arch/powerpc/kernel/time.c2007-02-20 14:30:38.0 
+0900
+++ rt/arch/powerpc/kernel/time.c   2007-03-05 10:27:26.0 +0900
@@ -935,7 +935,7 @@ struct clocksource clocksource_timebase 
.mask   = (cycle_t)-1,
.mult   = 0,
.shift  = 22,
-   .is_continuous  = 1,
+   .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
 


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 3/7] powerpc 2.6.20-rt8: fix compile error (manage.c)

2007-03-06 Thread Tsutomu OWA

To fix the following compile error.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
kernel/irq/manage.c: In function 'irq_set_affinity':
kernel/irq/manage.c:81: error: invalid type argument of '->'
kernel/irq/manage.c:82: error: invalid type argument of '->'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Signed-off-by: Tsutomu Owa <[EMAIL PROTECTED]>
-- owa

diff -rup linux-rt8/kernel/irq/manage.c rt/kernel/irq/manage.c
--- linux-rt8/kernel/irq/manage.c   2007-02-20 14:30:41.0 +0900
+++ rt/kernel/irq/manage.c  2007-02-20 16:07:37.0 +0900
@@ -78,8 +78,8 @@ int irq_set_affinity(unsigned int irq, c
 #ifdef CONFIG_GENERIC_PENDING_IRQ
set_pending_irq(irq, cpumask);
 #else
-   irq_desc[irq]->affinity = cpumask;
-   irq_desc[irq]->chip->set_affinity(irq, cpumask);
+   desc->affinity = cpumask;
+   desc->chip->set_affinity(irq, cpumask);
 #endif
return 0;
 }


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 4/7] powerpc 2.6.20-rt8: fix compile error (futex.h)

2007-03-06 Thread Tsutomu OWA

To fix the following compile error by adding dummy functions for now.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
include/asm-powerpc/futex.h
kernel/built-in.o: In function `fixup_pi_state_owner64':
kernel/futex.c:2380: undefined reference to `.futex_atomic_cmpxchg_inatomic64'
kernel/built-in.o: In function `futex_lock_pi64':
kernel/futex.c:3228: undefined reference to `.futex_atomic_cmpxchg_inatomic64'
kernel/futex.c:3273: undefined reference to `.futex_atomic_cmpxchg_inatomic64'
kernel/futex.c:3310: undefined reference to `.futex_atomic_cmpxchg_inatomic64'
kernel/built-in.o: In function `futex_requeue_pi64':
kernel/futex.c:2756: undefined reference to `.futex_atomic_cmpxchg_inatomic64'
kernel/built-in.o: In function `do_futex64':
kernel/futex.c:2547: undefined reference to `.futex_atomic_op_inuser64'
kernel/futex.c:3446: undefined reference to `.futex_atomic_cmpxchg_inatomic64'
:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Signed-off-by: Tsutomu Owa <[EMAIL PROTECTED]>
-- owa

diff -rup linux-rt8/include/asm-powerpc/futex.h rt/include/asm-powerpc/futex.h
--- linux-rt8/include/asm-powerpc/futex.h   2007-02-20 09:37:26.0 
+0900
+++ rt/include/asm-powerpc/futex.h  2007-03-05 10:36:15.0 +0900
@@ -113,5 +113,25 @@ futex_atomic_cmpxchg_inatomic(int __user
 return prev;
 }
 
+static inline int
+futex_atomic_op_inuser64 (int encoded_op, u64 __user *uaddr)
+{
+   /* FIXME: implement this at some point! */
+   printk("futex_atomic_op_inuser64: not yet.\n");
+   BUG();
+
+   return 0;
+}
+
+static inline u64
+futex_atomic_cmpxchg_inatomic64(u64 __user *uaddr, u64 oldval, u64 newval)
+{
+   /* FIXME: implement this at some point! */
+   printk("futex_atomic_cmpxchg_inatomic64: not yet.\n");
+   BUG();
+
+   return 0;
+}
+
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_FUTEX_H */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 5/7 -rt] powerpc 2.6.20-rt8: fix compile error (spinlock.h)

2007-03-06 Thread Tsutomu OWA

  To fix the following compile error by changing names from
__{read,write}_trylock to ___raw_{read,write}_trylock in asm-powerpc/spinlock.h

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
include/asm-powerpc/spinlock.h
include/linux/spinlock_api_smp.h:49: error: conflicting types for 
'__read_trylock'
include/asm/spinlock.h:183: error: previous definition of '__read_trylock' was 
here
include/linux/spinlock_api_smp.h:50: error: conflicting types for 
'__write_trylock'
include/asm/spinlock.h:207: error: previous definition of '__write_trylock' was 
here
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Signed-off-by: Tsutomu Owa <[EMAIL PROTECTED]>
-- owa

diff -rup linux-rt8/include/asm-powerpc/spinlock.h 
rt/include/asm-powerpc/spinlock.h
--- linux-rt8/include/asm-powerpc/spinlock.h2007-02-20 14:30:40.0 
+0900
+++ rt/include/asm-powerpc/spinlock.h   2007-02-20 16:05:27.0 +0900
@@ -179,7 +179,7 @@ extern void __raw_spin_unlock_wait(__raw
  * This returns the old value in the lock + 1,
  * so we got a read lock if the return value is > 0.
  */
-static long __inline__ __read_trylock(__raw_rwlock_t *rw)
+static long __inline__ ___raw_read_trylock(__raw_rwlock_t *rw)
 {
long tmp;
 
@@ -203,7 +203,7 @@ static long __inline__ __read_trylock(__
  * This returns the old value in the lock,
  * so we got the write lock if the return value is 0.
  */
-static __inline__ long __write_trylock(__raw_rwlock_t *rw)
+static __inline__ long ___raw_write_trylock(__raw_rwlock_t *rw)
 {
long tmp, token;
 
@@ -226,7 +226,7 @@ static __inline__ long __write_trylock(_
 static void __inline__ __raw_read_lock(__raw_rwlock_t *rw)
 {
while (1) {
-   if (likely(__read_trylock(rw) > 0))
+   if (likely(___raw_read_trylock(rw) > 0))
break;
do {
HMT_low();
@@ -240,7 +240,7 @@ static void __inline__ __raw_read_lock(_
 static void __inline__ __raw_write_lock(__raw_rwlock_t *rw)
 {
while (1) {
-   if (likely(__write_trylock(rw) == 0))
+   if (likely(___raw_write_trylock(rw) == 0))
break;
do {
HMT_low();
@@ -253,12 +253,12 @@ static void __inline__ __raw_write_lock(
 
 static int __inline__ __raw_read_trylock(__raw_rwlock_t *rw)
 {
-   return __read_trylock(rw) > 0;
+   return ___raw_read_trylock(rw) > 0;
 }
 
 static int __inline__ __raw_write_trylock(__raw_rwlock_t *rw)
 {
-   return __write_trylock(rw) == 0;
+   return ___raw_write_trylock(rw) == 0;
 }
 
 static void __inline__ __raw_read_unlock(__raw_rwlock_t *rw)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 6/7 -rt] powerpc 2.6.20-rt8: fix compile error (percpu.h)

2007-03-06 Thread Tsutomu OWA

  To fix the following compile error by adding necessary macro definitions
(mostly taken from asm-generic/percpu.h).

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
include/asm-powerpc/percpu.h
In file included from include/asm/tlb.h:52,
 from arch/powerpc/mm/mem.c:44:
include/asm-generic/tlb.h:49: error: expected declaration specifiers or '...' 
before 'mmu_gathers'
include/asm-generic/tlb.h:49: warning: data definition has no type or storage 
class
include/asm-generic/tlb.h:49: warning: type defaults to 'int' in declaration of 
'DECLARE_PER_CPU_LOCKED'
include/asm-generic/tlb.h: In function 'tlb_gather_mmu':
include/asm-generic/tlb.h:58: warning: implicit declaration of function 
'__get_cpu_lock'
include/asm-generic/tlb.h:58: error: 'mmu_gathers' undeclared (first use in 
this function)
include/asm-generic/tlb.h:58: error: (Each undeclared identifier is reported 
only once
include/asm-generic/tlb.h:58: error: for each function it appears in.)
:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Signed-off-by: Tsutomu Owa <[EMAIL PROTECTED]>
-- owa

diff -rup linux-rt8/include/asm-powerpc/percpu.h rt/include/asm-powerpc/percpu.h
--- linux-rt8/include/asm-powerpc/percpu.h  2007-02-20 09:37:27.0 
+0900
+++ rt/include/asm-powerpc/percpu.h 2007-02-20 16:03:44.0 +0900
@@ -19,12 +19,24 @@
 /* Separate out the type, so (int[3], foo) works. */
 #define DEFINE_PER_CPU(type, name) \
 __attribute__((__section__(".data.percpu"))) __typeof__(type) 
per_cpu__##name
+#define DEFINE_PER_CPU_LOCKED(type, name) \
+__attribute__((__section__(".data.percpu"))) 
__DEFINE_SPINLOCK(per_cpu_lock__##name##_locked); \
+__attribute__((__section__(".data.percpu"))) __typeof__(type) 
per_cpu__##name##_locked
 
 /* var is in discarded region: offset to particular copy we want */
 #define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
 #define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
 #define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, 
__my_cpu_offset()))
 
+#define per_cpu_lock(var, cpu) \
+(*RELOC_HIDE(&per_cpu_lock__##var##_locked, __per_cpu_offset(cpu)))
+#define per_cpu_var_locked(var, cpu) \
+(*RELOC_HIDE(&per_cpu__##var##_locked, __per_cpu_offset(cpu)))
+#define __get_cpu_lock(var, cpu) \
+per_cpu_lock(var, cpu)
+#define __get_cpu_var_locked(var, cpu) \
+per_cpu_var_locked(var, cpu)
+
 /* A macro to avoid #include hell... */
 #define percpu_modcopy(pcpudst, src, size) \
 do {   \
@@ -40,17 +52,27 @@ extern void setup_per_cpu_areas(void);
 
 #define DEFINE_PER_CPU(type, name) \
 __typeof__(type) per_cpu__##name
+#define DEFINE_PER_CPU_LOCKED(type, name) \
+__DEFINE_SPINLOCK(per_cpu_lock__##name##_locked); \
+__typeof__(type) per_cpu__##name##_locked
 
 #define per_cpu(var, cpu)  (*((void)(cpu), 
&per_cpu__##var))
+#define per_cpu_var_locked(var, cpu)   (*((void)(cpu), 
&per_cpu__##var##_locked))
+
 #define __get_cpu_var(var) per_cpu__##var
 #define __raw_get_cpu_var(var) per_cpu__##var
 
 #endif /* SMP */
 
 #define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
+#define DECLARE_PER_CPU_LOCKED(type, name) \
+extern spinlock_t per_cpu_lock__##name##_locked; \
+extern __typeof__(type) per_cpu__##name##_locked
 
 #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
 #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
+#define EXPORT_PER_CPU_LOCKED_SYMBOL(var) 
EXPORT_SYMBOL(per_cpu_lock__##var##_locked); 
EXPORT_SYMBOL(per_cpu__##var##_locked)
+#define EXPORT_PER_CPU_LOCKED_SYMBOL_GPL(var) 
EXPORT_SYMBOL_GPL(per_cpu_lock__##var##_locked); 
EXPORT_SYMBOL_GPL(per_cpu__##var##_locked)
 
 #else
 #include 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 7/7 -rt] powerpc 2.6.20-rt8: fix compile error (hw_irq.h)

2007-03-06 Thread Tsutomu OWA

  To fix the following compile error by changing local_irq_restore()
to raw_local_irq_restore().

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
include/asm-powerpc/hw_irq.h
In file included from include/asm/system.h:9,
 from include/linux/list.h:9,
 from include/linux/signal.h:8,
 from arch/powerpc/kernel/asm-offsets.c:16:
include/asm/hw_irq.h: In function 'local_get_flags':
include/asm/hw_irq.h:23: error: expected expression before '<<' token
include/asm/hw_irq.h:24: error: expected expression before '<<' token
include/asm/hw_irq.h:25: error: expected expression before ':' token
include/asm/hw_irq.h:25: error: expected statement before ')' token
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Signed-off-by: Tsutomu Owa <[EMAIL PROTECTED]>
-- owa

diff -rup linux-rt8/include/asm-powerpc/hw_irq.h rt/include/asm-powerpc/hw_irq.h
--- linux-rt8/include/asm-powerpc/hw_irq.h  2007-02-20 14:30:40.0 
+0900
+++ rt/include/asm-powerpc/hw_irq.h 2007-03-05 10:39:22.0 +0900
@@ -16,18 +16,18 @@ extern void timer_interrupt(struct pt_re
 #ifdef CONFIG_PPC64
 #include 
 
-static inline unsigned long local_get_flags(void)
+static inline unsigned long raw_local_get_flags(void)
 {
unsigned long flags;
 
-<<<<<<< delete extern unsigned long local_get_flags(void);
-<<<<<<< delete extern unsigned long local_irq_disable(void);
+   __asm__ __volatile__("lbz %0,%1(13)"
+   : "=r" (flags)
: "i" (offsetof(struct paca_struct, soft_enabled)));
 
return flags;
 }
 
-static inline unsigned long local_irq_disable(void)
+static inline unsigned long raw_local_irq_disable(void)
 {
unsigned long flags, zero;
 
@@ -39,32 +39,28 @@ static inline unsigned long local_irq_di
return flags;
 }
 
-extern void iseries_handle_interrupts(void);
-extern unsigned long raw_local_get_flags(void);
-extern unsigned long raw_local_irq_disable(void);
 extern void raw_local_irq_restore(unsigned long);
+extern void iseries_handle_interrupts(void);
 
-#define raw_local_irq_enable() raw_local_irq_restore(1)
+#define raw_local_irq_enable() raw_local_irq_restore(1)
 #define raw_local_save_flags(flags)((flags) = raw_local_get_flags())
 #define raw_local_irq_save(flags)  ((flags) = raw_local_irq_disable())
 
-#define raw_irqs_disabled()(raw_local_get_flags() == 0)
+#define raw_irqs_disabled()(raw_local_get_flags() == 0)
 #define raw_irqs_disabled_flags(flags) ((flags) == 0)
 
-#define hard_irq_enable()  __mtmsrd(mfmsr() | MSR_EE, 1)
-#define hard_irq_disable() __mtmsrd(mfmsr() & ~MSR_EE, 1)
+#define hard_irq_enable()  __mtmsrd(mfmsr() | MSR_EE, 1)
+#define hard_irq_disable() __mtmsrd(mfmsr() & ~MSR_EE, 1)
 
-#else
+#else /* CONFIG_PPC64 */
 
 #if defined(CONFIG_BOOKE)
 #define SET_MSR_EE(x)  mtmsr(x)
 #define raw_local_irq_restore(flags)   __asm__ __volatile__("wrtee %0" : : "r" 
(flags) : "memory")
-<<<<<<< delete #define local_irq_restore(flags) do { \
-#define raw_local_irq_restore(flags) do { \
 #else
 #define SET_MSR_EE(x)  mtmsr(x)
 #define raw_local_irq_restore(flags)   mtmsr(flags)
-#endif
+#endif /* CONFIG_BOOKE */
 
 static inline void raw_local_irq_disable(void)
 {
diff -rup linux-rt8/arch/powerpc/kernel/irq.c rt/arch/powerpc/kernel/irq.c
--- linux-rt8/arch/powerpc/kernel/irq.c 2007-02-20 14:30:38.0 +0900
+++ rt/arch/powerpc/kernel/irq.c2007-02-20 15:44:11.0 +0900
@@ -111,7 +111,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;
diff -rup linux-rt8/arch/powerpc/kernel/head_64.S 
rt/arch/powerpc/kernel/head_64.S
--- linux-rt8/arch/powerpc/kernel/head_64.S 2007-02-20 09:38:52.0 
+0900
+++ rt/arch/powerpc/kernel/head_64.S2007-02-20 15:42:25.0 +0900
@@ -1385,7 +1385,7 @@ END_FW_FTR_SECTION_IFCLR(FW_FEATURE_ISER
 * handles any interrupts pending at this point.
 */
ld  r3,SOFTE(r1)
-   bl  .local_irq_restore
+   bl  .raw_local_irq_restore
b   11f
 
 /* Here we have a page fault that hash_page can't handle. */
diff -rup linux-rt8/arch/powerpc/kernel/ppc_ksyms.c 
rt/arch/powerpc/kernel/ppc_ksyms.c
--- linux-rt8/arch/powerpc/kernel/ppc_ksyms.c   2007-02-20 14:30:38.0 
+0900
+++ rt/arch/powerpc/kernel/ppc_ksyms.c  2007-02-20 15:44:34.0 +0900
@@ -49,7 +49,7 @@
 #endif
 
 #ifdef CONFIG_PPC64
-EXPORT_SYMBOL(local_irq_restore);
+EXPORT_SYMBOL(raw_l

[patch 0/7 -rt] powerpc 2.6.20-rt8: fix build breakage for PowerPC(ppc64)

2007-03-06 Thread Tsutomu OWA

Hi Ingo,

  Please apply.

  This series of patches fixes build breakage on arch/powerpc with realtime
preempt patch.  This applies on top of linux-2.6.20 and patch-2.6.20-rt8.

  Although there has been some efforts to port realtime-preempt patch to
powerpc, build breakage still exists for powerpc (esp. 64bit architecture).

  I'll also post these pathes later at CE Linux Forum's wiki page at;
http://tree.celinuxforum.org/CelfPubWiki/RTPatchForPowerPC

  Comments and suggestions are welcome.

  Thanks in advance.
-- owa
TOSHIBA, Software Engineering Center.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 0/6 -rt] powerpc 2.6.20-rt8: fix boot/runtime errors/warnings for PowerPC(ppc64)

2007-03-06 Thread Tsutomu OWA

Hi Ingo,

  Please consider for inclusion in your rt tree.

  This series of patches fixes boot and runntime errors/warnings for
powerpc (esp. 64 bit).  This applies to linux-2.6.20, patch-2.6.20-rt8
and previous my patch set;
  http://ozlabs.org/pipermail/linuxppc-dev/2007-March/032640.html
  http://lkml.org/lkml/2007/3/6/503

  Compile and boot tested on celleb (Cell Reference set) for both
PREEMPT_RT=y and PREEMPT_NONE=y.

  CONFIG_MCOUNT, CONFIG_LATENCY_TRACE and other tracing options nor
CONFIG_GENERIC_TIME, clockevents etc are not yet ported.

  Comments and suggestions are welcome.

  Thanks in advance.
-- owa
TOSHIBA, Software Engineering Center.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 1/6 -rt] powerpc 2.6.20-rt8: add preemption checks for NEED_RESCHED_DELAYED.

2007-03-06 Thread Tsutomu OWA

  To add preemption checks for the NEED_RESCHED_DELAYED flag.

Signed-off-by: Tsutomu Owa <[EMAIL PROTECTED]>
-- owa

diff -rup linux-rt8/include/asm-powerpc/thread_info.h 
rt/include/asm-powerpc/thread_info.h
--- linux-rt8/include/asm-powerpc/thread_info.h 2007-02-20 14:30:40.0 
+0900
+++ rt/include/asm-powerpc/thread_info.h2007-02-20 15:39:25.0 
+0900
@@ -146,7 +146,8 @@ static inline struct thread_info *curren
 #define _TIF_SYSCALL_T_OR_A
(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
 
 #define _TIF_USER_WORK_MASK(_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \
-_TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK)
+_TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK | \
+_TIF_NEED_RESCHED_DELAYED)
 #define _TIF_PERSYSCALL_MASK   (_TIF_RESTOREALL|_TIF_NOERROR)
 
 /* Bits in local_flags */
diff -rup linux-rt8/arch/powerpc/kernel/entry_64.S 
rt/arch/powerpc/kernel/entry_64.S
--- linux-rt8/arch/powerpc/kernel/entry_64.S2007-02-20 09:38:52.0 
+0900
+++ rt/arch/powerpc/kernel/entry_64.S   2007-03-05 11:59:17.0 +0900
@@ -444,7 +444,8 @@ _GLOBAL(ret_from_except_lite)
 
 #ifdef CONFIG_PREEMPT
clrrdi  r9,r1,THREAD_SHIFT  /* current_thread_info() */
-   li  r0,_TIF_NEED_RESCHED/* bits to check */
+   li  r0,(_TIF_NEED_RESCHED|_TIF_NEED_RESCHED_DELAYED)
+   /* bits to check */
ld  r3,_MSR(r1)
ld  r4,TI_FLAGS(r9)
/* Move MSR_PR bit in r3 to _TIF_SIGPENDING position in r0 */
@@ -565,7 +566,7 @@ do_work:
rotldi  r10,r10,16
mtmsrd  r10,1
ld  r4,TI_FLAGS(r9)
-   andi.   r0,r4,_TIF_NEED_RESCHED
+   andi.   r0,r4,(_TIF_NEED_RESCHED|_TIF_NEED_RESCHED_DELAYED)
bne 1b
b   restore
 
@@ -575,7 +576,7 @@ user_work:
ori r10,r10,MSR_EE
mtmsrd  r10,1
 
-   andi.   r0,r4,_TIF_NEED_RESCHED
+   andi.   r0,r4,(_TIF_NEED_RESCHED|_TIF_NEED_RESCHED_DELAYED)
beq 1f
bl  .schedule
b   .ret_from_except_lite
diff -rup linux-rt8/arch/powerpc/kernel/idle.c rt/arch/powerpc/kernel/idle.c
--- linux-rt8/arch/powerpc/kernel/idle.c2007-02-20 14:30:38.0 
+0900
+++ rt/arch/powerpc/kernel/idle.c   2007-02-20 15:43:04.0 +0900
@@ -56,7 +56,8 @@ void cpu_idle(void)
 
set_thread_flag(TIF_POLLING_NRFLAG);
while (1) {
-   while (!need_resched() && !cpu_should_die()) {
+   while (!need_resched() && !need_resched_delayed() &&
+   !cpu_should_die()) {
ppc64_runlatch_off();
 
if (ppc_md.power_save) {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 2/6 -rt] powerpc 2.6.20-rt8: to convert spinlocks to raw ones.

2007-03-06 Thread Tsutomu OWA

  To convert the spinlocks into the raw onces to fix the following 
warnings/errors.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Badness at arch/powerpc/kernel/entry_64.S:651
Call Trace:
[C06133E0] [C000FAAC] show_stack+0x68/0x1b0 (unreliable)
[C0613480] [C01EF004] .repor01EF004] .report_bug+0x94/0xe8
[C0613510] [C03EAD58] .program_check_exception+0x170/0x5a8
[C000487C] program_check_common+0xfc/0x100
--- Exception: 700 at .exception: 700 at .enter_rtas+0xa0/0x10c
LR = .rtas_call+0x144/0x1e8
[C06138D0] [C0613980] 0xc0613980 (unreliabl0064a0d8 
(unreliable)
[C0613AB0] [C001DFA8] .rtas_call+0x144/0x1etas_call+0x144/0x1e8
:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
BUG: scheduling with irqs disabled: ash/0x/462
caller is .rt_spin_lock_slowlock+0x14c/0x234
Call Trace:
[C0001FE87580] [C000FAAC] .show_stack+0x68/0x1b0 (unreliable)
[C0001FE87620] [C03E796C] .schedule+0x78/0x128
[C0001FE876A0] [C03E9378] .rt_spin_lock_slowlock+0x14c/0x234
[C0001FE877B0] [C002E3C4] .native_hpte_updatepp+0x158/0x274
[C0001FE87850] [C002C374] .htab_call_hpte_updatepp+0x4/0x18
[C0001FE87950] [C002BC74] .hash_preload+0x150/0x198
[C0001FE87A00] [C002A9E8] .update_mmu_cache+0x13c/0x1a4
[C0001FE87A90] [C00B28A0] .do_wp_page+0x7d0/0x888
[C0001FE87B60] [C00B4CB8] .__handle_mm_fault+0xee4/0x1004
[C0001FE87C50] [C03EC288] .do_page_fault+0x474/0x65c
[C0001FE87E30] [C0004CFC] handle_page_fault+0x20/0x58
:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Signed-off-by: Tsutomu Owa <[EMAIL PROTECTED]>
-- owa

diff -rup linux-rt8/include/asm-powerpc/rtas.h rt/include/asm-powerpc/rtas.h
--- linux-rt8/include/asm-powerpc/rtas.h2007-02-20 09:37:27.0 
+0900
+++ rt/include/asm-powerpc/rtas.h   2007-03-05 11:49:41.0 +0900
@@ -58,7 +58,7 @@ struct rtas_t {
unsigned long entry;/* physical address pointer */
unsigned long base; /* physical address pointer */
unsigned long size;
-   spinlock_t lock;
+   raw_spinlock_t lock;
struct rtas_args args;
struct device_node *dev;/* virtual address pointer */
 };
diff -rup linux-rt8/arch/powerpc/kernel/rtas.c rt/arch/powerpc/kernel/rtas.c
--- linux-rt8/arch/powerpc/kernel/rtas.c2007-02-20 09:38:52.0 
+0900
+++ rt/arch/powerpc/kernel/rtas.c   2007-03-05 11:50:58.0 +0900
@@ -36,7 +36,7 @@
 #include 
 
 struct rtas_t rtas = {
-   .lock = SPIN_LOCK_UNLOCKED
+   .lock = RAW_SPIN_LOCK_UNLOCKED(lock)
 };
 EXPORT_SYMBOL(rtas);
 
diff -rup linux-rt8/arch/powerpc/mm/hash_native_64.c 
rt/arch/powerpc/mm/hash_native_64.c
--- linux-rt8/arch/powerpc/mm/hash_native_64.c  2007-02-20 09:38:58.0 
+0900
+++ rt/arch/powerpc/mm/hash_native_64.c 2007-03-05 15:40:12.0 +0900
@@ -35,7 +35,7 @@
 
 #define HPTE_LOCK_BIT 3
 
-static DEFINE_SPINLOCK(native_tlbie_lock);
+static DEFINE_RAW_SPINLOCK(native_tlbie_lock);
 
 static inline void __tlbie(unsigned long va, unsigned int psize)
 {
--- linux-rt8/arch/powerpc/kernel/irq.c 2007-02-20 14:30:38.0 +0900
+++ rt/arch/powerpc/kernel/irq.c2007-03-05 18:54:34.0 +0900
@@ -392,7 +392,7 @@ EXPORT_SYMBOL(do_softirq);
 #ifdef CONFIG_PPC_MERGE
 
 static LIST_HEAD(irq_hosts);
-static spinlock_t irq_big_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_RAW_SPINLOCK(irq_big_lock);
 static DEFINE_PER_CPU(unsigned int, irq_radix_reader);
 static unsigned int irq_radix_writer;
 struct irq_map_entry irq_map[NR_IRQS];

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 3/6 -rt] powerpc 2.6.20-rt8: fix a runtime warning for smp_processor_id()

2007-03-06 Thread Tsutomu OWA

  To fix the following runtime warning.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
BUG: using smp_processor_id() in preemptible [] code: init/371
caller is .pgtable_free_tlb+0x2c/0x14c
Call Trace:
[CFF6B770] [C000FAAC] .show_stack+0x68/0x1b0 (unreliable)
[CFF6B810] [C01F7190] .debug_smp_processor_id+0xc8/0xf8
[CFF6B8A0] [C002C52C] .pgtable_free_tlb+0x2c/0x14c
[CFF6B940] [C00B6528] .free_pgd_range+0x234/0x3bc
[CFF6BA40] [C00B6AB8] .free_pgtables+0x224/0x260
[CFF6BB00] [C00B7FE8] .exit_mmap+0x100/0x208
[CFF6BBC0] [C0055FB0] .mmput+0x70/0x12c
[CFF6BC50] [C005B728] .exit_mm+0x150/0x170
[CFF6BCE0] [C005D80C] .do_exit+0x28c/0x9bc
[CFF6BDA0] [C005DFF0] .sys_exit_group+0x0/0x8
[CFF6BE30] [C0008634] syscall_exit+0x0/0x40
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

  Would it be better to just use raw_smp_processor_id() rather than tlb->cpu?

Signed-off-by: Tsutomu Owa <[EMAIL PROTECTED]>
-- owa

diff -rup linux-rt8/arch/powerpc/mm/tlb_64.c rt/arch/powerpc/mm/tlb_64.c
--- linux-rt8/arch/powerpc/mm/tlb_64.c  2007-02-20 14:30:38.0 +0900
+++ rt/arch/powerpc/mm/tlb_64.c 2007-03-05 13:31:24.0 +0900
@@ -94,8 +94,11 @@ static void pte_free_submit(struct pte_f
 
 void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf)
 {
-   /* This is safe since tlb_gather_mmu has disabled preemption */
-cpumask_t local_cpumask = cpumask_of_cpu(smp_processor_id());
+   /*
+* This is safe since tlb_gather_mmu has disabled preemption.
+* tlb->cpu is set by tlb_gather_mmu as well.
+*/
+cpumask_t local_cpumask = cpumask_of_cpu(tlb->cpu);
struct pte_freelist_batch **batchp = &__get_cpu_var(pte_freelist_cur);
 
if (atomic_read(&tlb->mm->mm_users) < 2 ||

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC] [patch 4/6 -rt] powerpc 2.6.20-rt8: fix a runtime warnings for xmon

2007-03-06 Thread Tsutomu OWA

  To fix the following runtime warnings when entering xmon.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Entering xmon
BUG: using smp_processor_id() in preemptible [] code: khvcd/280
caller is .xmon_core+0xb8/0x8ec
Call Trace:
[CFD737C0] [C000FAAC] .show_stack+0x68/0x1b0 (unreliable)
[CFD73860] [C01F71F0] .debug_smp_processor_id+0xc8/0xf8
[CFD738F0] [C004AF30] .xmon_core+0xb8/0x8ec
[CFD73A80] [C004B918] .xmon+0x38/0x4c
[CFD73C60] [C004BA8C] .sysrq_handle_xmon+0x48/0x5c
[CFD73CD0] [C0243A68] .__handle_sysrq+0xe0/0x1b0
[CFD73D70] [C0244974] .hvc_poll+0x18c/0x2b4
[CFD73E50] [C0244E80] .khvcd+0x88/0x164
[CFD73EE0] [C0075014] .kthread+0x124/0x174
[CFD73F90] [C0023D48] .kernel_thread+0x4c/0x68
BUG: khvcd:280 task might have lost a preemption check!
Call Trace:
[CFD73740] [C000FAAC] .show_stack+0x68/0x1b0 (unreliable)
[CFD737E0] [C0054920] .preempt_enable_no_resched+0x64/0x7c
[CFD73860] [C01F71F8] .debug_smp_processor_id+0xd0/0xf8
[CFD738F0] [C004AF30] .xmon_core+0xb8/0x8ec
[CFD73A80] [C004B918] .xmon+0x38/0x4c
[CFD73C60] [C004BA8C] .sysrq_handle_xmon+0x48/0x5c
[CFD73CD0] [C0243A68] .__handle_sysrq+0xe0/0x1b0
[CFD73D70] [C0244974] .hvc_poll+0x18c/0x2b4
[CFD73E50] [C0244E80] .khvcd+0x88/0x164
[CFD73EE0] [C0075014] .kthread+0x124/0x174
[CFD73F90] [C0023D48] .kernel_thread+0x4c/0x68
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

  I'd appreciate if experts on xmon would give any comments/suggestions
on this.  These warnings was just found yesterday, this patch seems to
eliminate the warnings but I have not looked into it seriously.

Signed-off-by: Tsutomu Owa <[EMAIL PROTECTED]>
-- owa

diff -rup linux-rt8/arch/powerpc/xmon/xmon.c rt/arch/powerpc/xmon/xmon.c
--- linux-rt8/arch/powerpc/xmon/xmon.c  2007-02-20 09:38:52.0 +0900
+++ rt/arch/powerpc/xmon/xmon.c 2007-03-05 15:29:46.0 +0900
@@ -342,6 +342,7 @@ static int xmon_core(struct pt_regs *reg
 
msr = mfmsr();
mtmsr(msr & ~MSR_EE);   /* disable interrupts */
+   preempt_disable();
 
bp = in_breakpoint_table(regs->nip, &offset);
if (bp != NULL) {
@@ -516,6 +517,7 @@ static int xmon_core(struct pt_regs *reg
 
insert_cpu_bpts();
 
+   preempt_enable();
mtmsr(msr); /* restore interrupt enable */
 
return cmd != 'X' && cmd != EOF;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC] [patch 5/6] powerpc 2.6.20-rt8: fix a boot error for handle_percpu_irq

2007-03-06 Thread Tsutomu OWA

  To fix the following boot time error by removing ack member added by
the rt patch.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processor 1 found.
Brought up 2 CPUs
[ cut here ]
kernel BUG at arch/powerpc/platforms/cell/interrupt.c:86!
pu 0x1: Vector: 700 (Program Check) at [cfff3c80]
pc: c0033f9c: .iic_eoi+0x58/0x64
lr: c009add8: .handle_percpu_irq+0xd4/0xf4
sp: cfff3f00
   msr: 90021032
  current = 0xc0fee040
  paca= 0xc0509e80
pid   = 0, comm = swapper
kernel BUG at arch/powerpc/platforms/cell/interrupt.c:86!
enter ? for help
[link register   ] c009add8 .handle_percpu_irq+0xd4/0xf4
[cfff3f00] c009ada8 .handle_percpu_irq+0xa4/0xf4 (unreliable)
[cfff3f90] c0023bb8 .call_handle_irq+0x1c/0x2c
[c0ff7950] c000c910 .do_IRQ+0xf8/0x1b8
[c0ff79f0] c0034f34 .cbe_system_reset_exception+0x74/0xb4
[c0ff7a70] c0022610 .system_reset_exception+0x40/0xe0
[c0ff7af0] c0003378 system_reset_common+0xf8/0x100
--- Exception: 100 (System Reset) at c0035008 .cbe_power_save+0x94/0xb0
[c0ff7e70] c0012030 .cpu_idle+0xc8/0x144
[c0ff7f00] c0026894 .start_secondary+0x150/0x174
[c0ff7f90] c0008364 .start_secondary_prolog+0xc/0x10
1:mon>

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  I found a pile of e-mail started by Sergei Shtylyov on linuxppc-dev regarding 
this.
Subject: [PATCH] 2.6.18-rt7: PowerPC: fix breakage in threaded fasteoi type 
IRQ handlers
From: Sergei Shtylyov <[EMAIL PROTECTED]>
Date: Sun, 19 Nov 2006 22:43:34 +0300

  Though I don't quite get the conclusion, the code does not work at least
on celleb when handle_percpu_irq is applied.  Since the handle_percpu_irq calls
both .ask and .eoi and when ask is set to iic_eoi, then iic_eoi() is called 
twice
for one interrupt.  It hits BUG_ON(iic->eoi_ptr < 0)!

  Anthor workaround could be to add one more irq_chip structure for 
handle_percpu_irq
which does not have ack member...

  Any comments?

Signed-off-by: Tsutomu Owa <[EMAIL PROTECTED]>
-- owa

diff -rup linux-rt8/arch/powerpc/platforms/cell/interrupt.c 
rt/arch/powerpc/platforms/cell/interrupt.c
--- linux-rt8/arch/powerpc/platforms/cell/interrupt.c   2007-02-20 
14:30:38.0 +0900
+++ rt/arch/powerpc/platforms/cell/interrupt.c  2007-03-02 18:48:52.0 
+0900
@@ -90,7 +90,6 @@ static struct irq_chip iic_chip = {
.typename = " CELL-IIC ",
.mask = iic_mask,
.unmask = iic_unmask,
-   .ack = iic_eoi,
.eoi = iic_eoi,
 };
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 6/6 -rt] powerpc 2.6.20-rt8: fix boot/runtime errors/warnings

2007-03-06 Thread Tsutomu OWA

  To fix the following boot time warnings by setting soft_enabled and
hard_enabled.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Freeing unused kernel memory: 248k freed
BUG: scheduling with irqs disabled: rc.sysinit/0x/373
caller is user_work+0x14/0x2c
Call Trace:
[C0001FEC3D10] [C000FAA0] .show_stack+0x68/0x1b0 (unreliable)
[C0001FEC3DB0] [C03E78DC] .schedule+0x78/0x128
[C0001FEC3E30] [C0008C40] user_work+0x14/0x2c
BUG: scheduling with irqs disabled: sed/0x/378
caller is user_work+0x14/0x2c
Call Trace:
[CFA33D10] [C000FAA0] .show_stack+0x68/0x1b0 (unreliable)
[CFA33DB0] [C03E78DC] .schedule+0x78/0x128
[CFA33E30] [C0008C40] user_work+0x14/0x2c

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Signed-off-by: Tsutomu Owa <[EMAIL PROTECTED]>
-- owa

--- rt/arch/powerpc/kernel/entry_64.S   2007-03-05 18:21:39.0 +0900
+++ rt.new/arch/powerpc/kernel/entry_64.S   2007-03-05 18:23:18.0 
+0900
@@ -572,6 +572,11 @@ do_work:
 
 user_work:
 #endif
+   /* here we are preempting the current task */
+   li  r0,1
+   stb r0,PACASOFTIRQEN(r13)
+   stb r0,PACAHARDIRQEN(r13)
+
/* Enable interrupts */
ori r10,r10,MSR_EE
mtmsrd  r10,1

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] [patch 4/6 -rt] powerpc 2.6.20-rt8: fix a runtime warnings for xmon

2007-03-07 Thread Tsutomu OWA

At Wed, 07 Mar 2007 11:10:59 +0100,
Benjamin Herrenschmidt wrote:
> 
> On Wed, 2007-03-07 at 10:16 +0100, Ingo Molnar wrote:
> > * Tsutomu OWA <[EMAIL PROTECTED]> wrote:
> > 
> > > @@ -342,6 +342,7 @@ static int xmon_core(struct pt_regs *reg
> > >  
> > >   msr = mfmsr();
> > >   mtmsr(msr & ~MSR_EE);   /* disable interrupts */
> > > + preempt_disable();
> > 
> > i'm not an xmon expert, but maybe it might make more sense to first 
> > disable preemption, then interrupts - otherwise you could be preempted 
> > right after having disabled these interrupts (and be scheduled to 
> > another CPU, etc.). What is the difference between local_irq_save() and 
> > the above 'disable interrupts' sequence? If it's not the same and 
> > xmon_core() relied on having hardirqs disabled then it might make sense 
> > to do a local_irq_save() there, instead of a preempt_disable().
> 
> powerpc 64 bits nowadays does lazy HW masking, so local_irq_disable()
> will not actually switch MSR_EE off. However, xmon needs that to happen
> (though we have a nicer accessor to do it, I suspect some bitrot need
> fixing in there, possibly already fixed in .21)
> 
> I agree that preempt_disable() should be put before the MSR tweaking
> though.

  As all of you said, I'm resending the patch here.  

  To fix the following runtime warnings when entering xmon.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Entering xmon
BUG: using smp_processor_id() in preemptible [] code: khvcd/280
caller is .xmon_core+0xb8/0x8ec
Call Trace:
[CFD737C0] [C000FAAC] .show_stack+0x68/0x1b0 (unreliable)
[CFD73860] [C01F71F0] .debug_smp_processor_id+0xc8/0xf8
[CFD738F0] [C004AF30] .xmon_core+0xb8/0x8ec
[CFD73A80] [C004B918] .xmon+0x38/0x4c
[CFD73C60] [C004BA8C] .sysrq_handle_xmon+0x48/0x5c
[CFD73CD0] [C0243A68] .__handle_sysrq+0xe0/0x1b0
[CFD73D70] [C0244974] .hvc_poll+0x18c/0x2b4
[CFD73E50] [C0244E80] .khvcd+0x88/0x164
[CFD73EE0] [C0075014] .kthread+0x124/0x174
[CFD73F90] [C0023D48] .kernel_thread+0x4c/0x68
BUG: khvcd:280 task might have lost a preemption check!
Call Trace:
[CFD73740] [C000FAAC] .show_stack+0x68/0x1b0 (unreliable)
[CFD737E0] [C0054920] .preempt_enable_no_resched+0x64/0x7c
[CFD73860] [C01F71F8] .debug_smp_processor_id+0xd0/0xf8
[CFD738F0] [C004AF30] .xmon_core+0xb8/0x8ec
[CFD73A80] [C004B918] .xmon+0x38/0x4c
[CFD73C60] [C004BA8C] .sysrq_handle_xmon+0x48/0x5c
[CFD73CD0] [C0243A68] .__handle_sysrq+0xe0/0x1b0
[CFD73D70] [C0244974] .hvc_poll+0x18c/0x2b4
[CFD73E50] [C0244E80] .khvcd+0x88/0x164
[CFD73EE0] [C0075014] .kthread+0x124/0x174
[C00000000FD73F90] [C0023D48] .kernel_thread+0x4c/0x68
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

thanks a lot!

Signed-off-by: Tsutomu Owa <[EMAIL PROTECTED]>
-- owa

--- linux-rt8/arch/powerpc/xmon/xmon.c  2007-02-20 09:38:52.0 +0900
+++ rt/arch/powerpc/xmon/xmon.c 2007-03-07 19:49:38.0 +0900
@@ -340,6 +340,7 @@ static int xmon_core(struct pt_regs *reg
unsigned long timeout;
 #endif
 
+   preempt_disable();
msr = mfmsr();
mtmsr(msr & ~MSR_EE);   /* disable interrupts */
 
@@ -517,6 +518,7 @@ static int xmon_core(struct pt_regs *reg
insert_cpu_bpts();
 
mtmsr(msr); /* restore interrupt enable */
+   preempt_enable();
 
return cmd != 'X' && cmd != EOF;
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 0/6 -rt] powerpc 2.6.20-rt8: fix boot/runtime errors/warnings for PowerPC(ppc64)

2007-03-07 Thread Tsutomu OWA

At Wed, 07 Mar 2007 17:26:50 +0300,
Sergei Shtylyov wrote:
> 
> Tsutomu OWA wrote:

> >   CONFIG_MCOUNT, CONFIG_LATENCY_TRACE and other tracing options nor
> > CONFIG_GENERIC_TIME,
> 
> There is PowerPC genTOD patch and it's incorporated into -rt (don't know 
> it works for Cell) but it breaks TOD vsyscalls. Several months ago I've 
> posted 
> patches removing them for the time being:

> > clockevents etc are not yet ported.
> 
> Note that there *is* PowerPC clockevents driver already (don't know if it 
> works for Cell) -- it just never got merged to -rt:

  I should have written like "... are not yet ported by myself."

  anyway, thanks for the info.
-- owa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/