xref: /openbmc/qemu/trace-events (revision b097efc0027e36fd15a4fc2e415e780611024757)
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
4879cad8b4SStefan Hajnoczihandle_hmp_command(void *mon, const char *cmdline) "mon %p cmdline: %s"
49*b097efc0SStefan Hajnoczihandle_qmp_command(void *mon, const char *req) "mon %p req: %s"
50342407fdSMax Filippov
51c57c4658SKevin Wolf# dma-helpers.c
52cbe0ed62SPaolo Bonzinidma_blk_io(void *dbs, void *bs, int64_t offset, bool to_dev) "dbs=%p bs=%p offset=%" PRId64 " to_dev=%d"
53c57c4658SKevin Wolfdma_aio_cancel(void *dbs) "dbs=%p"
54c57c4658SKevin Wolfdma_complete(void *dbs, int ret, void *cb) "dbs=%p ret=%d cb=%p"
554be74634SMarkus Armbrusterdma_blk_cb(void *dbs, int ret) "dbs=%p ret=%d"
56c57c4658SKevin Wolfdma_map_wait(void *dbs) "dbs=%p"
57cdbc19ddSAlon Levy
589c775729SKazuya Saito# kvm-all.c
594fe6e9ecSAlexey Kardashevskiykvm_ioctl(int type, void *arg) "type 0x%x, arg %p"
604fe6e9ecSAlexey Kardashevskiykvm_vm_ioctl(int type, void *arg) "type 0x%x, arg %p"
614fe6e9ecSAlexey Kardashevskiykvm_vcpu_ioctl(int cpu_index, int type, void *arg) "cpu_index %d, type 0x%x, arg %p"
62b76ac80aSKazuya Saitokvm_run_exit(int cpu_index, uint32_t reason) "cpu_index %d, reason %d"
630a6a7ccaSChristoffer Dallkvm_device_ioctl(int fd, int type, void *arg) "dev fd %d, type 0x%x, arg %p"
64ada4135fSCornelia Huckkvm_failed_reg_get(uint64_t id, const char *msg) "Warning: Unable to retrieve ONEREG %" PRIu64 " from KVM: %s"
65ada4135fSCornelia Huckkvm_failed_reg_set(uint64_t id, const char *msg) "Warning: Unable to set ONEREG %" PRIu64 " to KVM: %s"
6654a6c11bSPeter Xukvm_irqchip_commit_routes(void) ""
679ba35d0bSPeter Xukvm_irqchip_add_msi_route(char *name, int vector, int virq) "dev %s vector %d virq %d"
6854a6c11bSPeter Xukvm_irqchip_update_msi_route(int virq) "Updating MSI route virq=%d"
699ba35d0bSPeter Xukvm_irqchip_release_virq(int virq) "virq %d"
70b76ac80aSKazuya Saito
716db8b538SAlex Bennée# TCG related tracing (mostly disabled by default)
726db8b538SAlex Bennée# cpu-exec.c
736db8b538SAlex Bennéedisable exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
746db8b538SAlex Bennéedisable exec_tb_nocache(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
75819af24bSSergey Fedorovdisable exec_tb_exit(void *last_tb, unsigned int flags) "tb:%p flags=%x"
766db8b538SAlex Bennée
776db8b538SAlex Bennée# translate-all.c
786db8b538SAlex Bennéetranslate_block(void *tb, uintptr_t pc, uint8_t *tb_code) "tb:%p, pc:0x%"PRIxPTR", tb_code:%p"
796db8b538SAlex Bennée
8055d5d048SPaolo Bonzini# memory.c
815a68be94SHollis 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"
825a68be94SHollis 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"
835a68be94SHollis 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"
845a68be94SHollis 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"
85f2d08942SHollis Blanchardmemory_region_tb_read(int cpu_index, uint64_t addr, uint64_t value, unsigned size) "cpu %d addr %#"PRIx64" value %#"PRIx64" size %u"
86f2d08942SHollis Blanchardmemory_region_tb_write(int cpu_index, uint64_t addr, uint64_t value, unsigned size) "cpu %d addr %#"PRIx64" value %#"PRIx64" size %u"
874a2e242bSAlex 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"
884a2e242bSAlex 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"
8955d5d048SPaolo Bonzini
90dcdaadb6SLluís Vilanova### Guest events, keep at bottom
91dcdaadb6SLluís Vilanova
92b9d72215SLluís Vilanova
93b9d72215SLluís Vilanova## vCPU
94b9d72215SLluís Vilanova
95b9d72215SLluís Vilanova# Hot-plug a new virtual (guest) CPU
96b9d72215SLluís Vilanova#
97f5e2b3beSLluís Vilanova# Mode: user, softmmu
98b9d72215SLluís Vilanova# Targets: all
99b9d72215SLluís Vilanovavcpu guest_cpu_enter(void)
100b9d72215SLluís Vilanova
101a47e8715SLluís Vilanova# Hot-unplug a virtual (guest) CPU
102a47e8715SLluís Vilanova#
103a47e8715SLluís Vilanova# Mode: user, softmmu
104a47e8715SLluís Vilanova# Targets: all
105a47e8715SLluís Vilanovavcpu guest_cpu_exit(void)
106a47e8715SLluís Vilanova
1072cc2d082SLluís Vilanova# Reset the state of a virtual (guest) CPU
1082cc2d082SLluís Vilanova#
109f5e2b3beSLluís Vilanova# Mode: user, softmmu
1102cc2d082SLluís Vilanova# Targets: all
1112cc2d082SLluís Vilanovavcpu guest_cpu_reset(void)
1122cc2d082SLluís Vilanova
113dcdaadb6SLluís Vilanova# @vaddr: Access' virtual address.
114dcdaadb6SLluís Vilanova# @info : Access' information (see below).
115dcdaadb6SLluís Vilanova#
116dcdaadb6SLluís Vilanova# Start virtual memory access (before any potential access violation).
117dcdaadb6SLluís Vilanova#
118dcdaadb6SLluís Vilanova# Does not include memory accesses performed by devices.
119dcdaadb6SLluís Vilanova#
120dcdaadb6SLluís Vilanova# Access information can be parsed as:
121dcdaadb6SLluís Vilanova#
122dcdaadb6SLluís Vilanova# struct mem_info {
123dcdaadb6SLluís Vilanova#     uint8_t size_shift : 2; /* interpreted as "1 << size_shift" bytes */
124dcdaadb6SLluís Vilanova#     bool    sign_extend: 1; /* sign-extended */
125dcdaadb6SLluís Vilanova#     uint8_t endianness : 1; /* 0: little, 1: big */
126dcdaadb6SLluís Vilanova#     bool    store      : 1; /* wheter it's a store operation */
127dcdaadb6SLluís Vilanova# };
128dcdaadb6SLluís Vilanova#
12943e21e49SLluís Vilanova# Mode: user, softmmu
130dcdaadb6SLluís Vilanova# Targets: TCG(all)
131dcdaadb6SLluís Vilanovadisable vcpu tcg guest_mem_before(TCGv vaddr, uint8_t info) "info=%d", "vaddr=0x%016"PRIx64" info=%d"
1329c15e700SLluís Vilanova
1339c15e700SLluís Vilanova# @num: System call number.
1349c15e700SLluís Vilanova# @arg*: System call argument value.
1359c15e700SLluís Vilanova#
1369c15e700SLluís Vilanova# Start executing a guest system call in syscall emulation mode.
1379c15e700SLluís Vilanova#
13843e21e49SLluís Vilanova# Mode: user
1399c15e700SLluís Vilanova# Targets: TCG(all)
1409c15e700SLluí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
1419c15e700SLluís Vilanova
1429c15e700SLluís Vilanova# @num: System call number.
1439c15e700SLluís Vilanova# @ret: System call result value.
1449c15e700SLluís Vilanova#
1459c15e700SLluís Vilanova# Finish executing a guest system call in syscall emulation mode.
1469c15e700SLluís Vilanova#
14743e21e49SLluís Vilanova# Mode: user
1489c15e700SLluís Vilanova# Targets: TCG(all)
1499c15e700SLluís Vilanovadisable vcpu guest_user_syscall_ret(uint64_t num, uint64_t ret) "num=0x%016"PRIx64" ret=0x%016"PRIx64
150