Kevin,

On Mon, Mar 26, 2007 at 08:57:31PM -0500, Kevin Corry wrote:
> 
> On Fri March 23 2007 1:47 pm, Stephane Eranian wrote:
> > > 3) In your announcement in February of the latest Perfmon kernel patches
> > > you noted that the code will not currently build on powerpc due to the
> > > new TIF flags in inclue/asm-*/thread_info.h. Has this issue been solved
> > > yet? I don't personally know much about powerpc assembly (I tried hacking
> > > around on that section of code a bit, but had no luck), but I can almost
> > > certainly track down some people here at IBM to help if we still need to
> > > find a fix.
> >
> > As for the compilation problem, thanks to Phil it is now fixed and the
> > modification will be released in my next patch.
> 
> Would you be able to post that one patch to the mailing list? For the time 
> being, I've simply reverted the new TIF flags that were added by perfmon to 
> include/asm/thread_info.h in order to get things compiling. But I'm not sure 
> what problems that would cause if I start doing any testing.
> 

Here is the patch relative to 2.6.21-rc5, but should work with older
versions as well. Perfmon will not operate properly, especially in 
per-thread mode, without this patch.

Thanks.
-- 

-Stephane
diff -urNp linux-2.6.21-rc5.orig/arch/powerpc/kernel/entry_32.S 
linux-2.6.21-rc5/arch/powerpc/kernel/entry_32.S
--- linux-2.6.21-rc5.orig/arch/powerpc/kernel/entry_32.S        2007-02-04 
10:44:54.000000000 -0800
+++ linux-2.6.21-rc5/arch/powerpc/kernel/entry_32.S     2007-03-26 
00:25:29.000000000 -0800
@@ -38,11 +38,17 @@
  * MSR_KERNEL is > 0x10000 on 4xx/Book-E since it include MSR_CE.
  */
 #if MSR_KERNEL >= 0x10000
-#define LOAD_MSR_KERNEL(r, x)  lis r,(x)@h; ori r,r,(x)@l
+#define LOAD_MSR_KERNEL(r, x)  lis r,(x)@ha; ori r,r,(x)@l
 #else
 #define LOAD_MSR_KERNEL(r, x)  li r,(x)
 #endif
 
+#if 
(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK) 
>= 0x10000
+#define LOAD_TIF_KERNEL(r, x)  lis r,(x)@h; ori r,r,(x)@l
+#else
+#define LOAD_TIF_KERNEL(r, x)  ori r,r,(x)
+#endif
+
 #ifdef CONFIG_BOOKE
 #include "head_booke.h"
 #define TRANSFER_TO_HANDLER_EXC_LEVEL(exc_level)       \
@@ -229,7 +235,8 @@ ret_from_syscall:
        MTMSRD(r10)
        lwz     r9,TI_FLAGS(r12)
        li      r8,-_LAST_ERRNO
-       andi.   
r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK)
+       
LOAD_TIF_KERNEL(r7,_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK)
+       and     r0,r9,r7
        bne-    syscall_exit_work
        cmplw   0,r3,r8
        blt+    syscall_exit_cont
diff -urNp linux-2.6.21-rc5.orig/arch/powerpc/kernel/entry_64.S 
linux-2.6.21-rc5/arch/powerpc/kernel/entry_64.S
--- linux-2.6.21-rc5.orig/arch/powerpc/kernel/entry_64.S        2007-03-26 
00:17:47.000000000 -0800
+++ linux-2.6.21-rc5/arch/powerpc/kernel/entry_64.S     2007-03-26 
00:25:29.000000000 -0800
@@ -30,6 +30,12 @@
 #include <asm/firmware.h>
 #include <asm/bug.h>
 
+#if 
(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK) 
>= 0x10000
+#define LOAD_TIF_KERNEL(r, x)  lis r,(x)@h; ori r,r,(x)@l
+#else
+#define LOAD_TIF_KERNEL(r, x)  ori r,r,(x)
+#endif
+
 /*
  * System calls.
  */
@@ -162,7 +168,9 @@ syscall_exit:
        mtmsrd  r10,1
        ld      r9,TI_FLAGS(r12)
        li      r11,-_LAST_ERRNO
-       andi.   
r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK)
+       //lil   
r0,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK)
 
+       LOAD_TIF_KERNEL(r0, 
_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK)
+       andi.   r0,r9,r0
        bne-    syscall_exit_work
        cmpld   r3,r11
        ld      r5,_CCR(r1)
@@ -465,7 +473,8 @@ _GLOBAL(ret_from_except_lite)
        /* Check current_thread_info()->flags */
        clrrdi  r9,r1,THREAD_SHIFT
        ld      r4,TI_FLAGS(r9)
-       andi.   r0,r4,_TIF_USER_WORK_MASK
+       LOAD_TIF_KERNEL(r0, _TIF_USER_WORK_MASK)
+       and     r0,r4,r0
        bne     do_work
 #endif
 
@@ -588,6 +597,9 @@ user_work:
        b       .ret_from_except_lite
 
 1:     bl      .save_nvgprs
+#ifdef CONFIG_PERFMON
+       bl      .__pfm_handle_work
+#endif /* CONFIG_PERFMON */
        li      r3,0
        addi    r4,r1,STACK_FRAME_OVERHEAD
        bl      .do_signal
_______________________________________________
perfmon mailing list
[email protected]
http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/

Reply via email to