Message ID | 150529642278.10902.18234057937634437857.stgit@frigg.lan |
---|---|
Headers | show |
Series | instrument: Add basic event instrumentation | expand |
Hi, This series seems to have some coding style problems. See output below for more information: Subject: [Qemu-devel] [PATCH v6 00/22] instrument: Add basic event instrumentation Message-id: 150529642278.10902.18234057937634437857.stgit@frigg.lan Type: series === TEST SCRIPT BEGIN === #!/bin/bash BASE=base n=1 total=$(git log --oneline $BASE.. | wc -l) failed=0 git config --local diff.renamelimit 0 git config --local diff.renames True commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..." if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then failed=1 echo fi n=$((n+1)) done exit $failed === TEST SCRIPT END === Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 From https://github.com/patchew-project/qemu * [new tag] patchew/150529642278.10902.18234057937634437857.stgit@frigg.lan -> patchew/150529642278.10902.18234057937634437857.stgit@frigg.lan Switched to a new branch 'test' 8963b0695e instrument: Add API to manipulate guest memory d8552c1e16 instrument: Add event 'guest_user_syscall_ret' 04bda8d5aa instrument: Add event 'guest_user_syscall' 1d8370cd51 instrument: Add event 'guest_mem_before_exec' df27827de9 instrument: Add event 'guest_mem_before_trans' 4d144f90f0 trace: Introduce a proper structure to describe memory accesses a4aa7e8863 instrument: Add event 'guest_cpu_reset' 387ca2ea04 instrument: Add event 'guest_cpu_exit' 5ae9ef5c01 exec: Add function to synchronously flush TB on a stopped vCPU 13e99981c9 instrument: Support synchronous modification of vCPU state 722663c82d instrument: Add event 'guest_cpu_enter' 0dc9a4a367 instrument: Track vCPUs d86f598866 instrument: Add support for tracing events d4aa1cea7f instrument: Add basic control interface 2d727bb6fb instrument: [hmp] Add library loader 3eb4b46981 instrument: [qapi] Add library loader 5641b387a2 instrument: [softmmu] Add command line library loader d94ac79e7f instrument: [bsd-user] Add command line library loader 77c31d49ed instrument: [linux-user] Add command line library loader f47ccffa50 instrument: Add generic library loader 3234817196 instrument: Add configure-time flag 67a448c69e instrument: Add documentation === OUTPUT BEGIN === Checking PATCH 1/22: instrument: Add documentation... Checking PATCH 2/22: instrument: Add configure-time flag... Checking PATCH 3/22: instrument: Add generic library loader... Checking PATCH 4/22: instrument: [linux-user] Add command line library loader... Checking PATCH 5/22: instrument: [bsd-user] Add command line library loader... Checking PATCH 6/22: instrument: [softmmu] Add command line library loader... Checking PATCH 7/22: instrument: [qapi] Add library loader... ERROR: externs should be avoided in .c files #250: FILE: stubs/instrument.c:36: +void qmp_instr_unload(const char *id, Error **errp); total: 1 errors, 0 warnings, 200 lines checked Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. Checking PATCH 8/22: instrument: [hmp] Add library loader... Checking PATCH 9/22: instrument: Add basic control interface... WARNING: architecture specific defines should be avoided #52: FILE: include/qemu/compiler.h:119: +#if defined _WIN32 || defined __CYGWIN__ WARNING: architecture specific defines should be avoided #53: FILE: include/qemu/compiler.h:120: + #ifdef __GNUC__ WARNING: architecture specific defines should be avoided #59: FILE: include/qemu/compiler.h:126: + #if __GNUC__ >= 4 WARNING: architecture specific defines should be avoided #343: FILE: instrument/qemu-instr/control.h:13: +#ifdef __cplusplus WARNING: architecture specific defines should be avoided #372: FILE: instrument/qemu-instr/control.h:42: +#ifdef __cplusplus total: 0 errors, 5 warnings, 309 lines checked Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. Checking PATCH 10/22: instrument: Add support for tracing events... WARNING: architecture specific defines should be avoided #77: FILE: instrument/qemu-instr/types.h:13: +#ifdef __cplusplus WARNING: architecture specific defines should be avoided #111: FILE: instrument/qemu-instr/types.h:47: +#ifdef __cplusplus total: 0 errors, 2 warnings, 225 lines checked Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. Checking PATCH 11/22: instrument: Track vCPUs... Checking PATCH 12/22: instrument: Add event 'guest_cpu_enter'... Checking PATCH 13/22: instrument: Support synchronous modification of vCPU state... Checking PATCH 14/22: exec: Add function to synchronously flush TB on a stopped vCPU... Checking PATCH 15/22: instrument: Add event 'guest_cpu_exit'... Checking PATCH 16/22: instrument: Add event 'guest_cpu_reset'... Checking PATCH 17/22: trace: Introduce a proper structure to describe memory accesses... ERROR: spaces prohibited around that ':' (ctx:WxW) #244: FILE: trace/mem.h:29: + uint8_t size_shift : 2; ^ ERROR: spaces prohibited around that ':' (ctx:VxW) #245: FILE: trace/mem.h:30: + bool sign_extend: 1; ^ ERROR: spaces prohibited around that ':' (ctx:WxW) #246: FILE: trace/mem.h:31: + uint8_t endianness : 1; ^ ERROR: spaces prohibited around that ':' (ctx:WxW) #247: FILE: trace/mem.h:32: + bool store : 1; ^ total: 4 errors, 0 warnings, 227 lines checked Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. Checking PATCH 18/22: instrument: Add event 'guest_mem_before_trans'... ERROR: spaces prohibited around that ':' (ctx:WxW) #302: FILE: instrument/qemu-instr/types.h:64: + uint8_t size_shift : 2; ^ ERROR: spaces prohibited around that ':' (ctx:VxW) #303: FILE: instrument/qemu-instr/types.h:65: + bool sign_extend: 1; ^ ERROR: spaces prohibited around that ':' (ctx:WxW) #304: FILE: instrument/qemu-instr/types.h:66: + uint8_t endianness : 1; ^ ERROR: spaces prohibited around that ':' (ctx:WxW) #305: FILE: instrument/qemu-instr/types.h:67: + bool store : 1; ^ ERROR: spaces prohibited around that ':' (ctx:WxW) #430: FILE: trace/control.h:37: + uint8_t size_shift : 2; ^ ERROR: spaces prohibited around that ':' (ctx:VxW) #431: FILE: trace/control.h:38: + bool sign_extend: 1; ^ ERROR: spaces prohibited around that ':' (ctx:WxW) #432: FILE: trace/control.h:39: + uint8_t endianness : 1; ^ ERROR: spaces prohibited around that ':' (ctx:WxW) #433: FILE: trace/control.h:40: + bool store : 1; ^ total: 8 errors, 0 warnings, 389 lines checked Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. Checking PATCH 19/22: instrument: Add event 'guest_mem_before_exec'... ERROR: externs should be avoided in .c files #339: FILE: stubs/instrument.c:59: +void helper_instr_guest_mem_before_exec( total: 1 errors, 0 warnings, 260 lines checked Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. Checking PATCH 20/22: instrument: Add event 'guest_user_syscall'... Checking PATCH 21/22: instrument: Add event 'guest_user_syscall_ret'... Checking PATCH 22/22: instrument: Add API to manipulate guest memory... WARNING: architecture specific defines should be avoided #41: FILE: instrument/qemu-instr/state.h:13: +#ifdef __cplusplus WARNING: architecture specific defines should be avoided #128: FILE: instrument/qemu-instr/state.h:100: +#ifdef __cplusplus total: 0 errors, 2 warnings, 181 lines checked Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. === OUTPUT END === Test command exited with code: 1 --- Email generated automatically by Patchew [http://patchew.org/]. Please send your feedback to patchew-devel@freelists.org
On Wed, Sep 13, 2017 at 12:53:43 +0300, Lluís Vilanova wrote: > The instrumentation code is dynamically loaded as a library into QEMU either > when it starts or later using its remote control interfaces. The loaded code > only has access to function explicitly exported through the QI_VPUBLIC macro. > > This series is branch 'devel-instrument' in > https://code.gso.ac.upc.edu/git/qemu-dbi. Is this up to date? That tree doesn't build for me with --enable-instrument; I get the same error I got in v4: CC x86_64-linux-user/instrument/state.o /data/src/qemu2/instrument/trace.c:13:30: fatal error: qemu-instr/trace.h: No such file or directory compilation terminated. /data/src/qemu2/rules.mak:66: recipe for target 'instrument/trace.o' failed Or maybe I'm doing something wrong? I'm configuring with `configure --target-list=x86_64-linux-user --enable-instrument'. Thanks, Emilio
Emilio G Cota writes: > On Wed, Sep 13, 2017 at 12:53:43 +0300, Lluís Vilanova wrote: >> The instrumentation code is dynamically loaded as a library into QEMU either >> when it starts or later using its remote control interfaces. The loaded code >> only has access to function explicitly exported through the QI_VPUBLIC macro. >> >> This series is branch 'devel-instrument' in >> https://code.gso.ac.upc.edu/git/qemu-dbi. > Is this up to date? That tree doesn't build for me with --enable-instrument; I > get the same error I got in v4: > CC x86_64-linux-user/instrument/state.o > /data/src/qemu2/instrument/trace.c:13:30: fatal error: qemu-instr/trace.h: No such file or directory > compilation terminated. > /data/src/qemu2/rules.mak:66: recipe for target 'instrument/trace.o' failed > Or maybe I'm doing something wrong? > I'm configuring with `configure --target-list=x86_64-linux-user --enable-instrument'. You're doing it right, and I've checked that the branch is properly pushed. Can you compile with V=1 to show me the failing cmdline? Thanks, Lluis
On Mon, Sep 25, 2017 at 21:07:45 +0300, Lluís Vilanova wrote: > You're doing it right, and I've checked that the branch is properly pushed. Can > you compile with V=1 to show me the failing cmdline? $ make V=1 (cd /data/src/qemu2; printf '#define QEMU_PKGVERSION '; if test -n ""; then printf '""\n'; else if test -d .git; then printf '" ('; git describe --match 'v*' 2>/dev/null | tr -d '\n'; if ! git diff-index --quiet HEAD &>/dev/null; then printf -- '-dirty'; fi; printf ')"\n'; else printf '""\n'; fi; fi) > qemu-version.h.tmp if ! cmp -s qemu-version.h qemu-version.h.tmp; then mv qemu-version.h.tmp qemu-version.h; else rm qemu-version.h.tmp; fi make -I/data/src/qemu2/dtc VPATH=/data/src/qemu2/dtc -C dtc V="1" LIBFDT_srcdir=/data/src/qemu2/dtc/libfdt CPPFLAGS="-I/data/src/qemu2/build/dtc -I/data/src/qemu2/dtc -I/data/src/qemu2/dtc/libfdt" CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g -fvisibility=hidden -I/usr/include/pixman-1 -I/data/src/qemu2/dtc/libfdt -Werror -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wendif-labels -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/libpng12 -I/data/src/qemu2/tests" LDFLAGS="-rdynamic -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g " ARFLAGS="rv" CC="cc" AR="ar" LD="ld" BUILD_DIR=/data/src/qemu2/build libfdt/libfdt.a make[1]: Entering directory '/data/src/qemu2/build/dtc' make[1]: 'libfdt/libfdt.a' is up to date. make[1]: Leaving directory '/data/src/qemu2/build/dtc' make BUILD_DIR=/data/src/qemu2/build -C x86_64-linux-user V="1" TARGET_DIR="x86_64-linux-user/" all make[1]: Entering directory '/data/src/qemu2/build/x86_64-linux-user' cc -I/data/src/qemu2/build/. -I. -I/data/src/qemu2/tcg -I/data/src/qemu2/tcg/i386 -I/data/src/qemu2/instrument -I/data/src/qemu2/linux-headers -I/data/src/qemu2/build/linux-headers -I. -I/data/src/qemu2 -I/data/src/qemu2/accel/tcg -I/data/src/qemu2/include -fvisibility=hidden -I/usr/include/pixman-1 -I/data/src/qemu2/dtc/libfdt -Werror -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wendif-labels -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/libpng12 -I../linux-headers -I.. -I/data/src/qemu2/target/i386 -DNEED_CPU_H -I/data/src/qemu2/include -I/data/src/qemu2/linux-user/x86_64 -I/data/src/qemu2/linux-user/host/x86_64 -I/data/src/qemu2/linux-user -MMD -MP -MT gdbstub-xml.o -MF ./gdbstub-xml.d -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g -DQEMU_TARGET_BUILD=1 -c -o gdbstub-xml.o gdbstub-xml.c cc -I/data/src/qemu2/build/instrument -Iinstrument -I/data/src/qemu2/tcg -I/data/src/qemu2/tcg/i386 -I/data/src/qemu2/instrument -I/data/src/qemu2/linux-headers -I/data/src/qemu2/build/linux-headers -I. -I/data/src/qemu2 -I/data/src/qemu2/accel/tcg -I/data/src/qemu2/include -fvisibility=hidden -I/usr/include/pixman-1 -I/data/src/qemu2/dtc/libfdt -Werror -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wendif-labels -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/libpng12 -I../linux-headers -I.. -I/data/src/qemu2/target/i386 -DNEED_CPU_H -I/data/src/qemu2/include -I/data/src/qemu2/linux-user/x86_64 -I/data/src/qemu2/linux-user/host/x86_64 -I/data/src/qemu2/linux-user -MMD -MP -MT instrument/trace.o -MF instrument/trace.d -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g -DQEMU_TARGET_BUILD=1 -c -o instrument/trace.o /data/src/qemu2/instrument/trace.c /data/src/qemu2/instrument/trace.c:13:30: fatal error: qemu-instr/trace.h: No such file or directory compilation terminated. /data/src/qemu2/rules.mak:66: recipe for target 'instrument/trace.o' failed make[1]: *** [instrument/trace.o] Error 1 make[1]: Leaving directory '/data/src/qemu2/build/x86_64-linux-user' Makefile:326: recipe for target 'subdir-x86_64-linux-user' failed make: *** [subdir-x86_64-linux-user] Error 2 Thanks, Emilio
Emilio G Cota writes: > On Mon, Sep 25, 2017 at 21:07:45 +0300, Lluís Vilanova wrote: >> You're doing it right, and I've checked that the branch is properly pushed. Can >> you compile with V=1 to show me the failing cmdline? > $ make V=1 > (cd /data/src/qemu2; printf '#define QEMU_PKGVERSION '; if test -n ""; then > printf '""\n'; else if test -d .git; then printf '" ('; git describe --match > 'v*' 2>/dev/null | tr -d '\n'; if ! git diff-index --quiet HEAD &>/dev/null; > then printf -- '-dirty'; fi; printf ')"\n'; else printf '""\n'; fi; fi) > > qemu-version.h.tmp > if ! cmp -s qemu-version.h qemu-version.h.tmp; then mv qemu-version.h.tmp qemu-version.h; else rm qemu-version.h.tmp; fi > make -I/data/src/qemu2/dtc VPATH=/data/src/qemu2/dtc -C dtc V="1" > LIBFDT_srcdir=/data/src/qemu2/dtc/libfdt CPPFLAGS="-I/data/src/qemu2/build/dtc > -I/data/src/qemu2/dtc -I/data/src/qemu2/dtc/libfdt" CFLAGS="-O2 > -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g -fvisibility=hidden > -I/usr/include/pixman-1 -I/data/src/qemu2/dtc/libfdt -Werror -pthread > -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fPIE -DPIE > -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE > -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings > -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wendif-labels > -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security > -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration > -Wold-style-definition -Wtype-limits -fstack-protector-strong > -I/usr/include/libpng12 -I/data/src/qemu2/tests" LDFLAGS="-rdynamic > -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g " ARFLAGS="rv" CC="cc" > AR="ar" LD="ld" BUILD_DIR=/data/src/qemu2/build libfdt/libfdt.a > make[1]: Entering directory '/data/src/qemu2/build/dtc' > make[1]: 'libfdt/libfdt.a' is up to date. > make[1]: Leaving directory '/data/src/qemu2/build/dtc' > make BUILD_DIR=/data/src/qemu2/build -C x86_64-linux-user V="1" TARGET_DIR="x86_64-linux-user/" all > make[1]: Entering directory '/data/src/qemu2/build/x86_64-linux-user' > cc -I/data/src/qemu2/build/. -I. -I/data/src/qemu2/tcg > -I/data/src/qemu2/tcg/i386 -I/data/src/qemu2/instrument > -I/data/src/qemu2/linux-headers -I/data/src/qemu2/build/linux-headers > -I. -I/data/src/qemu2 -I/data/src/qemu2/accel/tcg -I/data/src/qemu2/include > -fvisibility=hidden -I/usr/include/pixman-1 -I/data/src/qemu2/dtc/libfdt -Werror > -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include > -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE > -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings > -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wendif-labels > -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security > -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration > -Wold-style-definition -Wtype-limits -fstack-protector-strong > -I/usr/include/libpng12 -I../linux-headers -I.. -I/data/src/qemu2/target/i386 > -DNEED_CPU_H -I/data/src/qemu2/include -I/data/src/qemu2/linux-user/x86_64 > -I/data/src/qemu2/linux-user/host/x86_64 -I/data/src/qemu2/linux-user -MMD -MP > -MT gdbstub-xml.o -MF ./gdbstub-xml.d -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 > -g -DQEMU_TARGET_BUILD=1 -c -o gdbstub-xml.o gdbstub-xml.c > cc -I/data/src/qemu2/build/instrument -Iinstrument -I/data/src/qemu2/tcg > -I/data/src/qemu2/tcg/i386 -I/data/src/qemu2/instrument > -I/data/src/qemu2/linux-headers -I/data/src/qemu2/build/linux-headers > -I. -I/data/src/qemu2 -I/data/src/qemu2/accel/tcg -I/data/src/qemu2/include > -fvisibility=hidden -I/usr/include/pixman-1 -I/data/src/qemu2/dtc/libfdt -Werror > -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include > -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE > -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings > -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wendif-labels > -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security > -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration > -Wold-style-definition -Wtype-limits -fstack-protector-strong > -I/usr/include/libpng12 -I../linux-headers -I.. -I/data/src/qemu2/target/i386 > -DNEED_CPU_H -I/data/src/qemu2/include -I/data/src/qemu2/linux-user/x86_64 > -I/data/src/qemu2/linux-user/host/x86_64 -I/data/src/qemu2/linux-user -MMD -MP > -MT instrument/trace.o -MF instrument/trace.d -O2 -U_FORTIFY_SOURCE > -D_FORTIFY_SOURCE=2 -g -DQEMU_TARGET_BUILD=1 -c -o instrument/trace.o > /data/src/qemu2/instrument/trace.c > /data/src/qemu2/instrument/trace.c:13:30: fatal error: qemu-instr/trace.h: No such file or directory > compilation terminated. > /data/src/qemu2/rules.mak:66: recipe for target 'instrument/trace.o' failed > make[1]: *** [instrument/trace.o] Error 1 > make[1]: Leaving directory '/data/src/qemu2/build/x86_64-linux-user' > Makefile:326: recipe for target 'subdir-x86_64-linux-user' failed > make: *** [subdir-x86_64-linux-user] Error 2 The includes look fine to me... (there's "-I/data/src/qemu2/instrument"). Can you paste the result of "find /data/src/qemu2/instrument"? You should have a "/data/src/qemu2/instrument/qemu-instr/trace.h" file there. In any case, I was planning to drop the tracing API for the next series. Thanks, Lluis
This series adds an API to add instrumentation events. It also provides additional APIs for: * Controlling tracing events. * Peek/poke guest memory. TODO: * Replace qi_event_gen_* with generating calls to arbitrary functions (e.g., qi_event_gen_call(num_args, va_list)). * Flush all TBs when an execution-time event is unset (to ensure it won't be called in the future). * Flush all TBs when a translation-time event is set (to ensure no future events will be lost). Undecided: * Alternatively to the two last points above, provide an API to request a TB flush (much more flexible and can be more efficient, but requires instrumentor to clearly know differences between translation and execution). * Pass a user-provided pointer to events (i.e., to avoid using global variables). * Provide something like tracing's per-vCPU trace states (i.e., so that each vCPU can have different instrumentation code). Useful mainly for sampling (enable/disable instrumentation multiple times without re-translating guest code) and more complex use cases like tracing a guest process in softmmu mode. It's still not clear to me if we should extend the per-vCPU bitmap with instrumentation events, or otherwise somehow reuse the bits in tracing events (since they're currently limited). * Allow multiple callbacks per event (both to support multiple callbacks installed by a library, and multiple libraries at the same time). * Allow instr libraries to iterate on the list of guest CPUs (info is already available through guest_cpu_enter/guest_cpu_exit, but forces libs to be prepared for hot-plugging guest CPUs). Future APIs (for later series): * Peek/poke guest registers. * Add breakpoints to trigger instrumentation functions. * Trigger instrumentation functions from guest code (former hypertrace). * Add events for guest code translation/execution (once the respective tracing events are accepted upstream). * Add events for exceptions/syscalls. * Add events for TB invalidation (necessary for libraries to deallocate any data they might have allocated for the TBs they instrumented). The instrumentation code is dynamically loaded as a library into QEMU either when it starts or later using its remote control interfaces. The loaded code only has access to function explicitly exported through the QI_VPUBLIC macro. This series is branch 'devel-instrument' in https://code.gso.ac.upc.edu/git/qemu-dbi. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> --- Changes in v6 ============= * Fix a minor style warning. * Fix a minor compilation error. Changes in v5 ============= * Rebase on fcea73709b. * Minor changes to pass checkpatch. * Fix symbol availability to external libraries by adding missing default symbol visibility flag. * Use a string to identify instrumentation handles [Markus Armbruster]. * Use stubs for command line initialization. * Use stubs to signal unsupported QAPI commands [Markus Armbruster]. * Use error messages instead of codes in QAPI commands [Markus Armbruster]. * Move symbol visibility macros to internal "qemu/compiler.h" header. * Trigger event 'guest_cpu_enter' when library is loaded. * Trigger event 'guest_cpu_exit' and flush TBs when library is unloaded. * Rename instr_cpu_get/instr_cpu_set into clearer instr_cpu_to_qicpu/instr_cpu_from_qicpu. * Rename handle_get/handle_put to clearer handle_new/handle_destroy. * Ensure qi_event_set_* are called only on the proper mode and targets. Changes in v4 ============= * Add missing stub function. Changes in v3 ============= * Use a separate event set for instrumentation (i.e., do not instrument tracing events) [Stefan Hajnoczi]. * Add API for peek/poke guest memory. Changes in v2 ============= * Update QEMU version in QAPI [Eric Blake]. * Clarify 'msg' result in QAPI is for humans only. * Make 'msg' and 'handle' results optional in QAPI. * Use a list of 'str' in 'instr-load' QAPI command. * Update MAINTAINERS. * Add macros for error-reporting in API. Lluís Vilanova (22): instrument: Add documentation instrument: Add configure-time flag instrument: Add generic library loader instrument: [linux-user] Add command line library loader instrument: [bsd-user] Add command line library loader instrument: [softmmu] Add command line library loader instrument: [qapi] Add library loader instrument: [hmp] Add library loader instrument: Add basic control interface instrument: Add support for tracing events instrument: Track vCPUs instrument: Add event 'guest_cpu_enter' instrument: Support synchronous modification of vCPU state exec: Add function to synchronously flush TB on a stopped vCPU instrument: Add event 'guest_cpu_exit' instrument: Add event 'guest_cpu_reset' trace: Introduce a proper structure to describe memory accesses instrument: Add event 'guest_mem_before_trans' instrument: Add event 'guest_mem_before_exec' instrument: Add event 'guest_user_syscall' instrument: Add event 'guest_user_syscall_ret' instrument: Add API to manipulate guest memory .gitignore | 1 MAINTAINERS | 8 + Makefile | 8 + Makefile.objs | 4 + Makefile.target | 1 accel/stubs/tcg-stub.c | 3 accel/tcg/translate-all.c | 7 + bsd-user/main.c | 17 ++ bsd-user/syscall.c | 14 ++ configure | 13 ++ cpus-common.c | 9 + docs/instrument.txt | 173 ++++++++++++++++++++++ hmp-commands.hx | 32 ++++ include/exec/cpu_ldst_template.h | 19 +- include/exec/cpu_ldst_useronly_template.h | 19 +- include/exec/exec-all.h | 1 include/exec/helper-gen.h | 1 include/exec/helper-proto.h | 1 include/exec/helper-tcg.h | 1 include/qemu/compiler.h | 19 ++ instrument/Makefile.objs | 8 + instrument/cmdline.c | 128 ++++++++++++++++ instrument/cmdline.h | 51 ++++++ instrument/control.c | 228 +++++++++++++++++++++++++++++ instrument/control.h | 153 +++++++++++++++++++ instrument/control.inc.h | 67 +++++++++ instrument/error.h | 34 ++++ instrument/events.h | 86 +++++++++++ instrument/events.inc.h | 109 ++++++++++++++ instrument/helpers.h | 2 instrument/load.c | 210 +++++++++++++++++++++++++++ instrument/load.h | 88 +++++++++++ instrument/qemu-instr/control.h | 177 +++++++++++++++++++++++ instrument/qemu-instr/state.h | 104 +++++++++++++ instrument/qemu-instr/types.h | 115 +++++++++++++++ instrument/qemu-instr/types.inc.h | 15 ++ instrument/qmp.c | 82 ++++++++++ instrument/state.c | 73 +++++++++ instrument/trace.c | 125 ++++++++++++++++ linux-user/main.c | 21 +++ linux-user/syscall.c | 7 + monitor.c | 43 +++++ qapi-schema.json | 3 qapi/instrument.json | 49 ++++++ qemu-options.hx | 19 ++ qom/cpu.c | 2 stubs/Makefile.objs | 1 stubs/instrument.c | 73 +++++++++ tcg/tcg-op.c | 27 ++- trace/control-target.c | 2 trace/control.c | 4 - trace/control.h | 24 +++ trace/mem-internal.h | 22 ++- trace/mem.h | 8 + vl.c | 15 ++ 55 files changed, 2486 insertions(+), 40 deletions(-) create mode 100644 docs/instrument.txt create mode 100644 instrument/Makefile.objs create mode 100644 instrument/cmdline.c create mode 100644 instrument/cmdline.h create mode 100644 instrument/control.c create mode 100644 instrument/control.h create mode 100644 instrument/control.inc.h create mode 100644 instrument/error.h create mode 100644 instrument/events.h create mode 100644 instrument/events.inc.h create mode 100644 instrument/helpers.h create mode 100644 instrument/load.c create mode 100644 instrument/load.h create mode 100644 instrument/qemu-instr/control.h create mode 100644 instrument/qemu-instr/state.h create mode 100644 instrument/qemu-instr/types.h create mode 100644 instrument/qemu-instr/types.inc.h create mode 100644 instrument/qmp.c create mode 100644 instrument/state.c create mode 100644 instrument/trace.c create mode 100644 qapi/instrument.json create mode 100644 stubs/instrument.c To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi <stefanha@redhat.com> Cc: Emilio G. Cota <cota@braap.org> Cc: Eric Blake <eblake@redhat.com> Cc: Markus Armbruster <armbru@redhat.com>