
From: Philippe Elie <phil.el@wanadoo.fr>

> I often see this.  It seems to only profile one of the CPUs:

you're right actually it use the same counter for each cpu.  The second
counter setup overwrite the first...

btw patch contains also an unrelated cleanup but sufficiently trivial to go
in the same step.



 25-akpm/arch/i386/oprofile/op_model_p4.c |    4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)

diff -puN arch/i386/oprofile/op_model_p4.c~p4-oprofile-fix arch/i386/oprofile/op_model_p4.c
--- 25/arch/i386/oprofile/op_model_p4.c~p4-oprofile-fix	Tue Apr  8 17:09:54 2003
+++ 25-akpm/arch/i386/oprofile/op_model_p4.c	Tue Apr  8 17:09:54 2003
@@ -456,7 +456,7 @@ static void pmc_setup_one_p4_counter(uns
 	stag = get_stagger();
 	
 	/* convert from counter *number* to counter *bit* */
-	counter_bit = 1 << ctr;
+	counter_bit = 1 << VIRT_CTR(stag, ctr);
 	
 	/* find our event binding structure. */
 	if (counter_config[ctr].event <= 0 || counter_config[ctr].event > NUM_EVENTS) {
@@ -606,8 +606,6 @@ static int p4_check_ctrs(unsigned int co
 			CCCR_CLEAR_OVF(low);
 			CCCR_WRITE(low, high, real);
  			CTR_WRITE(reset_value[i], real);
-			/* P4 quirk: you have to re-unmask the apic vector */
-			apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED);
 		}
 	}
 

_
