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 48*79cad8b4SStefan Hajnoczihandle_hmp_command(void *mon, const char *cmdline) "mon %p cmdline: %s" 49342407fdSMax Filippov 50c57c4658SKevin Wolf# dma-helpers.c 51cbe0ed62SPaolo Bonzinidma_blk_io(void *dbs, void *bs, int64_t offset, bool to_dev) "dbs=%p bs=%p offset=%" PRId64 " to_dev=%d" 52c57c4658SKevin Wolfdma_aio_cancel(void *dbs) "dbs=%p" 53c57c4658SKevin Wolfdma_complete(void *dbs, int ret, void *cb) "dbs=%p ret=%d cb=%p" 544be74634SMarkus Armbrusterdma_blk_cb(void *dbs, int ret) "dbs=%p ret=%d" 55c57c4658SKevin Wolfdma_map_wait(void *dbs) "dbs=%p" 56cdbc19ddSAlon Levy 579c775729SKazuya Saito# kvm-all.c 584fe6e9ecSAlexey Kardashevskiykvm_ioctl(int type, void *arg) "type 0x%x, arg %p" 594fe6e9ecSAlexey Kardashevskiykvm_vm_ioctl(int type, void *arg) "type 0x%x, arg %p" 604fe6e9ecSAlexey Kardashevskiykvm_vcpu_ioctl(int cpu_index, int type, void *arg) "cpu_index %d, type 0x%x, arg %p" 61b76ac80aSKazuya Saitokvm_run_exit(int cpu_index, uint32_t reason) "cpu_index %d, reason %d" 620a6a7ccaSChristoffer Dallkvm_device_ioctl(int fd, int type, void *arg) "dev fd %d, type 0x%x, arg %p" 63ada4135fSCornelia Huckkvm_failed_reg_get(uint64_t id, const char *msg) "Warning: Unable to retrieve ONEREG %" PRIu64 " from KVM: %s" 64ada4135fSCornelia Huckkvm_failed_reg_set(uint64_t id, const char *msg) "Warning: Unable to set ONEREG %" PRIu64 " to KVM: %s" 6554a6c11bSPeter Xukvm_irqchip_commit_routes(void) "" 669ba35d0bSPeter Xukvm_irqchip_add_msi_route(char *name, int vector, int virq) "dev %s vector %d virq %d" 6754a6c11bSPeter Xukvm_irqchip_update_msi_route(int virq) "Updating MSI route virq=%d" 689ba35d0bSPeter Xukvm_irqchip_release_virq(int virq) "virq %d" 69b76ac80aSKazuya Saito 706db8b538SAlex Bennée# TCG related tracing (mostly disabled by default) 716db8b538SAlex Bennée# cpu-exec.c 726db8b538SAlex Bennéedisable exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR 736db8b538SAlex Bennéedisable exec_tb_nocache(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR 74819af24bSSergey Fedorovdisable exec_tb_exit(void *last_tb, unsigned int flags) "tb:%p flags=%x" 756db8b538SAlex Bennée 766db8b538SAlex Bennée# translate-all.c 776db8b538SAlex Bennéetranslate_block(void *tb, uintptr_t pc, uint8_t *tb_code) "tb:%p, pc:0x%"PRIxPTR", tb_code:%p" 786db8b538SAlex Bennée 7955d5d048SPaolo Bonzini# memory.c 805a68be94SHollis 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" 815a68be94SHollis 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" 825a68be94SHollis 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" 835a68be94SHollis 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" 84f2d08942SHollis Blanchardmemory_region_tb_read(int cpu_index, uint64_t addr, uint64_t value, unsigned size) "cpu %d addr %#"PRIx64" value %#"PRIx64" size %u" 85f2d08942SHollis Blanchardmemory_region_tb_write(int cpu_index, uint64_t addr, uint64_t value, unsigned size) "cpu %d addr %#"PRIx64" value %#"PRIx64" size %u" 864a2e242bSAlex 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" 874a2e242bSAlex 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" 8855d5d048SPaolo Bonzini 89dcdaadb6SLluís Vilanova### Guest events, keep at bottom 90dcdaadb6SLluís Vilanova 91b9d72215SLluís Vilanova 92b9d72215SLluís Vilanova## vCPU 93b9d72215SLluís Vilanova 94b9d72215SLluís Vilanova# Hot-plug a new virtual (guest) CPU 95b9d72215SLluís Vilanova# 96f5e2b3beSLluís Vilanova# Mode: user, softmmu 97b9d72215SLluís Vilanova# Targets: all 98b9d72215SLluís Vilanovavcpu guest_cpu_enter(void) 99b9d72215SLluís Vilanova 100a47e8715SLluís Vilanova# Hot-unplug a virtual (guest) CPU 101a47e8715SLluís Vilanova# 102a47e8715SLluís Vilanova# Mode: user, softmmu 103a47e8715SLluís Vilanova# Targets: all 104a47e8715SLluís Vilanovavcpu guest_cpu_exit(void) 105a47e8715SLluís Vilanova 1062cc2d082SLluís Vilanova# Reset the state of a virtual (guest) CPU 1072cc2d082SLluís Vilanova# 108f5e2b3beSLluís Vilanova# Mode: user, softmmu 1092cc2d082SLluís Vilanova# Targets: all 1102cc2d082SLluís Vilanovavcpu guest_cpu_reset(void) 1112cc2d082SLluís Vilanova 112dcdaadb6SLluís Vilanova# @vaddr: Access' virtual address. 113dcdaadb6SLluís Vilanova# @info : Access' information (see below). 114dcdaadb6SLluís Vilanova# 115dcdaadb6SLluís Vilanova# Start virtual memory access (before any potential access violation). 116dcdaadb6SLluís Vilanova# 117dcdaadb6SLluís Vilanova# Does not include memory accesses performed by devices. 118dcdaadb6SLluís Vilanova# 119dcdaadb6SLluís Vilanova# Access information can be parsed as: 120dcdaadb6SLluís Vilanova# 121dcdaadb6SLluís Vilanova# struct mem_info { 122dcdaadb6SLluís Vilanova# uint8_t size_shift : 2; /* interpreted as "1 << size_shift" bytes */ 123dcdaadb6SLluís Vilanova# bool sign_extend: 1; /* sign-extended */ 124dcdaadb6SLluís Vilanova# uint8_t endianness : 1; /* 0: little, 1: big */ 125dcdaadb6SLluís Vilanova# bool store : 1; /* wheter it's a store operation */ 126dcdaadb6SLluís Vilanova# }; 127dcdaadb6SLluís Vilanova# 12843e21e49SLluís Vilanova# Mode: user, softmmu 129dcdaadb6SLluís Vilanova# Targets: TCG(all) 130dcdaadb6SLluís Vilanovadisable vcpu tcg guest_mem_before(TCGv vaddr, uint8_t info) "info=%d", "vaddr=0x%016"PRIx64" info=%d" 1319c15e700SLluís Vilanova 1329c15e700SLluís Vilanova# @num: System call number. 1339c15e700SLluís Vilanova# @arg*: System call argument value. 1349c15e700SLluís Vilanova# 1359c15e700SLluís Vilanova# Start executing a guest system call in syscall emulation mode. 1369c15e700SLluís Vilanova# 13743e21e49SLluís Vilanova# Mode: user 1389c15e700SLluís Vilanova# Targets: TCG(all) 1399c15e700SLluí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 1409c15e700SLluís Vilanova 1419c15e700SLluís Vilanova# @num: System call number. 1429c15e700SLluís Vilanova# @ret: System call result value. 1439c15e700SLluís Vilanova# 1449c15e700SLluís Vilanova# Finish executing a guest system call in syscall emulation mode. 1459c15e700SLluís Vilanova# 14643e21e49SLluís Vilanova# Mode: user 1479c15e700SLluís Vilanova# Targets: TCG(all) 1489c15e700SLluís Vilanovadisable vcpu guest_user_syscall_ret(uint64_t num, uint64_t ret) "num=0x%016"PRIx64" ret=0x%016"PRIx64 149