summaryrefslogtreecommitdiff
path: root/trace
AgeCommit message (Collapse)AuthorFilesLines
2017-03-28trace: fix tcg tracing build breakageStefan Hajnoczi1-8/+8
Commit 0ab8ed18a6fe98bfc82705b0f041fbf2a8ca5b60 ("trace: switch to modular code generation for sub-directories") forgot to convert "tcg" trace events to the modular code generation approach where each sub-directory has its own trace-events file. This patch fixes compilation for "tcg" trace events. Currently they are only used in the root ./trace-events file. "tcg" trace events can only be used in the root ./trace-events file for the time being. Reported-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20170327131718.18268-1-stefanha@redhat.com Suggested-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-03-16trace: ensure $(tracetool-y) is defined in top level makefileDaniel P. Berrange1-8/+0
The build rules for trace files have a dependancy on $(tracetool-y). This variable populated in the trace/Makefile.objs file and thus its definition gets pulled into the top level makefile. This happens too late in the process though, so by the time $(tracetool-y) is defined, make has already evaluated $(tracetool-y) in the dependancies and found it to be empty. The result is that when the tracetool source is changed, the generated files are not rebuilt. The solution is to define the variable in the top level makefile too Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Eric Blake <eblake@redhat.com> Message-id: 20170315123421.28815-1-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-01-31trace: switch to modular code generation for sub-directoriesDaniel P. Berrange5-93/+8
Introduce rules in the top level Makefile that are able to generate trace.[ch] files in every subdirectory which has a trace-events file. The top level directory is handled specially, so instead of creating trace.h, it creates trace-root.h. This allows sub-directories to include the top level trace-root.h file, without ambiguity wrt to the trace.g file in the current sub-dir. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20170125161417.31949-7-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-01-31trace: move setting of group name into MakefilesDaniel P. Berrange1-0/+9
Having tracetool.py figure out the right group name from just the input filename is not practical when considering the different build vs src path combinations. Instead simply take the group name as a command line arg from the Makefile, which can trivially provide the right name. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20170125161417.31949-6-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-01-16trace: Add event "guest_cpu_exit"Lluís Vilanova1-0/+3
Signals the hot-unplugging of a virtual (guest) CPU. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 148278748597.1404.10546320797997984932.stgit@fimbulvetr.bsc.es Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-01-16trace: Fix dynamic event state on vCPU hot-unplugLluís Vilanova2-0/+24
We need to disable per-vCPU events on a vCPU that is hot-unplugged to keep the dynamic event state global counters consistent. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 148278748055.1404.1570530281528619895.stgit@fimbulvetr.bsc.es Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-01-16trace: Lock vCPU list when initializing dynamic tracing stateLluís Vilanova1-1/+10
Fixes potential corruption when a vCPU is hot-(un)plugged while initializing the current one. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 148278747515.1404.6538173443841279200.stgit@fimbulvetr.bsc.es Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: pass trace-events to tracetool as a positional paramDaniel P. Berrange1-9/+9
Instead of reading the contents of 'trace-events' from stdin, accept the filename as a positional parameter. This also allows for reading from multiple files, though this facility is not used at this time. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-20-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: get rid of generated-events.h/generated-events.cDaniel P. Berrange3-29/+5
Currently the generated-events.[ch] files contain the event dstates, constants and TraceEvent structs, while the generated-tracers.[ch] files contain the actual trace probe logic. With the removal of usage of the event enums from the API there is no longer any compelling reason for the separation between these files. The generated-events.h content is only ever needed from the generated-tracers.[ch] files. The enums/constants/structs from generated-events.[ch] are thus moved into the generated-tracers.[ch], so that there is one less file to be generated. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-17-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: dynamically allocate event IDs at runtimeDaniel P. Berrange1-1/+10
Instead of having the code generator assign event IDs and event VCPU IDs, assign them when the events are registered at runtime. This will allow code to be generated from individual trace-events without having to figure out globally unique numbering at build time. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-16-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: dynamically allocate trace_dstate in CPUStateDaniel P. Berrange2-0/+12
The CPUState struct has a bitmap tracking which VCPU events are currently active. This is indexed based on the event ID values, and sized according the maximum TraceEventVCPUID enum value. When we start dynamically assigning IDs at runtime, we can't statically declare a bitmap without making an assumption about the max event count. This problem can be solved by dynamically allocating the per-CPU dstate bitmap. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-15-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: provide mechanism for registering trace eventsDaniel P. Berrange3-3/+27
Remove the notion of there being a single global array of trace events, by introducing a method for registering groups of events. The module_call_init() needs to be invoked at the start of any program that wants to make use of the trace support. Currently this covers system emulators qemu-nbd, qemu-img and qemu-io. [Squashed the following fix from Daniel P. Berrange <berrange@redhat.com>: linux-user/bsd-user: initialize trace events subsystem The bsd-user/linux-user programs make use of the CPU emulation code and this now requires that the trace events subsystem is enabled, otherwise it'll crash trying to allocate an empty trace events bitmap for the CPU object. --Stefan] Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-14-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: don't abort qemu if ftrace can't be initializedDaniel P. Berrange1-0/+6
If the ftrace backend is compiled into QEMU, any attempt to start QEMU while non-root will fail due to the inability to open /sys/kernel/debug/tracing/tracing_on. Add a fallback into the code so that it connects up the trace_marker_fd variable to /dev/null when getting EACCES on the 'trace_on' file. This allows QEMU to run, with ftrace turned into a no-op. [Fixed s/setting/getting/ and s/EACCESS/EACCES/ errors pointed out by Eric Blake <eblake@redhat.com>. --Stefan] Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-13-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: emit name <-> ID mapping in simpletrace headerDaniel P. Berrange1-2/+31
Currently simpletrace assumes that events are given IDs starting from 0, based on the order in which they appear in the trace-events file, with no gaps. When the trace-events file is split up, this assumption becomes problematic. To deal with this, extend the simpletrace format so that it outputs a table of event name <-> ID mappings. That will allow QEMU to assign arbitrary IDs to events without breaking simpletrace parsing. The v3 simple trace format was FILE HEADER EVENT TRACE RECORD 0 EVENT TRACE RECORD 1 ... EVENT TRACE RECORD N The v4 simple trace format is now FILE HEADER EVENT MAPPING RECORD 0 EVENT MAPPING RECORD 1 ... EVENT MAPPING RECORD M EVENT TRACE RECORD RECORD 0 EVENT TRACE RECORD RECORD 1 ... EVENT TRACE RECORD N Although this shows all the mapping records being emitted upfront, this is not required by the format. While the main simpletrace backend will emit all mappings at startup, the systemtap simpletrace.stp script will emit the mappings at first use. eg FILE HEADER ... EVENT MAPPING RECORD 0 EVENT TRACE RECORD RECORD 0 EVENT TRACE RECORD RECORD 1 EVENT MAPPING RECORD 1 EVENT TRACE RECORD RECORD 2 ... EVENT TRACE RECORD N This is more space efficient given that most trace records only include a subset of events. In modifying the systemtap simpletrace code, a 'begin' probe was added to emit the trace event header, so you no longer need to add '--no-header' when running simpletrace.py for systemtap generated trace files. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-12-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: remove the TraceEventID and TraceEventVCPUID enumsDaniel P. Berrange7-39/+32
The TraceEventID and TraceEventVCPUID enums constants are no longer actually used for anything critical. The TRACE_EVENT_COUNT limit is used to determine the size of the TraceEvents array, and can be removed if we just NULL terminate the array instead. The TRACE_VCPU_EVENT_COUNT limit is used as a magic value for marking non-vCPU events, and also for declaring the size of the trace dstate mask in the CPUState struct. The former usage can be replaced by a dedicated constant TRACE_EVENT_VCPU_NONE, defined as (uint32_t)-1. For the latter usage, we can simply define a constant for the number of VCPUs, avoiding the need for the full enum. The only other usages of the enum values can be replaced by accesing the id/vcpu_id fields via the named TraceEvent structs. Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-11-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: give each trace event a named TraceEvent structDaniel P. Berrange2-2/+2
Currently we only expose a TraceEvent array, which must be indexed via the TraceEventID enum constants. This changes the generator to expose a named TraceEvent instance for each event, with an _EVENT suffix. Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-10-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: break circular dependency in event-internal.hDaniel P. Berrange1-5/+2
Currently event-internal.h includes generated-events.h, while generated-events.h includes event-internal.h causing a circular dependency. event-internal.h requires that the content of generated-events.h comes first, so that it can see the typedefs for TraceEventID and TraceEventVCPUID. Switching the TraceEvent struct to use uint32_t for the two ID fields removes the dependency on the typedef, allowing events-internal.h to be a self-contained header. This will then let the patch following this move event-internal.h to the top of generated-events.h, so we can expose TraceEvent struct variables in generated-events.h Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-9-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: remove global 'uint16 dstate[]' arrayDaniel P. Berrange4-31/+21
Instead of having a global dstate array, declare a single 'uint16 TRACE_${EVENT_NAME}_DSTATE' variable for each trace event. Record a pointer to this variable in the TraceEvent struct too. By turning trace_event_get_state_dynamic_by_id into a macro, this still hits the fast path, and cache affinity is ensured by declaring all the uint16 vars adjacent to each other. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-7-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: remove some now unused functionsDaniel P. Berrange3-90/+0
The trace_event_count, trace_event_id and trace_event_pattern methods are no longer required now that everything is using the iterator APIs The trace_event_set_state and trace_event_set_vcpu_state macros were also unused. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-6-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: convert code to use event iteratorsDaniel P. Berrange3-46/+55
This converts the HMP/QMP monitor API implementations and some internal trace control methods to use the new trace event iterator APIs. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 1475588159-30598-5-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: add trace event iterator APIsDaniel P. Berrange2-0/+48
Currently methods which want to iterate over trace events, do so using the trace_event_count() and trace_event_id() methods. This leaks the concept of a single ID enum to the callers. There is an alternative trace_event_pattern() method which can be used in an iteration context, but its design is stateless, so is not easy to expand it in the future. This defines a formal iterator API will provide a future- proof way of iterating over events. The iterator is also able to apply a pattern match filter to events, further removing the need for the pattern Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-4-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-06rules.mak: quiet-command: Split command name and args to printPeter Maydell1-12/+12
The quiet-command make rule currently takes two arguments: the command and arguments to run, and a string to print if the V flag is not set (ie we are not being verbose). By convention, the string printed is of the form " NAME some args". Unfortunately to get nicely lined up output all the strings have to agree about what column the arguments should start in, which means that if we add a new quiet-command usage which wants a slightly longer CMD name then we either put up with misalignment or change every quiet-command string. Split the quiet-mode string into two, the "NAME" and the "same args" part, and use printf(1) to format the string automatically. This means we only need to change one place if we want to support a longer maximum name. In particular, we can now print 7-character names lined up properly (they are needed for the OSX "SETTOOL" invocation). Change all the uses of quiet-command to the new syntax. (Any which are missed or inadvertently reintroduced via later merges will result in slightly misformatted quiet output rather than disaster.) A few places in the pc-bios/ makefiles are updated to use "BUILD", "SIGN" and "STRIP" rather than "Building", "Signing" and "Stripping" for consistency and to keep them below 7 characters. Module .mo links now print "LD" rather than the nonstandard "LD -r". Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1475598441-27908-1-git-send-email-peter.maydell@linaro.org
2016-09-28trace: Add event "guest_cpu_enter"Lluís Vilanova1-0/+3
Signals the hot-plugging of a new virtual (guest) CPU. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 147428971313.15111.18023030883528426840.stgit@fimbulvetr.bsc.es Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-09-28trace: Properly initialize dynamic event states in hot-plugged vCPUsLluís Vilanova3-30/+45
Every time a vCPU is hot-plugged, it will "inherit" its tracing state from the global state array. That is, if *any* existing vCPU has an event enabled, new vCPUs will have too. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 147428970768.15111.7664565956870423529.stgit@fimbulvetr.bsc.es Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-09-05trace: Avoid implicit bool->integer conversionsLluís Vilanova1-5/+26
An explicit if/else is clearer than arithmetic assuming #true is 1, while the compiler should be able to generate just as optimal code. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 147194273830.26836.5875729707953474838.stgit@fimbulvetr.bsc.es Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-09-05trace: Remove 'trace_events_dstate_init'Lluís Vilanova4-11/+23
Removes the event state array used for early initialization. Since only events with the "vcpu" property need a late initialization fixup, threats their initialization specially. Assumes that the user won't touch the state of "vcpu" events between early and late initialization (e.g., through QMP). Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 147194273191.26836.14423079546263831356.stgit@fimbulvetr.bsc.es Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-09-05trace: add syslog tracing backendPaul Durrant1-0/+7
This patch adds a tracing backend which sends output using syslog(). The syslog backend is limited to POSIX compliant systems. openlog() is called with facility set to LOG_DAEMON, with the LOG_PID option. Trace events are logged at level LOG_INFO. Signed-off-by: Paul Durrant <paul.durrant@citrix.com> Message-id: 1470318254-29989-1-git-send-email-paul.durrant@citrix.com Cc: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-07-18trace: Add QAPI/QMP interfaces to query and control per-vCPU tracing stateLluís Vilanova1-29/+119
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-07-18trace: Add per-vCPU tracing states for events with the 'vcpu' propertyLluís Vilanova5-10/+168
Each vCPU gets a 'trace_dstate' bitmap to control the per-vCPU dynamic tracing state of events with the 'vcpu' property. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-07-18trace: Cosmetic changes on fast-path tracingLluís Vilanova1-2/+5
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-07-18trace: Identify events with the 'vcpu' propertyLluís Vilanova3-2/+31
A new event attribute 'cpu_id' is added to have a separate ID space ('TRACE_VCPU_*') for all events with the 'vcpu' property. These are later used to identify which events are enabled on each vCPU. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-07-12Clean up decorations and whitespace around header guardsMarkus Armbruster6-10/+6
Cleaned up with scripts/clean-header-guards.pl. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2016-06-28trace: move qemu_trace_opts to trace/control.cDenis V. Lunev2-12/+55
The patch also creates trace_opt_parse() helper in trace/control.c to reuse this code in next patches for qemu-nbd and qemu-io. The patch also makes trace_init_events() static, as this call is not used outside the module anymore. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1466174654-30130-4-git-send-email-den@openvz.org CC: Paolo Bonzini <pbonzini@redhat.com> CC: Stefan Hajnoczi <stefanha@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-06-20Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' ↵Peter Maydell3-11/+94
into staging # gpg: Signature made Mon 20 Jun 2016 21:29:27 BST # gpg: using RSA key 0x9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha/tags/tracing-pull-request: (42 commits) trace: split out trace events for linux-user/ directory trace: split out trace events for qom/ directory trace: split out trace events for target-ppc/ directory trace: split out trace events for target-s390x/ directory trace: split out trace events for target-sparc/ directory trace: split out trace events for net/ directory trace: split out trace events for audio/ directory trace: split out trace events for ui/ directory trace: split out trace events for hw/alpha/ directory trace: split out trace events for hw/arm/ directory trace: split out trace events for hw/acpi/ directory trace: split out trace events for hw/vfio/ directory trace: split out trace events for hw/s390x/ directory trace: split out trace events for hw/pci/ directory trace: split out trace events for hw/ppc/ directory trace: split out trace events for hw/9pfs/ directory trace: split out trace events for hw/i386/ directory trace: split out trace events for hw/isa/ directory trace: split out trace events for hw/sd/ directory trace: split out trace events for hw/sparc/ directory ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-20trace: add build framework for merging trace-events filesDaniel P. Berrange1-11/+14
Switch make rules over to use trace-events-all as the master trace events input file. Add rule that will construct trace-events-all from $(trace-events-y). Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1466066426-16657-2-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-06-20trace: [all] Add "guest_mem_before" eventLluís Vilanova2-0/+80
The event is described in "trace-events". Note that the "MO_AMASK" flag is not traced, since it does not seem to affect the visible semantics of instructions. [s/inline inline/inline/ to fix clang build. --Stefan] Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 146549350711.18437.726780393247474362.stgit@fimbulvetr.bsc.es Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-06-20log: Fix qemu_set_log_filename() error handlingMarkus Armbruster1-1/+2
When qemu_set_log_filename() detects an invalid file name, it reports an error, closes the log file (if any), and starts logging to stderr (unless daemonized or nothing is being logged). This is wrong. Asking for an invalid log file on the command line should be fatal. Asking for one in the monitor should fail without messing up an existing logfile. Fix by converting qemu_set_log_filename() to Error. Pass it &error_fatal, except for hmp_logfile report errors. This also permits testing without a subprocess, so do that. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1466011636-6112-4-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2016-05-18Fix some typos found by codespellStefan Weil1-2/+2
Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-03-31trace: do not always call exit() in trace_enable_eventsDenis V. Lunev1-1/+4
The problem is that virsh qemu-monitor-command --hmp VM log trace:help forces QEMU to exit even when running VM normally. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1458128212-4197-2-git-send-email-den@openvz.org CC: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-03-22util: move declarations out of qemu-common.hVeronia Bahaa1-0/+1
Move declarations out of qemu-common.h for functions declared in utils/ files: e.g. include/qemu/path.h for utils/path.c. Move inline functions out of qemu-common.h and into new files (e.g. include/qemu/bcd.h) Signed-off-by: Veronia Bahaa <veroniabahaa@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-22Use scripts/clean-includes to drop redundant qemu/typedefs.hMarkus Armbruster2-2/+0
Re-run scripts/clean-includes to apply the previous commit's corrections and updates. Besides redundant qemu/typedefs.h, this only finds a redundant config-host.h include in ui/egl-helpers.c. No idea how that escaped the previous runs. Some manual whitespace trimming around dropped includes squashed in. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-01trace: Add 'vcpu' event property to trace guest vCPULluís Vilanova1-1/+2
This property identifies events that trace vCPU-specific information. It adds a "CPUState*" argument to events with the property, identifying the vCPU raising the event. TCG translation events also have a "TCGv_env" implicit argument that is later used as the "CPUState*" argument at execution time. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 145641861797.30295.6991314023181842105.stgit@localhost Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-02-23all: Clean up includesPeter Maydell3-5/+0
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com>
2016-02-04all: Clean up includesPeter Maydell4-9/+4
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1454089805-5470-16-git-send-email-peter.maydell@linaro.org
2016-02-03trace: convert stderr backend to logPaolo Bonzini1-0/+10
[Also update .travis.yml --enable-trace-backends=stderr --Stefan] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Message-id: 1452174932-28657-10-git-send-email-den@openvz.org Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-02-03trace: add "-trace help"Paolo Bonzini2-1/+27
Print a list of trace points Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Message-id: 1452174932-28657-7-git-send-email-den@openvz.org Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-02-03trace: add "-trace enable=..."Paolo Bonzini2-21/+36
Allow enabling events without going through a file, for example: qemu-system-x86_64 -trace bdrv_aio_writev -trace bdrv_aio_readv or with globbing too: qemu-system-x86_64 -trace 'bdrv_aio_*' if an appropriate backend is enabled (simple, stderr, ftrace). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Message-id: 1452174932-28657-6-git-send-email-den@openvz.org Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-02-03trace: split trace_init_file out of trace_init_backendsPaolo Bonzini4-12/+28
This is cleaner, and improves error reporting with -daemonize. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Message-id: 1452174932-28657-4-git-send-email-den@openvz.org Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-02-03trace: split trace_init_events out of trace_init_backendsPaolo Bonzini2-6/+14
This is cleaner and has two advantages. First, it improves error reporting with -daemonize. Second, multiple "-trace events" options now cumulate. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Message-id: 1452174932-28657-3-git-send-email-den@openvz.org Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-02-03trace: track enabled events in a separate arrayPaolo Bonzini4-7/+13
This is more cache friendly on the fast path, where we already have the event id available. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>