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 29db73ee4bSVladimir Sementsov-Ogievskiycpu_in(unsigned int addr, char size, unsigned int val) "addr 0x%x(%c) value %u" 30db73ee4bSVladimir Sementsov-Ogievskiycpu_out(unsigned int addr, char size, unsigned int val) "addr 0x%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" 49b097efc0SStefan 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 58*db144f70SDr. David Alan Gilbert# exec.c 59154cc9eaSDr. David Alan Gilbertfind_ram_offset(uint64_t size, uint64_t offset) "size: 0x%" PRIx64 " @ 0x%" PRIx64 60154cc9eaSDr. David Alan Gilbertfind_ram_offset_loop(uint64_t size, uint64_t candidate, uint64_t offset, uint64_t next, uint64_t mingap) "trying size: 0x%" PRIx64 " @ 0x%" PRIx64 ", offset: 0x%" PRIx64" next: 0x%" PRIx64 " mingap: 0x%" PRIx64 61*db144f70SDr. David Alan Gilbertram_block_discard_range(const char *rbname, void *hva, size_t length, bool need_madvise, bool need_fallocate, int ret) "%s@%p + 0x%zx: madvise: %d fallocate: %d ret: %d" 62154cc9eaSDr. David Alan Gilbert 6355d5d048SPaolo Bonzini# memory.c 64db73ee4bSVladimir Sementsov-Ogievskiymemory_region_ops_read(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u" 65db73ee4bSVladimir Sementsov-Ogievskiymemory_region_ops_write(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u" 66db73ee4bSVladimir Sementsov-Ogievskiymemory_region_subpage_read(int cpu_index, void *mr, uint64_t offset, uint64_t value, unsigned size) "cpu %d mr %p offset 0x%"PRIx64" value 0x%"PRIx64" size %u" 67db73ee4bSVladimir Sementsov-Ogievskiymemory_region_subpage_write(int cpu_index, void *mr, uint64_t offset, uint64_t value, unsigned size) "cpu %d mr %p offset 0x%"PRIx64" value 0x%"PRIx64" size %u" 68db73ee4bSVladimir Sementsov-Ogievskiymemory_region_tb_read(int cpu_index, uint64_t addr, uint64_t value, unsigned size) "cpu %d addr 0x%"PRIx64" value 0x%"PRIx64" size %u" 69db73ee4bSVladimir Sementsov-Ogievskiymemory_region_tb_write(int cpu_index, uint64_t addr, uint64_t value, unsigned size) "cpu %d addr 0x%"PRIx64" value 0x%"PRIx64" size %u" 70db73ee4bSVladimir Sementsov-Ogievskiymemory_region_ram_device_read(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u" 71db73ee4bSVladimir Sementsov-Ogievskiymemory_region_ram_device_write(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u" 7288584448SDaniel P. Berrangéflatview_new(void *view, void *root) "%p (root %p)" 7388584448SDaniel P. Berrangéflatview_destroy(void *view, void *root) "%p (root %p)" 7488584448SDaniel P. Berrangéflatview_destroy_rcu(void *view, void *root) "%p (root %p)" 7555d5d048SPaolo Bonzini 765c9522b3SDoug Gale# gdbstub.c 777f1d87abSStefan Hajnoczigdbstub_op_start(const char *device) "Starting gdbstub using device %s" 785c9522b3SDoug Galegdbstub_op_exiting(uint8_t code) "notifying exit with code=0x%02x" 795c9522b3SDoug Galegdbstub_op_continue(void) "Continuing all CPUs" 805c9522b3SDoug Galegdbstub_op_continue_cpu(int cpu_index) "Continuing CPU %d" 815c9522b3SDoug Galegdbstub_op_stepping(int cpu_index) "Stepping CPU %d" 827f1d87abSStefan Hajnoczigdbstub_op_extra_info(const char *info) "Thread extra info: %s" 837f1d87abSStefan Hajnoczigdbstub_hit_watchpoint(const char *type, int cpu_gdb_index, uint64_t vaddr) "Watchpoint hit, type=\"%s\" cpu=%d, vaddr=0x%" PRIx64 "" 845c9522b3SDoug Galegdbstub_hit_internal_error(void) "RUN_STATE_INTERNAL_ERROR" 855c9522b3SDoug Galegdbstub_hit_break(void) "RUN_STATE_DEBUG" 865c9522b3SDoug Galegdbstub_hit_paused(void) "RUN_STATE_PAUSED" 875c9522b3SDoug Galegdbstub_hit_shutdown(void) "RUN_STATE_SHUTDOWN" 885c9522b3SDoug Galegdbstub_hit_io_error(void) "RUN_STATE_IO_ERROR" 895c9522b3SDoug Galegdbstub_hit_watchdog(void) "RUN_STATE_WATCHDOG" 905c9522b3SDoug Galegdbstub_hit_unknown(int state) "Unknown run state=0x%x" 917f1d87abSStefan Hajnoczigdbstub_io_reply(const char *message) "Sent: %s" 927f1d87abSStefan Hajnoczigdbstub_io_binaryreply(size_t ofs, const char *line) "0x%04zx: %s" 937f1d87abSStefan Hajnoczigdbstub_io_command(const char *command) "Received: %s" 945c9522b3SDoug Galegdbstub_io_got_ack(void) "Got ACK" 955c9522b3SDoug Galegdbstub_io_got_unexpected(uint8_t ch) "Got 0x%02x when expecting ACK/NACK" 965c9522b3SDoug Galegdbstub_err_got_nack(void) "Got NACK, retransmitting" 975c9522b3SDoug Galegdbstub_err_garbage(uint8_t ch) "received garbage between packets: 0x%02x" 985c9522b3SDoug Galegdbstub_err_overrun(void) "command buffer overrun, dropping command" 995c9522b3SDoug Galegdbstub_err_invalid_repeat(uint8_t ch) "got invalid RLE count: 0x%02x" 1005c9522b3SDoug Galegdbstub_err_invalid_rle(void) "got invalid RLE sequence" 1015c9522b3SDoug Galegdbstub_err_checksum_invalid(uint8_t ch) "got invalid command checksum digit: 0x%02x" 1025c9522b3SDoug Galegdbstub_err_checksum_incorrect(uint8_t expected, uint8_t got) "got command packet with incorrect checksum, expected=0x%02x, received=0x%02x" 1035c9522b3SDoug Gale 104dcdaadb6SLluís Vilanova### Guest events, keep at bottom 105dcdaadb6SLluís Vilanova 106b9d72215SLluís Vilanova 107b9d72215SLluís Vilanova## vCPU 108b9d72215SLluís Vilanova 109b9d72215SLluís Vilanova# Hot-plug a new virtual (guest) CPU 110b9d72215SLluís Vilanova# 111f5e2b3beSLluís Vilanova# Mode: user, softmmu 112b9d72215SLluís Vilanova# Targets: all 113b9d72215SLluís Vilanovavcpu guest_cpu_enter(void) 114b9d72215SLluís Vilanova 115a47e8715SLluís Vilanova# Hot-unplug a virtual (guest) CPU 116a47e8715SLluís Vilanova# 117a47e8715SLluís Vilanova# Mode: user, softmmu 118a47e8715SLluís Vilanova# Targets: all 119a47e8715SLluís Vilanovavcpu guest_cpu_exit(void) 120a47e8715SLluís Vilanova 1212cc2d082SLluís Vilanova# Reset the state of a virtual (guest) CPU 1222cc2d082SLluís Vilanova# 123f5e2b3beSLluís Vilanova# Mode: user, softmmu 1242cc2d082SLluís Vilanova# Targets: all 1252cc2d082SLluís Vilanovavcpu guest_cpu_reset(void) 1262cc2d082SLluís Vilanova 127dcdaadb6SLluís Vilanova# @vaddr: Access' virtual address. 128dcdaadb6SLluís Vilanova# @info : Access' information (see below). 129dcdaadb6SLluís Vilanova# 130dcdaadb6SLluís Vilanova# Start virtual memory access (before any potential access violation). 131dcdaadb6SLluís Vilanova# 132dcdaadb6SLluís Vilanova# Does not include memory accesses performed by devices. 133dcdaadb6SLluís Vilanova# 134dcdaadb6SLluís Vilanova# Access information can be parsed as: 135dcdaadb6SLluís Vilanova# 136dcdaadb6SLluís Vilanova# struct mem_info { 137dcdaadb6SLluís Vilanova# uint8_t size_shift : 2; /* interpreted as "1 << size_shift" bytes */ 138dcdaadb6SLluís Vilanova# bool sign_extend: 1; /* sign-extended */ 139dcdaadb6SLluís Vilanova# uint8_t endianness : 1; /* 0: little, 1: big */ 140dcdaadb6SLluís Vilanova# bool store : 1; /* wheter it's a store operation */ 141dcdaadb6SLluís Vilanova# }; 142dcdaadb6SLluís Vilanova# 14343e21e49SLluís Vilanova# Mode: user, softmmu 144dcdaadb6SLluís Vilanova# Targets: TCG(all) 1455caa262fSLluís Vilanovavcpu tcg guest_mem_before(TCGv vaddr, uint8_t info) "info=%d", "vaddr=0x%016"PRIx64" info=%d" 1469c15e700SLluís Vilanova 1479c15e700SLluís Vilanova# @num: System call number. 1489c15e700SLluís Vilanova# @arg*: System call argument value. 1499c15e700SLluís Vilanova# 1509c15e700SLluís Vilanova# Start executing a guest system call in syscall emulation mode. 1519c15e700SLluís Vilanova# 15243e21e49SLluís Vilanova# Mode: user 1539c15e700SLluís Vilanova# Targets: TCG(all) 1545caa262fSLluís Vilanovavcpu 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 1559c15e700SLluís Vilanova 1569c15e700SLluís Vilanova# @num: System call number. 1579c15e700SLluís Vilanova# @ret: System call result value. 1589c15e700SLluís Vilanova# 1599c15e700SLluís Vilanova# Finish executing a guest system call in syscall emulation mode. 1609c15e700SLluís Vilanova# 16143e21e49SLluís Vilanova# Mode: user 1629c15e700SLluís Vilanova# Targets: TCG(all) 1635caa262fSLluís Vilanovavcpu guest_user_syscall_ret(uint64_t num, uint64_t ret) "num=0x%016"PRIx64" ret=0x%016"PRIx64 164