Subject: re: PMC Counter are not supported
To: Pavel Cahyna <pavel.cahyna@st.mff.cuni.cz>
From: Stephan Thesing <thesing@cs.uni-sb.de>
List: tech-kern
Date: 07/10/2005 10:15:44
Hello,

On Sun, 10 Jul 2005, Pavel Cahyna wrote:

> Date: Sun, 10 Jul 2005 01:40:31 +0200
> From: Pavel Cahyna <pavel.cahyna@st.mff.cuni.cz>
> To: matthew green <mrg@eterna.com.au>, tech-kern@NetBSD.org
> Subject: re: PMC Counter are not supported
> 
> On Sun, 10 Jul 2005 07:00:13 +1000, matthew green wrote:
>
>> pmc(4) is only supported on some machines.  non-SMP pentium3 systems
>> only, last i checked.
>
> Not true, on 2.0 pmc(4) is completely unsupported, see PR port-i386/26437.

though I don't have a 2.0 machine with something <Pentium 4 accessible right 
now, at least from sys/arch/i386/i386/pmc.c on 2.0 this doesn't seem to be 
true.
In fact, pmc works on a Pentium II with 1.6.x.  I don't see, why it shouldn't 
work on 2.0 on that CPUs (if enabled in the kernel) (Athlon is not supported in 
1.6 if I read the code right).

On Pentium 4 it does not work, as the performance counter architecture is 
completly different from those on Pentium II, III, Athlon.
In fact, on Pentium 4, the old code crashed the machine as soon as you used 
pmc(1) to count something.  That has been fixed in 3.0 and -current but doesn't 
seem to have been pulled up to 2.x (revision 1.7 of pmc.c, cf port-i386/25014).

To make it work on Pentium 4, somebody has to invest some work to adapt the 
internal API, which ATM only supports a number of counters that are each 
configured by some special purpose registers for counting.  Pentium 4s need an 
extension, as they (I think, have to look it up...) use a double indexed scheme 
to configure the counting.

Best regards....
 	Stephan

=  Tel.: +49-681-302-5571      = Universitaet des Saarlandes =
=  Fax.: +49-681-302-3065      = Postfach 15 11 50           =
=  Compiler Research Group     = 66041 Saarbruecken          =
=  FR 6.2 - Informatik         = GERMANY                     =