Re: [PATCH][3/7] perfctr-2.7.2 for 2.6.6-mm2: x86_64
From: John Reiser
Date: Sat May 15 2004 - 15:42:31 EST
+ 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.
I want the kernel to avoid every delay that can be avoided. Do not force
a pipeline flush for speculative rdtsc. Besides those 20-30 cycles
there is register eviction for %eax, %ecx, %edx and save+restore for %ebx
(CPUID scribbles on 4 registers), plus possible branch misprediction if control
is not fall-through sequential. Also, that kernel code probably is already
several dozen cycles after the most recent user-mode instruction
(the only thing that the user can control), so waiting for quiescent
pipeline is just the kernel lollygagging on itself. Get to work!
--
John Reiser, jreiser@xxxxxxxxxxxx
-
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/