Subject: Re: PMC Counter are not supported
To: Stephan Thesing <thesing@cs.uni-sb.de>
From: Quentin Garnier <cube@cubidou.net>
List: tech-kern
Date: 07/10/2005 23:37:10
--zS7rBR6csb6tI2e1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Jul 10, 2005 at 09:32:13PM +0200, Stephan Thesing wrote:
[...]
> Unfortunately, on i386, the interface is via the=20
> i386_pmc_{info,startstop,read} syscalls.  The argument passed to=20
> i386_pmc_startstop to (surprise) start/stop a counter is a struct=20
> i386_pmc_startstop_args with
>  int       counter;   /* # counter  */
>  u_int64_t val;       /* of counter */
>  u_int8_t  event;
>  u_int8_t  unit;      /* event/subevent */
>  u_int8_t  compare;   /* threshold for counting */
>  u_int8_t  flags;     /* USER, KERNEL, EDGE, etc */
>=20
> So there seems to be no space left for specifying the ESCR#, which would =
be=20
> needed for Pentium 4.
>=20
> To solve this, there are three possibilities (at least:-)
>  1) misuse space in the 64bit `val' member for ESCR#, which has only 40bi=
t=20
>  used
>     in reality
>  2) The Pentium 4 system programming manual defines around 30 event types
>      in total (plus subtypes)
>     Define a map in the pmc system code that maps the 30 event numbers to
>      the necessary ESCR, ECCR settings.  Which would be a little bit=20
>      cumbersome
>      as more bookkeeping about HW counters in use must be kept.
>  3) Add a new member to the i386_pmc_startstop syscall arg...

Without actually looking at the stuff, one remark:  you shouldn't
consider the current interface on i386.  What you should look at is
whether the pmc_control/pmc_get_info API can handle that.

The current i386 pmc API should be obsoleted, and certainly not
extended in any way.

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"When I find the controls, I'll go where I like, I'll know where I want
to be, but maybe for now I'll stay right here on a silent sea."
KT Tunstall, Silent Sea, Eye to the Telescope, 2004.

--zS7rBR6csb6tI2e1
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iQEVAwUBQtGVBtgoQloHrPnoAQLnOwf7B+25tu38tc4XaxOqNrTLGI1YfOXw8TQ5
TdUX9K0v+Q75+kgoGfmJE/Zk5ZHyQiJ8il/t3Urp+OHGDiePSoO3Ey1PUWkaqdZ+
Ji6B2mMOpEENnh/KqeaPnN9dHDhGBTKsplY5oMwl5pn7gMEqiJqcGf9zCDNmgYH9
6MSiash5FGPzbbv/bFD2+mXSzMSxuM/d3uVC22u8AQQf3pRs3TnFzL6td8C5ZG5q
BqdLNRFbgbbj6MHhT5iIIVPij0GeZJ5RPX3oNmA/wMMFj7VKGZYcN2Wib/vjfT5M
odpGjfJM5EN6WAqJ3mYQfECey3fs4Bx2sitjQVj5DeYzXJdMip/Yag==
=RPM+
-----END PGP SIGNATURE-----

--zS7rBR6csb6tI2e1--