Re: [PATCH][3/7] perfctr-2.7.2 for 2.6.6-mm2: x86_64

From: Andi Kleen
Date: Sat May 15 2004 - 14:18:51 EST


On Sat, May 15, 2004 at 04:42:46PM +0200, Mikael Pettersson wrote:
> Computing the mapping in the kernel would need lots of code, unless
> it cheats like oprofile does on the P4 and hides most counters.
> Neither hiding counters nor computing imperfect mappings is acceptable.

So how do you get oprofile and the perfctr based NMI watchdog
to cooperate? IMHO just silently breaking each other is not a good idea,
and clearly the kernel users cannot depend on user space management.

Also how does the user space management with multiple processes when
the virtual counters are disabled?

If you think doing it for individual registers is too complicated
how about a global lock? - Each application could reserve the full
perfctr bank.

This would require disabling the non IO-APIC NMI watchdog completely
when any other users are active, but that is probably tolerable.

> >+ if( perfctr_cstatus_has_tsc(cstatus) )
> >+ rdtscl(ctrs->tsc);
> >+ nrctrs = perfctr_cstatus_nractrs(cstatus);
> >+ for(i = 0; i < nrctrs; ++i) {
> >+ unsigned int pmc = state->pmc[i].map;
> >+ rdpmc_low(pmc, ctrs->pmc[i]);
> >+ }
> >
> >K8 has speculative rdtsc. Most likely you want a sync_core() somewhere
> >in there.
>
> What's the cost for sync_core()? The counts don't have to be
> perfect.

It's a CPUID to force a pipeline flush. Let's say 20-30 cycles.

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/