Ruslan Bukin
2017-11-08 06:31:09 UTC
Hi,
Here is patch enables Intel Processor Tracing (PT) support.
This is exciting new and first(?) hardware-level tracing support available for FreeBSD!
PT is supported on Intel 5th generation Core (Broadwell), 6th generation Core (Skylake) CPUs, and later.
I'm testing it currently on a late Kabylake. PT is evolving since its introduction in Broadwell CPU and I'm not sure if the features we use on Kabylake are available on Broeadwell (tracing to SG buffer for example).
I will try to support all of these CPUs but if someone can help testing it would be good. Providing the output of pt_enumerate() on your CPU may be helpful as well.
So with a minimal impact on system perfomance we can trace pretty much everything now.
I provided simple 'pmctrace' application that enables tracing and decodes tracing buffers. It supports function tracing.
Intel PT provides 25 types of packets, we currently decode few of them only.
Example usage:
1. Trace all the conditional branches for uname(1) application.
pmctrace -u pt,branches uname
2. Trace all the conditional branches in memset(3) function in libc.
pmctrace -u pt,branches -i libc.so.7 -f memset sleep 1
3. Trace all the conditional branches for copyin() and show timestamp (TSC -- amount of clock cycles since boot).
sudo pmctrace -s pt,branches,tsc -i kernel -f copyin
So I have added new counters modes for HWPMC:
MODE_ST - system tracing
MODE_TT - virtual thread tracing
We may look for ARM tracing technologies later as well.
It is on review here:
https://reviews.freebsd.org/D12875
It require libipt decoder from Intel as well:
https://reviews.freebsd.org/D12717
Thanks.
Ruslan
Here is patch enables Intel Processor Tracing (PT) support.
This is exciting new and first(?) hardware-level tracing support available for FreeBSD!
PT is supported on Intel 5th generation Core (Broadwell), 6th generation Core (Skylake) CPUs, and later.
I'm testing it currently on a late Kabylake. PT is evolving since its introduction in Broadwell CPU and I'm not sure if the features we use on Kabylake are available on Broeadwell (tracing to SG buffer for example).
I will try to support all of these CPUs but if someone can help testing it would be good. Providing the output of pt_enumerate() on your CPU may be helpful as well.
So with a minimal impact on system perfomance we can trace pretty much everything now.
I provided simple 'pmctrace' application that enables tracing and decodes tracing buffers. It supports function tracing.
Intel PT provides 25 types of packets, we currently decode few of them only.
Example usage:
1. Trace all the conditional branches for uname(1) application.
pmctrace -u pt,branches uname
2. Trace all the conditional branches in memset(3) function in libc.
pmctrace -u pt,branches -i libc.so.7 -f memset sleep 1
3. Trace all the conditional branches for copyin() and show timestamp (TSC -- amount of clock cycles since boot).
sudo pmctrace -s pt,branches,tsc -i kernel -f copyin
So I have added new counters modes for HWPMC:
MODE_ST - system tracing
MODE_TT - virtual thread tracing
We may look for ARM tracing technologies later as well.
It is on review here:
https://reviews.freebsd.org/D12875
It require libipt decoder from Intel as well:
https://reviews.freebsd.org/D12717
Thanks.
Ruslan