xref: /openbmc/qemu/trace-events (revision 9ba35d0b865361f9838f830672ab229a569024eb)
194a420b1SStefan Hajnoczi# Trace events for debugging and performance instrumentation
294a420b1SStefan Hajnoczi#
394a420b1SStefan Hajnoczi# This file is processed by the tracetool script during the build.
494a420b1SStefan Hajnoczi#
594a420b1SStefan Hajnoczi# To add a new trace event:
694a420b1SStefan Hajnoczi#
794a420b1SStefan Hajnoczi# 1. Choose a name for the trace event.  Declare its arguments and format
894a420b1SStefan Hajnoczi#    string.
994a420b1SStefan Hajnoczi#
1094a420b1SStefan Hajnoczi# 2. Call the trace event from code using trace_##name, e.g. multiwrite_cb() ->
1194a420b1SStefan Hajnoczi#    trace_multiwrite_cb().  The source file must #include "trace.h".
1294a420b1SStefan Hajnoczi#
1394a420b1SStefan Hajnoczi# Format of a trace event:
1494a420b1SStefan Hajnoczi#
151e2cf2bcSStefan Hajnoczi# [disable] <name>(<type1> <arg1>[, <type2> <arg2>] ...) "<format-string>"
1694a420b1SStefan Hajnoczi#
17a74cd8ccSFrediano Ziglio# Example: g_malloc(size_t size) "size %zu"
1894a420b1SStefan Hajnoczi#
191e2cf2bcSStefan Hajnoczi# The "disable" keyword will build without the trace event.
201e2cf2bcSStefan Hajnoczi#
2194a420b1SStefan Hajnoczi# The <name> must be a valid as a C function name.
2294a420b1SStefan Hajnoczi#
2394a420b1SStefan Hajnoczi# Types should be standard C types.  Use void * for pointers because the trace
2494a420b1SStefan Hajnoczi# system may not have the necessary headers included.
2594a420b1SStefan Hajnoczi#
2694a420b1SStefan Hajnoczi# The <format-string> should be a sprintf()-compatible format string.
27cd245a19SStefan Hajnoczi
28bd3c9aa5SPrerna Saxena# ioport.c
296f94b7d9SPaolo Bonzinicpu_in(unsigned int addr, char size, unsigned int val) "addr %#x(%c) value %u"
306f94b7d9SPaolo Bonzinicpu_out(unsigned int addr, char size, unsigned int val) "addr %#x(%c) value %u"
3162dd89deSPrerna Saxena
3262dd89deSPrerna Saxena# balloon.c
3362dd89deSPrerna Saxena# Since requests are raised via monitor, not many tracepoints are needed.
3447f08d7aSLluísballoon_event(void *opaque, unsigned long addr) "opaque %p addr %lu"
35d8023f31SBlue Swirl
3694b0b5ffSStefan Hajnoczi# vl.c
3747f08d7aSLluísvm_state_notify(int running, int reason) "running %d reason %d"
384524051cSGerd Hoffmannload_file(const char *name, const char *path) "name %s location %s"
397e866003SKazuya Saitorunstate_set(int new_state) "new state %d"
404fed9421SAlexey Kardashevskiysystem_wakeup_request(int reason) "reason=%d"
41cf83f140SEric Blakeqemu_system_shutdown_request(int reason) "reason=%d"
42bc78cff9SYang Zhiyongqemu_system_powerdown_request(void) ""
43298800caSStefan Hajnoczi
4489bd820aSStefan Hajnoczi# monitor.c
4593f8f982SMarkus Armbrustermonitor_protocol_event_handler(uint32_t event, void *qdict) "event=%d data=%p"
46afeecec2SDaniel P. Berrangemonitor_protocol_event_emit(uint32_t event, void *data) "event=%d data=%p"
4793f8f982SMarkus Armbrustermonitor_protocol_event_queue(uint32_t event, void *qdict, uint64_t rate) "event=%d data=%p rate=%" PRId64
48342407fdSMax Filippov
49c57c4658SKevin Wolf# dma-helpers.c
50cbe0ed62SPaolo Bonzinidma_blk_io(void *dbs, void *bs, int64_t offset, bool to_dev) "dbs=%p bs=%p offset=%" PRId64 " to_dev=%d"
51c57c4658SKevin Wolfdma_aio_cancel(void *dbs) "dbs=%p"
52c57c4658SKevin Wolfdma_complete(void *dbs, int ret, void *cb) "dbs=%p ret=%d cb=%p"
534be74634SMarkus Armbrusterdma_blk_cb(void *dbs, int ret) "dbs=%p ret=%d"
54c57c4658SKevin Wolfdma_map_wait(void *dbs) "dbs=%p"
55cdbc19ddSAlon Levy
569c775729SKazuya Saito# kvm-all.c
574fe6e9ecSAlexey Kardashevskiykvm_ioctl(int type, void *arg) "type 0x%x, arg %p"
584fe6e9ecSAlexey Kardashevskiykvm_vm_ioctl(int type, void *arg) "type 0x%x, arg %p"
594fe6e9ecSAlexey Kardashevskiykvm_vcpu_ioctl(int cpu_index, int type, void *arg) "cpu_index %d, type 0x%x, arg %p"
60b76ac80aSKazuya Saitokvm_run_exit(int cpu_index, uint32_t reason) "cpu_index %d, reason %d"
610a6a7ccaSChristoffer Dallkvm_device_ioctl(int fd, int type, void *arg) "dev fd %d, type 0x%x, arg %p"
62ada4135fSCornelia Huckkvm_failed_reg_get(uint64_t id, const char *msg) "Warning: Unable to retrieve ONEREG %" PRIu64 " from KVM: %s"
63ada4135fSCornelia Huckkvm_failed_reg_set(uint64_t id, const char *msg) "Warning: Unable to set ONEREG %" PRIu64 " to KVM: %s"
6454a6c11bSPeter Xukvm_irqchip_commit_routes(void) ""
65*9ba35d0bSPeter Xukvm_irqchip_add_msi_route(char *name, int vector, int virq) "dev %s vector %d virq %d"
6654a6c11bSPeter Xukvm_irqchip_update_msi_route(int virq) "Updating MSI route virq=%d"
67*9ba35d0bSPeter Xukvm_irqchip_release_virq(int virq) "virq %d"
68b76ac80aSKazuya Saito
696db8b538SAlex Bennée# TCG related tracing (mostly disabled by default)
706db8b538SAlex Bennée# cpu-exec.c
716db8b538SAlex Bennéedisable exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
726db8b538SAlex Bennéedisable exec_tb_nocache(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
73819af24bSSergey Fedorovdisable exec_tb_exit(void *last_tb, unsigned int flags) "tb:%p flags=%x"
746db8b538SAlex Bennée
756db8b538SAlex Bennée# translate-all.c
766db8b538SAlex Bennéetranslate_block(void *tb, uintptr_t pc, uint8_t *tb_code) "tb:%p, pc:0x%"PRIxPTR", tb_code:%p"
776db8b538SAlex Bennée
7855d5d048SPaolo Bonzini# memory.c
795a68be94SHollis Blanchardmemory_region_ops_read(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr %#"PRIx64" value %#"PRIx64" size %u"
805a68be94SHollis Blanchardmemory_region_ops_write(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr %#"PRIx64" value %#"PRIx64" size %u"
815a68be94SHollis Blanchardmemory_region_subpage_read(int cpu_index, void *mr, uint64_t offset, uint64_t value, unsigned size) "cpu %d mr %p offset %#"PRIx64" value %#"PRIx64" size %u"
825a68be94SHollis Blanchardmemory_region_subpage_write(int cpu_index, void *mr, uint64_t offset, uint64_t value, unsigned size) "cpu %d mr %p offset %#"PRIx64" value %#"PRIx64" size %u"
83f2d08942SHollis Blanchardmemory_region_tb_read(int cpu_index, uint64_t addr, uint64_t value, unsigned size) "cpu %d addr %#"PRIx64" value %#"PRIx64" size %u"
84f2d08942SHollis Blanchardmemory_region_tb_write(int cpu_index, uint64_t addr, uint64_t value, unsigned size) "cpu %d addr %#"PRIx64" value %#"PRIx64" size %u"
854a2e242bSAlex Williamsonmemory_region_ram_device_read(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr %#"PRIx64" value %#"PRIx64" size %u"
864a2e242bSAlex Williamsonmemory_region_ram_device_write(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr %#"PRIx64" value %#"PRIx64" size %u"
8755d5d048SPaolo Bonzini
88dcdaadb6SLluís Vilanova### Guest events, keep at bottom
89dcdaadb6SLluís Vilanova
90b9d72215SLluís Vilanova
91b9d72215SLluís Vilanova## vCPU
92b9d72215SLluís Vilanova
93b9d72215SLluís Vilanova# Hot-plug a new virtual (guest) CPU
94b9d72215SLluís Vilanova#
95f5e2b3beSLluís Vilanova# Mode: user, softmmu
96b9d72215SLluís Vilanova# Targets: all
97b9d72215SLluís Vilanovavcpu guest_cpu_enter(void)
98b9d72215SLluís Vilanova
99a47e8715SLluís Vilanova# Hot-unplug a virtual (guest) CPU
100a47e8715SLluís Vilanova#
101a47e8715SLluís Vilanova# Mode: user, softmmu
102a47e8715SLluís Vilanova# Targets: all
103a47e8715SLluís Vilanovavcpu guest_cpu_exit(void)
104a47e8715SLluís Vilanova
1052cc2d082SLluís Vilanova# Reset the state of a virtual (guest) CPU
1062cc2d082SLluís Vilanova#
107f5e2b3beSLluís Vilanova# Mode: user, softmmu
1082cc2d082SLluís Vilanova# Targets: all
1092cc2d082SLluís Vilanovavcpu guest_cpu_reset(void)
1102cc2d082SLluís Vilanova
111dcdaadb6SLluís Vilanova# @vaddr: Access' virtual address.
112dcdaadb6SLluís Vilanova# @info : Access' information (see below).
113dcdaadb6SLluís Vilanova#
114dcdaadb6SLluís Vilanova# Start virtual memory access (before any potential access violation).
115dcdaadb6SLluís Vilanova#
116dcdaadb6SLluís Vilanova# Does not include memory accesses performed by devices.
117dcdaadb6SLluís Vilanova#
118dcdaadb6SLluís Vilanova# Access information can be parsed as:
119dcdaadb6SLluís Vilanova#
120dcdaadb6SLluís Vilanova# struct mem_info {
121dcdaadb6SLluís Vilanova#     uint8_t size_shift : 2; /* interpreted as "1 << size_shift" bytes */
122dcdaadb6SLluís Vilanova#     bool    sign_extend: 1; /* sign-extended */
123dcdaadb6SLluís Vilanova#     uint8_t endianness : 1; /* 0: little, 1: big */
124dcdaadb6SLluís Vilanova#     bool    store      : 1; /* wheter it's a store operation */
125dcdaadb6SLluís Vilanova# };
126dcdaadb6SLluís Vilanova#
12743e21e49SLluís Vilanova# Mode: user, softmmu
128dcdaadb6SLluís Vilanova# Targets: TCG(all)
129dcdaadb6SLluís Vilanovadisable vcpu tcg guest_mem_before(TCGv vaddr, uint8_t info) "info=%d", "vaddr=0x%016"PRIx64" info=%d"
1309c15e700SLluís Vilanova
1319c15e700SLluís Vilanova# @num: System call number.
1329c15e700SLluís Vilanova# @arg*: System call argument value.
1339c15e700SLluís Vilanova#
1349c15e700SLluís Vilanova# Start executing a guest system call in syscall emulation mode.
1359c15e700SLluís Vilanova#
13643e21e49SLluís Vilanova# Mode: user
1379c15e700SLluís Vilanova# Targets: TCG(all)
1389c15e700SLluís Vilanovadisable vcpu guest_user_syscall(uint64_t num, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5, uint64_t arg6, uint64_t arg7, uint64_t arg8) "num=0x%016"PRIx64" arg1=0x%016"PRIx64" arg2=0x%016"PRIx64" arg3=0x%016"PRIx64" arg4=0x%016"PRIx64" arg5=0x%016"PRIx64" arg6=0x%016"PRIx64" arg7=0x%016"PRIx64" arg8=0x%016"PRIx64
1399c15e700SLluís Vilanova
1409c15e700SLluís Vilanova# @num: System call number.
1419c15e700SLluís Vilanova# @ret: System call result value.
1429c15e700SLluís Vilanova#
1439c15e700SLluís Vilanova# Finish executing a guest system call in syscall emulation mode.
1449c15e700SLluís Vilanova#
14543e21e49SLluís Vilanova# Mode: user
1469c15e700SLluís Vilanova# Targets: TCG(all)
1479c15e700SLluís Vilanovadisable vcpu guest_user_syscall_ret(uint64_t num, uint64_t ret) "num=0x%016"PRIx64" ret=0x%016"PRIx64
148