You know, there should be a plugin for evolution that scans for the word
"attachment" in all languages and then yells at you if you forget. ;-)

Phil

On Thu, 2006-10-12 at 02:34 -0700, Stephane Eranian wrote:
> Phil,
> 
> you forgot the attachement!
> 
> On Thu, Oct 12, 2006 at 11:25:37AM +0200, Philip J. Mucci wrote:
> > Hello,
> > 
> > Attached is a patch against the latest MIPS patches. This patch adds:
> > - Support for counters 2 and 3 (like the broadcom)
> > - More careful masking of overflow counters (in case there is special
> > hardware)
> > - smp_call_function_single (missing in the MIPS tree)
> > 
> > Phil
> > 
> > P.S. Props to Marc Mason at Broadcom for spotting these errors.
> > 
> > _______________________________________________
> > perfmon mailing list
> > [email protected]
> > http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/
> 
Index: include/asm-mips/smp.h
===================================================================
--- include/asm-mips/smp.h	(revision 26254)
+++ include/asm-mips/smp.h	(working copy)
@@ -104,6 +104,8 @@
 	core_send_ipi(cpu, SMP_RESCHEDULE_YOURSELF);
 }
 
+extern int smp_call_function_single(int cpuid, void (*func) (void *info),
+				void *info, int retry, int wait);
 extern asmlinkage void smp_call_function_interrupt(void);
 
 #endif /* CONFIG_SMP */
Index: include/asm-mips/perfmon.h
===================================================================
--- include/asm-mips/perfmon.h	(revision 26254)
+++ include/asm-mips/perfmon.h	(working copy)
@@ -106,6 +106,12 @@
   case 1:
     write_c0_perfctrl1(value);
     break;
+  case 2:
+    write_c0_perfctrl2(value);
+    break;
+  case 3:
+    write_c0_perfctrl3(value);
+    break;
   default:
     BUG();
   }
@@ -123,6 +129,12 @@
   case 1:
     write_c0_perfcntr1(value);
     break;
+  case 2:
+    write_c0_perfcntr2(value);
+    break;
+  case 3:
+    write_c0_perfcntr3(value);
+    break;
   default:
     BUG();
   }
@@ -137,6 +149,12 @@
 	case 1:
 	  	return read_c0_perfcntr1();
 		break;
+	case 2:
+	  	return read_c0_perfcntr2();
+		break;
+	case 3:
+	  	return read_c0_perfcntr3();
+		break;
 	default:
 		BUG();
 		return 0;
@@ -152,6 +170,12 @@
 	case 1:
 		return read_c0_perfctrl1();
 		break;
+	case 2:
+		return read_c0_perfctrl2();
+		break;
+	case 3:
+		return read_c0_perfctrl3();
+		break;
 	default:
 		BUG();
 		return 0;
Index: arch/mips/kernel/smp.c
===================================================================
--- arch/mips/kernel/smp.c	(revision 26254)
+++ arch/mips/kernel/smp.c	(working copy)
@@ -209,6 +209,52 @@
 	}
 }
 
+int smp_call_function_single (int cpu, void (*func) (void *info), void *info, int retry,
+			      int wait)
+{
+  struct call_data_struct data;
+  int me = smp_processor_id();
+
+  /*
+     * Can die spectacularly if this CPU isn't yet marked online
+      */
+  BUG_ON(!cpu_online(me));
+  if (cpu == me) {
+    WARN_ON(1);
+    return -EBUSY;
+    }
+
+  /* Can deadlock when called with interrupts disabled */
+  WARN_ON(irqs_disabled());
+
+  data.func = func;
+  data.info = info;
+  atomic_set(&data.started, 0);
+  data.wait = wait;
+  if (wait)
+    atomic_set(&data.finished, 0);
+
+  spin_lock(&smp_call_lock);
+  call_data = &data;
+  mb();
+
+  /* Send a message to the other CPU */
+  core_send_ipi(cpu, SMP_CALL_FUNCTION);
+
+  /* Wait for response */
+  /* FIXME: lock-up detection, backtrace on lock-up */
+  while (atomic_read(&data.started) != 1)
+    barrier();
+
+  if (wait)
+    while (atomic_read(&data.finished) != 1)
+      barrier();
+  call_data = NULL;
+  spin_unlock(&smp_call_lock);
+
+  return 0;
+}
+
 static void stop_this_cpu(void *dummy)
 {
 	/*
Index: arch/mips/perfmon/perfmon.c
===================================================================
--- arch/mips/perfmon/perfmon.c	(revision 26254)
+++ arch/mips/perfmon/perfmon.c	(working copy)
@@ -34,16 +34,19 @@
 static void __pfm_get_ovfl_pmds(struct pfm_context *ctx, struct pfm_event_set *set)
 {
  	u64 new_val, wmask;
-	u64 *used_mask;
+	u64 *used_mask, *cnt_pmds;
+	u64 mask[PFM_PMD_BV];
 	unsigned int i, max;
 
 	max = pfm_pmu_conf->max_cnt_pmd;
+	cnt_pmds = pfm_pmu_conf->cnt_pmds;
 	used_mask = set->used_pmds;
 	wmask = PFM_ONE_64 << pfm_pmu_conf->counter_width;
-
+	bitmap_and(mask,cnt_pmds,used_mask,max);
+	
 	for (i = 0; i < max; i++) {
 		/* assume all PMD are counters */
-		if (pfm_bv_isset(used_mask, i)) {
+		if (pfm_bv_isset(mask, i)) {
 			new_val = pfm_arch_read_pmd(ctx, i);
 
  			PFM_DBG_ovfl("pmd%u new_val=0x%llx bit=%d\n",
_______________________________________________
perfmon mailing list
[email protected]
http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/

Reply via email to