]> git.hungrycats.org Git - linux/commitdiff
[OPROF] Fix arguments to oprofile_add_sample.
authorRichard Henderson <rth@dorothy.sfbay.redhat.com>
Tue, 18 Feb 2003 11:05:42 +0000 (03:05 -0800)
committerRichard Henderson <rth@dorothy.sfbay.redhat.com>
Tue, 18 Feb 2003 11:05:42 +0000 (03:05 -0800)
arch/alpha/oprofile/op_model_ev4.c
arch/alpha/oprofile/op_model_ev5.c
arch/alpha/oprofile/op_model_ev6.c
arch/alpha/oprofile/op_model_ev67.c

index 088cb336cc350a0396fa90833df3d2304fc96971..a817e4db9ee9a83d5bf972a07db3bbf26df26738 100644 (file)
@@ -101,7 +101,8 @@ ev4_handle_interrupt(unsigned long which, struct pt_regs *regs,
                return;
 
        /* Record the sample.  */
-       oprofile_add_sample(regs->pc, which, smp_processor_id());
+       oprofile_add_sample(regs->pc, !user_mode(regs),
+                           which, smp_processor_id());
 }
 
 
index 39e108fe2a030a64f72ce21ba1cff898617b118b..05b7470ba71f655bc35777a16cb79cc1d8619323 100644 (file)
@@ -186,7 +186,8 @@ ev5_handle_interrupt(unsigned long which, struct pt_regs *regs,
                     struct op_counter_config *ctr)
 {
        /* Record the sample.  */
-       oprofile_add_sample(regs->pc, which, smp_processor_id());
+       oprofile_add_sample(regs->pc, !user_mode(regs),
+                           which, smp_processor_id());
 }
 
 
@@ -195,7 +196,7 @@ struct op_axp_model op_model_ev5 = {
        .cpu_setup              = ev5_cpu_setup,
        .reset_ctr              = ev5_reset_ctr,
        .handle_interrupt       = ev5_handle_interrupt,
-       .cpu                    = "alpha/ev5",
+       .cpu_type               = "alpha/ev5",
        .num_counters           = 3,
        .can_set_proc_mode      = 1,
 };
@@ -205,7 +206,7 @@ struct op_axp_model op_model_pca56 = {
        .cpu_setup              = ev5_cpu_setup,
        .reset_ctr              = ev5_reset_ctr,
        .handle_interrupt       = ev5_handle_interrupt,
-       .cpu                    = "alpha/pca56",
+       .cpu_type               = "alpha/pca56",
        .num_counters           = 3,
        .can_set_proc_mode      = 1,
 };
index e84f395b7ba0c20e864d19a2b4cc090fa47f77b5..5ae6b5a308d817906b84f09728497eaa3f2eb258 100644 (file)
@@ -88,7 +88,8 @@ ev6_handle_interrupt(unsigned long which, struct pt_regs *regs,
                     struct op_counter_config *ctr)
 {
        /* Record the sample.  */
-       oprofile_add_sample(regs->pc, which, smp_processor_id());
+       oprofile_add_sample(regs->pc, !user_mode(regs),
+                           which, smp_processor_id());
 }
 
 
@@ -97,7 +98,7 @@ struct op_axp_model op_model_ev6 = {
        .cpu_setup              = ev6_cpu_setup,
        .reset_ctr              = ev6_reset_ctr,
        .handle_interrupt       = ev6_handle_interrupt,
-       .cpu                    = "alpha/ev6",
+       .cpu_type               = "alpha/ev6",
        .num_counters           = 2,
        .can_set_proc_mode      = 0,
 };
index 27b73ae38fba8ae045e28c27798436183b2b070f..aaaef8687547792034c2b4849314dcf9f3cab9ba 100644 (file)
@@ -130,15 +130,16 @@ enum profileme_counters {
        PM_NUM_COUNTERS
 };
 
-static void
-op_add_pm(unsigned long pc, unsigned long counter,
+static inline void
+op_add_pm(unsigned long pc, int kern, unsigned long counter,
          struct op_counter_config *ctr, unsigned long event)
 {
        unsigned long fake_counter = 2 + event;
        if (counter == 1)
                fake_counter += PM_NUM_COUNTERS;
        if (ctr[fake_counter].enabled)
-               oprofile_add_sample(pc, fake_counter, smp_processor_id());
+               oprofile_add_sample(pc, kern, fake_counter,
+                                   smp_processor_id());
 }
 
 static void
@@ -146,6 +147,7 @@ ev67_handle_interrupt(unsigned long which, struct pt_regs *regs,
                      struct op_counter_config *ctr)
 {
        unsigned long pmpc, pctr_ctl;
+       int kern = !user_mode(regs);
        int mispredict = 0;
        union {
                unsigned long v;
@@ -195,27 +197,27 @@ ev67_handle_interrupt(unsigned long which, struct pt_regs *regs,
                           to PALcode. Recognize ITB miss by PALcode
                           offset address, and get actual PC from
                           EXC_ADDR.  */
-                       oprofile_add_sample(regs->pc, which,
+                       oprofile_add_sample(regs->pc, kern, which,
                                            smp_processor_id());
                        if ((pmpc & ((1 << 15) - 1)) ==  581)
-                               op_add_pm(regs->pc, which, ctr, PM_ITB_MISS);
+                               op_add_pm(regs->pc, kern, which,
+                                         ctr, PM_ITB_MISS);
                        /* Most other bit and counter values will be
                           those for the first instruction in the
                           fault handler, so we're done.  */
                        return;
                case TRAP_REPLAY:
-                       if (i_stat.fields.load_store)
-                               op_add_pm(pmpc, which, ctr, PM_LOAD_STORE);
-                       else
-                               op_add_pm(pmpc, which, ctr, PM_REPLAY);
+                       op_add_pm(pmpc, kern, which, ctr,
+                                 (i_stat.fields.load_store
+                                  ? PM_LOAD_STORE : PM_REPLAY));
                        break;
                case TRAP_DTB_DOUBLE_MISS_3:
                case TRAP_DTB_DOUBLE_MISS_4:
                case TRAP_DTB_SINGLE_MISS:
-                       op_add_pm(pmpc, which, ctr, PM_DTB_MISS);
+                       op_add_pm(pmpc, kern, which, ctr, PM_DTB_MISS);
                        break;
                case TRAP_UNALIGNED:
-                       op_add_pm(pmpc, which, ctr, PM_UNALIGNED);
+                       op_add_pm(pmpc, kern, which, ctr, PM_UNALIGNED);
                        break;
                case TRAP_INVALID0:
                case TRAP_FP_DISABLED:
@@ -235,21 +237,21 @@ ev67_handle_interrupt(unsigned long which, struct pt_regs *regs,
                   set.  */
                if (i_stat.fields.mispredict) {
                        mispredict = 1;
-                       op_add_pm(pmpc, which, ctr, PM_MISPREDICT);
+                       op_add_pm(pmpc, kern, which, ctr, PM_MISPREDICT);
                }
        }
 
-       oprofile_add_sample(pmpc, which, smp_processor_id());
+       oprofile_add_sample(pmpc, kern, which, smp_processor_id());
 
        pctr_ctl = wrperfmon(5, 0);
        if (pctr_ctl & (1UL << 27))
-               op_add_pm(pmpc, which, ctr, PM_STALLED);
+               op_add_pm(pmpc, kern, which, ctr, PM_STALLED);
 
        /* Unfortunately, TAK is undefined on mispredicted branches.
           ??? It is also undefined for non-cbranch insns, should
           check that.  */
        if (!mispredict && pctr_ctl & (1UL << 0))
-               op_add_pm(pmpc, which, ctr, PM_TAKEN);
+               op_add_pm(pmpc, kern, which, ctr, PM_TAKEN);
 }
 
 struct op_axp_model op_model_ev67 = {
@@ -257,7 +259,7 @@ struct op_axp_model op_model_ev67 = {
        .cpu_setup              = ev67_cpu_setup,
        .reset_ctr              = ev67_reset_ctr,
        .handle_interrupt       = ev67_handle_interrupt,
-       .cpu                    = "alpha/ev67",
+       .cpu_type               = "alpha/ev67",
        .num_counters           = 20,
        .can_set_proc_mode      = 0,
 };