Hi Stephane,

Here is the spin lock fix for POWER which back ports your change to use the new pfm_spin_lock and pfm_spin_unlock macros.

Please let me know if you have any problems with it.

The change to include/asm-powerpc/perfmon.h should be forward ported to the current git tree. Do you want a separate patch for that?

Regards,

- Corey

--
Corey Ashford
Software Engineer
IBM Linux Technology Center, Linux Toolchain
Beaverton, OR
503-578-3507
[EMAIL PROTECTED]
--- perfmon/perfmon_intr.c      2008-04-15 15:22:27.000000000 -0500
+++ 
/home/corey/linux-2.6.24+perfmon2+uprobes/linux-2.6.24/perfmon/perfmon_intr.c   
    2008-04-14 17:06:40.000000000 -0500
@@ -499,6 +499,7 @@ static void __pfm_interrupt_handler(unsi
        struct task_struct *task;
        struct pfm_context *ctx;
        struct pfm_event_set *set;
+       unsigned long flags __attribute__((unused)) = 0;
 
        pfm_stats_inc(ovfl_intr_all_count);
 
@@ -510,7 +511,7 @@ static void __pfm_interrupt_handler(unsi
                goto spurious;
        }
 
-       spin_lock(&ctx->lock);
+       pfm_spin_lock(&ctx->lock, flags);
 
        set = ctx->active_set;
 
@@ -560,7 +561,7 @@ static void __pfm_interrupt_handler(unsi
 
        pfm_arch_intr_unfreeze_pmu(ctx);
 
-       spin_unlock(&ctx->lock);
+       pfm_spin_unlock(&ctx->lock, flags);
 
        return;
 
@@ -568,7 +569,7 @@ spurious:
        /* ctx may be NULL */
        pfm_arch_intr_unfreeze_pmu(ctx);
        if (ctx)
-               spin_unlock(&ctx->lock);
+               pfm_spin_unlock(&ctx->lock, flags);
 
        pfm_stats_inc(ovfl_intr_spurious_count);
 }
--- perfmon/perfmon_ctxsw.c     2008-04-15 15:22:27.000000000 -0500
+++ 
/home/corey/linux-2.6.24+perfmon2+uprobes/linux-2.6.24/perfmon/perfmon_ctxsw.c  
    2008-04-14 16:59:59.000000000 -0500
@@ -95,6 +95,7 @@ static void __pfm_ctxswin_thread(struct 
        struct pfm_event_set *set;
        int reload_pmcs, reload_pmds;
        int mycpu, is_active;
+       unsigned long flags __attribute__((unused));
 
        mycpu = smp_processor_id();
 
@@ -103,7 +104,7 @@ static void __pfm_ctxswin_thread(struct 
         * we need to lock context because it could be accessed
         * from another CPU
         */
-       spin_lock(&ctx->lock);
+       pfm_spin_lock(&ctx->lock, flags);
 
        is_active = pfm_arch_is_active(ctx);
 
@@ -119,7 +120,7 @@ static void __pfm_ctxswin_thread(struct 
        if (unlikely(ctx->state == PFM_CTX_ZOMBIE)) {
                ctx->flags.work_type = PFM_WORK_ZOMBIE;
                set_tsk_thread_flag(task, TIF_PERFMON_WORK);
-               spin_unlock(&ctx->lock);
+               pfm_spin_unlock(&ctx->lock, flags);
                return;
        }
 
@@ -211,7 +212,7 @@ static void __pfm_ctxswin_thread(struct 
                                hrtimer_start(h, set->hrtimer_rem, 
HRTIMER_MODE_REL);
                }
        }
-       spin_unlock(&ctx->lock);
+       pfm_spin_unlock(&ctx->lock, flags);
 }
 
 /*
@@ -225,12 +226,13 @@ static void __pfm_ctxswout_thread(struct
 {
        struct pfm_event_set *set;
        int need_save_pmds, is_active;
+       unsigned long flags __attribute__((unused));
 
        /*
         * we need to lock context because it could be accessed
         * from another CPU
         */
-       spin_lock(&ctx->lock);
+       pfm_spin_lock(&ctx->lock, flags);
 
        is_active = pfm_arch_is_active(ctx);
        set = ctx->active_set;
@@ -280,7 +282,7 @@ static void __pfm_ctxswout_thread(struct
        if (need_save_pmds)
                pfm_save_pmds(ctx, set);
 #endif
-       spin_unlock(&ctx->lock);
+       pfm_spin_unlock(&ctx->lock, flags);
 }
 
 /*
--- include/asm-powerpc/perfmon.h       2008-04-15 15:22:27.000000000 -0500
+++ 
/home/corey/linux-2.6.24+perfmon2+uprobes/linux-2.6.24/include/asm-powerpc/perfmon.h
        2008-04-14 17:03:38.000000000 -0500
@@ -72,6 +72,11 @@
                spin_lock(l); \
        } while(0)
 
+#undef pfm_spin_lock
+#define pfm_spin_lock(l, f) pfm_spin_lock_irqsave(l, f)
+#undef pfm_spin_unlock
+#define pfm_spin_unlock(l, f) pfm_spin_unlock_irqrestore(l, f)
+
 enum powerpc_pmu_type {
        PFM_POWERPC_PMU_NONE,
        PFM_POWERPC_PMU_604,
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
perfmon2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to