On 29/03/2016 17:02, Richard W.M. Jones wrote: > Back in the day you used to be able to set DEBUG_IOPORT in ioport.c > and get qemu to dump what (x86) I/O ports were being accessed by the > guest. This was rather useful for finding out what closed source > device drivers were up to. > > Now you're supposed to use cpu_in/cpu_out tracepoints instead. > However for the majority of guests these tracepoints will never be > called.
For what it's worth, the breakage dated to way before DEBUG_IOPORT was converted to tracepoints. (This is why putting tracing code behind #if 0 is bad). It happened when I/O ports stopped being special snowflakes, and started being just like any other MMIO target (except they live in another address space). > It turns out this is still not particularly useful for debugging > because (a) it creates massive amounts of log messages and (b) there's > no way to select a range of addresses or a device of interest. For > example, if you have a serial port, everything else gets swamped by > I/O access to the serial port. Am I wrong that this is not any better/worse than "-d ioport" used to be? > Maybe using a different tracing backend (eg. stap) would help? You are actually logging every memory write (except stuff that it's DMA'd from/to block devices directly by passing a guest memory pointer to preadv/pwritev). That's way more than just I/O ports. However I understand that it's useful to treat them as special snowflakes for the purpose of tracing. To fix the problem with your patch, I suggest to: - consolidate the six tracepoints in 2 (cpu_in and cpu_out) that take the size as an extra argument - keep the existing calls to the tracepoints, and add more calls in kvm_handle_io and in the helpers in target-i386/misc_helper.c. Paolo