Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf intel-pt: Add documentation for pause / resume

Document the use of aux-action config term and provide a simple example.

Reviewed-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20241216070244.14450-7-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Adrian Hunter and committed by
Arnaldo Carvalho de Melo
f8b301e0 f38ec227

+108
+108
tools/perf/Documentation/perf-intel-pt.txt
··· 555 555 which contains "1" if the feature is supported and 556 556 "0" otherwise. 557 557 558 + *aux-action=start-paused*:: 559 + Start tracing paused, refer to the section <<_pause_or_resume_tracing,Pause or Resume Tracing>> 560 + 558 561 559 562 config terms on other events 560 563 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ··· 573 570 Used to select PEBS-via-PT, refer to the 574 571 section <<_pebs_via_intel_pt,PEBS via Intel PT>> 575 572 573 + *aux-action*:: 574 + Used to pause or resume tracing, refer to the section 575 + <<_pause_or_resume_tracing,Pause or Resume Tracing>> 576 576 577 577 AUX area sampling option 578 578 ~~~~~~~~~~~~~~~~~~~~~~~~ ··· 1919 1913 1920 1914 For pipe mode, the order of events and timestamps can presumably 1921 1915 be messed up. 1916 + 1917 + 1918 + Pause or Resume Tracing 1919 + ----------------------- 1920 + 1921 + With newer Kernels, it is possible to use other selected events to pause 1922 + or resume Intel PT tracing. This is configured by using the "aux-action" 1923 + config term: 1924 + 1925 + "aux-action=pause" is used with events that are to pause Intel PT tracing. 1926 + 1927 + "aux-action=resume" is used with events that are to resume Intel PT tracing. 1928 + 1929 + "aux-action=start-paused" is used with the Intel PT event to start in a 1930 + paused state. 1931 + 1932 + For example, to trace only the uname system call (sys_newuname) when running the 1933 + command line utility uname: 1934 + 1935 + $ perf record --kcore -e intel_pt/aux-action=start-paused/k,syscalls:sys_enter_newuname/aux-action=resume/,syscalls:sys_exit_newuname/aux-action=pause/ uname 1936 + Linux 1937 + [ perf record: Woken up 1 times to write data ] 1938 + [ perf record: Captured and wrote 0.043 MB perf.data ] 1939 + $ perf script --call-trace 1940 + uname 30805 [000] 24001.058782799: name: 0x7ffc9c1865b0 1941 + uname 30805 [000] 24001.058784424: psb offs: 0 1942 + uname 30805 [000] 24001.058784424: cbr: 39 freq: 3904 MHz (139%) 1943 + uname 30805 [000] 24001.058784629: ([kernel.kallsyms]) debug_smp_processor_id 1944 + uname 30805 [000] 24001.058784629: ([kernel.kallsyms]) __x64_sys_newuname 1945 + uname 30805 [000] 24001.058784629: ([kernel.kallsyms]) down_read 1946 + uname 30805 [000] 24001.058784629: ([kernel.kallsyms]) __cond_resched 1947 + uname 30805 [000] 24001.058784629: ([kernel.kallsyms]) preempt_count_add 1948 + uname 30805 [000] 24001.058784629: ([kernel.kallsyms]) in_lock_functions 1949 + uname 30805 [000] 24001.058784629: ([kernel.kallsyms]) preempt_count_sub 1950 + uname 30805 [000] 24001.058784629: ([kernel.kallsyms]) up_read 1951 + uname 30805 [000] 24001.058784629: ([kernel.kallsyms]) preempt_count_add 1952 + uname 30805 [000] 24001.058784838: ([kernel.kallsyms]) in_lock_functions 1953 + uname 30805 [000] 24001.058784838: ([kernel.kallsyms]) preempt_count_sub 1954 + uname 30805 [000] 24001.058784838: ([kernel.kallsyms]) _copy_to_user 1955 + uname 30805 [000] 24001.058784838: ([kernel.kallsyms]) syscall_exit_to_user_mode 1956 + uname 30805 [000] 24001.058784838: ([kernel.kallsyms]) syscall_exit_work 1957 + uname 30805 [000] 24001.058784838: ([kernel.kallsyms]) perf_syscall_exit 1958 + uname 30805 [000] 24001.058784838: ([kernel.kallsyms]) debug_smp_processor_id 1959 + uname 30805 [000] 24001.058785046: ([kernel.kallsyms]) perf_trace_buf_alloc 1960 + uname 30805 [000] 24001.058785046: ([kernel.kallsyms]) perf_swevent_get_recursion_context 1961 + uname 30805 [000] 24001.058785046: ([kernel.kallsyms]) debug_smp_processor_id 1962 + uname 30805 [000] 24001.058785046: ([kernel.kallsyms]) debug_smp_processor_id 1963 + uname 30805 [000] 24001.058785046: ([kernel.kallsyms]) perf_tp_event 1964 + uname 30805 [000] 24001.058785046: ([kernel.kallsyms]) perf_trace_buf_update 1965 + uname 30805 [000] 24001.058785046: ([kernel.kallsyms]) tracing_gen_ctx_irq_test 1966 + uname 30805 [000] 24001.058785046: ([kernel.kallsyms]) perf_swevent_event 1967 + uname 30805 [000] 24001.058785046: ([kernel.kallsyms]) __perf_event_account_interrupt 1968 + uname 30805 [000] 24001.058785046: ([kernel.kallsyms]) __this_cpu_preempt_check 1969 + uname 30805 [000] 24001.058785046: ([kernel.kallsyms]) perf_event_output_forward 1970 + uname 30805 [000] 24001.058785046: ([kernel.kallsyms]) perf_event_aux_pause 1971 + uname 30805 [000] 24001.058785046: ([kernel.kallsyms]) ring_buffer_get 1972 + uname 30805 [000] 24001.058785046: ([kernel.kallsyms]) __rcu_read_lock 1973 + uname 30805 [000] 24001.058785046: ([kernel.kallsyms]) __rcu_read_unlock 1974 + uname 30805 [000] 24001.058785254: ([kernel.kallsyms]) pt_event_stop 1975 + uname 30805 [000] 24001.058785254: ([kernel.kallsyms]) debug_smp_processor_id 1976 + uname 30805 [000] 24001.058785254: ([kernel.kallsyms]) debug_smp_processor_id 1977 + uname 30805 [000] 24001.058785254: ([kernel.kallsyms]) native_write_msr 1978 + uname 30805 [000] 24001.058785463: ([kernel.kallsyms]) native_write_msr 1979 + uname 30805 [000] 24001.058785639: 0x0 1980 + 1981 + The example above uses tracepoints, but any kind of sampled event can be used. 1982 + 1983 + For example: 1984 + 1985 + Tracing between arch_cpu_idle_enter() and arch_cpu_idle_exit() using breakpoint events: 1986 + 1987 + $ sudo cat /proc/kallsyms | sort | grep ' arch_cpu_idle_enter\| arch_cpu_idle_exit' 1988 + ffffffffb605bf60 T arch_cpu_idle_enter 1989 + ffffffffb614d8a0 W arch_cpu_idle_exit 1990 + $ sudo perf record --kcore -a -e intel_pt/aux-action=start-paused/k -e mem:0xffffffffb605bf60:x/aux-action=resume/ -e mem:0xffffffffb614d8a0:x/aux-action=pause/ -- sleep 1 1991 + [ perf record: Woken up 1 times to write data ] 1992 + [ perf record: Captured and wrote 1.387 MB perf.data ] 1993 + 1994 + Tracing __alloc_pages() using kprobes: 1995 + 1996 + $ sudo perf probe --add '__alloc_pages order' 1997 + Added new event: probe:__alloc_pages (on __alloc_pages with order) 1998 + $ sudo perf probe --add __alloc_pages%return 1999 + Added new event: probe:__alloc_pages__return (on __alloc_pages%return) 2000 + $ sudo perf record --kcore -aR -e intel_pt/aux-action=start-paused/k -e probe:__alloc_pages/aux-action=resume/ -e probe:__alloc_pages__return/aux-action=pause/ -- sleep 1 2001 + [ perf record: Woken up 1 times to write data ] 2002 + [ perf record: Captured and wrote 1.490 MB perf.data ] 2003 + 2004 + Tracing starting at main() using a uprobe event: 2005 + 2006 + $ sudo perf probe -x /usr/bin/uname main 2007 + Added new event: probe_uname:main (on main in /usr/bin/uname) 2008 + $ sudo perf record -e intel_pt/-aux-action=start-paused/u -e probe_uname:main/aux-action=resume/ -- uname 2009 + Linux 2010 + [ perf record: Woken up 1 times to write data ] 2011 + [ perf record: Captured and wrote 0.031 MB perf.data ] 2012 + 2013 + Tracing occasionally using cycles events with different periods: 2014 + 2015 + $ perf record --kcore -a -m,64M -e intel_pt/aux-action=start-paused/k -e cycles/aux-action=pause,period=1000000/Pk -e cycles/aux-action=resume,period=10500000/Pk -- firefox 2016 + [ perf record: Woken up 19 times to write data ] 2017 + [ perf record: Captured and wrote 16.561 MB perf.data ] 1922 2018 1923 2019 1924 2020 EXAMPLE