Page MenuHomeFreeBSD

hwt(8) utility added
Needs ReviewPublic

Authored by br on Jun 23 2023, 6:56 PM.
Tags
None
Referenced Files
F82324584: D40728.id125098.diff
Sat, Apr 27, 4:20 PM
Unknown Object (File)
Sat, Apr 27, 5:23 AM
Unknown Object (File)
Fri, Apr 26, 7:57 PM
Unknown Object (File)
Fri, Apr 26, 3:27 PM
Unknown Object (File)
Fri, Apr 26, 2:03 PM
Unknown Object (File)
Fri, Apr 26, 10:00 AM
Unknown Object (File)
Fri, Apr 26, 9:26 AM
Unknown Object (File)
Fri, Apr 26, 2:55 AM

Details

Summary

This instrumentation tool is a part of hwt(4) framework. It controls tracing units.

hwt(8) tool takes a path to an executable as an argument, creates kernel tracing context, then runs the application with tracing unit enabled.
Once some traces collected, hwt(8) decodes data using OpenCSD framework (on arm64) and prints the trace results in human readable format to standard output.

Test Plan

Tested with ARM Coresight on ARM Morello board.

Example usage, thread mode.

  1. In this scenario we will be tracing all the threads of "test" executable, but decode only thread 0.
sudo ./hwt -t 0 ./test/test
  1. In this scenario we will be tracing main() fuction of test executable only.
sudo ./hwt -t 0 ./test/test -i test -f main
  1. In this scenario we will be tracing strlen() function of test executable only.
sudo ./hwt -t 0 ./test/test -i libc.so.7 -f strlen

CPU mode. In this scenario tracing context collects information for CPUs number 1 and 3 */

sudo ./hwt -s 3,1 -i kernel -f cpu_switch

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

br requested review of this revision.Jun 23 2023, 6:56 PM
br added a parent revision: D40477: HWT: ARM CoreSight support.
br edited the test plan for this revision. (Show Details)

Add '-t' argument allowing to specify thread index we want to read trace for.

ip range filtering added

suspend a single thread on mmap, not entire proc

Abstract tracing devices

br edited the summary of this revision. (Show Details)
br edited the test plan for this revision. (Show Details)

Add kernel-mode tracing support.

allow tracing multiple cpus in system mode

decode multiple cpus at the same time

br edited the summary of this revision. (Show Details)

cleanup

Allow attaching to an existed proc;
Add support for libxo

obtain ETM IDR registers from sysctl. This is needed for Juno

usr.sbin/hwt/hwt.c
60

What's hwt_libxo.h?

remove hwt_libxo.h as not needed

usr.sbin/hwt/hwt.c
60

That is not needed (Leftovers from libxo integration)

usr.sbin/hwt/Makefile
2

#FreeBSD$

usr.sbin/hwt/hwt.c
172

This needs to be updated after making cpu_map a pointer.

203

Debug printf? And %#p isn't valid outsize of CheriBSD.

Intel PT support added by Bojan Novković