aboutsummaryrefslogtreecommitdiff
path: root/scripts
AgeCommit message (Collapse)Author
2016-10-27trace: Fix 'char **' compilation error in simple backendFam Zheng
Currently, the generated function body will do "strlen(arg)" but the argument could be 'char **' or 'char * const *'. Avoid that by excluding such cases in is_string check. Reported by patchew's "make docker-test-mingw@fedora". Suggested-by: Eric Blake <eblake@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1477453806-21097-1-git-send-email-famz@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-10-25qapi: rename QmpOutputVisitor to QObjectOutputVisitorDaniel P. Berrange
The QmpOutputVisitor has no direct dependency on QMP. It is valid to use it anywhere that one wants a QObject. Rename it to better reflect its functionality as a generic QAPI to QObject converter. The commit before previous renamed the files, this one renames C identifiers. Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1475246744-29302-6-git-send-email-berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Split into file rename and identifier rename] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-10-25qapi: rename QmpInputVisitor to QObjectInputVisitorDaniel P. Berrange
The QmpInputVisitor has no direct dependency on QMP. It is valid to use it anywhere that one has a QObject. Rename it to better reflect its functionality as a generic QObject to QAPI converter. The previous commit renamed the files, this one renames C identifiers. Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1475246744-29302-5-git-send-email-berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Straightforwardly rebased, split into file and identifier rename] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-10-25qapi: rename *qmp-*-visitor* to *qobject-*-visitor*Daniel P. Berrange
The QMP visitors have no direct dependency on QMP. It is valid to use them anywhere that one has a QObject. Rename them to better reflect their functionality as a generic QObject to QAPI converter. This is the first of three parts: rename the files. The next two parts will rename C identifiers. The split is necessary to make git rename detection work. Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Split into file and identifier rename, two comments touched up] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-10-12trace: introduce a formal group name for trace eventsDaniel P. Berrange
The declarations in the generated-tracers.h file are assuming there's only ever going to be one instance of this header, as they are not namespaced. When we have one header per event group, if a single source file needs to include multiple sets of trace events, the symbols will all clash. This change thus introduces a '--group NAME' arg to the 'tracetool' program. This will cause all the symbols in the generated header files to be given a unique namespace. If no group is given, the group name 'common' is used, which is suitable for the current usage where there is only one global trace-events file used for code generation. 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-21-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: pass trace-events to tracetool as a positional paramDaniel P. Berrange
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: push reading of events up a level to tracetool mainDaniel P. Berrange
Move the reading of events out of the 'tracetool.generate' method and into tracetool.main, so that the latter is not tied to generating from a single source of events. 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-19-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: rename _read_events to read_eventsDaniel P. Berrange
The _read_events method is used by callers outside of its module, so should be a public method, not private. 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-18-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. Berrange
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. Berrange
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: provide mechanism for registering trace eventsDaniel P. Berrange
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: emit name <-> ID mapping in simpletrace headerDaniel P. Berrange
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. Berrange
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. Berrange
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: remove duplicate control.h includes in generated-tracers.hDaniel P. Berrange
The format/h.py file adds an include for control.h to generated-tracers.h. ftrace, log and syslog, then add more duplicate includes for control.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-8-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-10-12trace: remove global 'uint16 dstate[]' arrayDaniel P. Berrange
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-07scripts: Allow block module to not define BlockDriverFam Zheng
Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1473043845-13197-2-git-send-email-famz@redhat.com Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-09-27checkpatch: downgrade "architecture specific defines should be avoided"Paolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-09-23Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into stagingPeter Maydell
* More KVM LAPIC fixes * fix divide-by-zero regression on libiscsi SG devices * fix qemu-char segfault * add scripts/show-fixed-bugs.sh # gpg: Signature made Thu 22 Sep 2016 19:20:57 BST # gpg: using RSA key 0xBFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: kvm: fix events.flags (KVM_VCPUEVENT_VALID_SMM) overwritten by 0 scripts: Add a script to check for bug URLs in the git log msmouse: Fix segfault caused by free the chr before chardev cleanup. iscsi: Fix divide-by-zero regression on raw SG devices kvm: apic: set APIC base as part of kvm_apic_put target-i386: introduce kvm_put_one_msr Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-09-22scripts: Add a script to check for bug URLs in the git logThomas Huth
Basic idea of this script is to check the git log for URLs to the QEMU bugtracker at launchpad.net and to figure out whether the related bug has been marked there as "Fix released" (i.e. closed) already. So this script can e.g. be used after each public release of QEMU to check whether there are any bug tickets that could be moved from "Fix committed" (or another state if the author of the patch forgot to update the bug ticket) to "Fix released". Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1474486942-18754-1-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-09-20blockdev: Add dynamic generation of module_block.hMarc Mari
To simplify the addition of new block modules, add a script that generates module_block.h automatically from the modules' source code. This script assumes that the QEMU coding style rules are followed. Signed-off-by: Marc Marí <markmb@redhat.com> Signed-off-by: Colin Lord <clord@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1471008424-16465-3-git-send-email-clord@redhat.com Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-09-19qapi: check invalid arguments on no-args commandsMarc-André Lureau
The generated marshal functions do not visit arguments from commands that take no arguments. Thus they fail to catch invalid members. Visit the arguments, if provided, to throw an error in case of invalid members. Currently, qmp_check_client_args() checks for invalid arguments and correctly catches this case. When switching to qmp_dispatch() we want to keep that behaviour. The commands using 'O' may have arbitrary arguments, and must have 'gen': false in the qapi schema to skip the generated checks. Old/new diff: void qmp_marshal_stop(QDict *args, QObject **ret, Error **errp) { Error *err = NULL; + Visitor *v = NULL; - (void)args; + if (args) { + v = qmp_input_visitor_new(QOBJECT(args), true); + visit_start_struct(v, NULL, NULL, 0, &err); + if (err) { + goto out; + } + + if (!err) { + visit_check_struct(v, &err); + } + visit_end_struct(v, NULL); + if (err) { + goto out; + } + } qmp_stop(&err); + +out: error_propagate(errp, err); + visit_free(v); + if (args) { + v = qapi_dealloc_visitor_new(); + visit_start_struct(v, NULL, NULL, 0, NULL); + + visit_end_struct(v, NULL); + visit_free(v); + } } The new code closely resembles code for a command with arguments. Differences: - the visit of the argument and its cleanup struct don't visit any members (because there are none). - the visit of the argument struct and its cleanup are conditional. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20160912091913.15831-14-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-09-19qapi: remove the "middle" modeMarc-André Lureau
Now that the register function is always generated, we can remove the so-called "middle" mode from the generator script. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20160912091913.15831-13-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-09-19qapi: export the marshallersMarc-André Lureau
Make it possible to call marshallers manually, without going through qmp_dispatch(). (this is currently only possible in middle-mode, but it's also useful in general) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20160912091913.15831-9-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-09-19build-sys: define QEMU_VERSION_{MAJOR, MINOR, MICRO}Marc-André Lureau
There are better chances to find what went wrong at build time than a later assert in qmp_query_version Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20160912091913.15831-2-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-09-15coccinelle: add a script to remove useless castsLaurent Vivier
Script from LKML. Signed-off-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-09-13checkpatch: Fix whitespace checks for documentation code blocksLluís Vilanova
Prevent blank lines in documentation code blocks to be signalled as incorrect trailing whitespace. Code blocks in documentation are 4-column aligned, and blank lines in them should have exactly 4 columns of trailing whitespace to prevent QEMU's wiki to render them as separate code blocks. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-Id: <147325254382.22644.5531276787733455773.stgit@fimbulvetr.bsc.es> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
2016-09-13vmxcap: Add TSC scaling bitEduardo Habkost
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <1472181025-10889-3-git-send-email-ehabkost@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-09-13vmxcap: Show raw MSR valueEduardo Habkost
This will be helpful to allow checking of bits that are not in the 'bits' table yet. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <1472181025-10889-2-git-send-email-ehabkost@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-09-05trace: add syslog tracing backendPaul Durrant
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-08-10checkpatch: default to success if only warningsPaolo Bonzini
CHK-level checks have been removed from checkpatch or bumped to errors, so there is no effect anymore for --strict/--subjective. Furthermore, even most WARNs have been bumped to errors, with WARN only reserved to things that patchew probably ought not to complain about (and that maintainers probably will notice anyway during review if they are extreme). Default to exiting with success even if there are WARN-level failures, and cause --strict to fail for warnings. Maintainers that want to have a strict 80-character limit for their subsystem can add it to a commit hook for example. The --subjective synonym is removed. Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-08-10checkpatch: bump most warnings to errorsPaolo Bonzini
This only leaves a warning-level message for the extra-long lines soft limit. Everything else is bumped up. In the future warnings can be added for checks that can have false positives. Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-08-10CODING_STYLE, checkpatch: update line length rulesPaolo Bonzini
Line lengths above 80 characters do exist. They are rare, but they happen from time to time. An ignored rule is worse than an exception to the rule, so do the latter. Some on the list expressed their preference for a soft limit that is slightly lower than 80 characters, to account for extra characters in unified diffs (including three-way diffs) and for email quoting. However, there was no consensus on this so keep the 80-character soft limit and add a hard limit at 90. Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-08-10checkpatch: check for CVS keywords on all sourcesPaolo Bonzini
These should apply to all files, not just C/C++. Tweak the regular expression to check for whole words, to avoid false positives on Perl variables starting with "Id". Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-08-10checkpatch: tweak the files in which TABs are checkedPaolo Bonzini
Include Python and shell scripts, and make an exception for Perl scripts we imported from Linux or elsewhere. Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-08-09checkpatch: ignore automatically imported Linux headersRadim Krčmář
Linux uses tabs for indentation and checkpatch always complained about automatically imported headers. update-linux-headers.sh could be modified to expand tabs, but there is no real reason to complain about any ugly code in Linux headers, so skip all hunk-related checks. Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-08-09linuxboot_dma: avoid guest ABI breakage on gcc vs. clang compilationPaolo Bonzini
Recent GCC compiles linuxboot_dma.c to 921 bytes, while CentOS 6 needs 1029 and clang needs 1527. Because the size of the ROM, rounded to the next 512 bytes, must match, this causes the API to break between a <1K ROM and one that is bigger. We want to make the ROM 1.5 KB in size, but it's better to make clang produce leaner ROMs, because currently it is worryingly close to the limit. To fix this prevent clang's happy inlining (which -Os cannot prevent). This only requires adding a noinline attribute. Second, the patch makes sure that the ROM has enough padding to prevent ABI breakage on different compilers. The size is now hardcoded in the file that is passed to signrom.py, as was the case before commit 6f71b77 ("scripts/signrom.py: Allow option ROM checksum script to write the size header.", 2016-05-23); signrom.py however will still pad the input to the requested size. This ensures that the padding goes beyond the next multiple of 512 if necessary, and also avoids the need for -fno-toplevel-reorder which clang doesn't support. signrom.py can then error out if the requested size is too small for the actual size of the compiled ROM. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-08-08checkpatch: Fix newline detection in error_setg() & friendsMarkus Armbruster
Commit 5d596c2's regexp assumes the error message string is the first argument. Correct for error_report(), wrong for all the others. Relax the regexp to match newline in anywhere. This might cause additional false positives. While there, update the list of error_reporting functions. Cc: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1470224274-31522-3-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2016-08-08error: Strip trailing '\n' from error string arguments (again)Markus Armbruster
Commit 9af9e0f, 6daf194d, be62a2eb and 312fd5f got rid of a bunch, but they keep coming back. checkpatch.pl tries to flag them since commit 5d596c2, but it's not very good at it. Offenders tracked down with Coccinelle script scripts/coccinelle/err-bad-newline.cocci, an updated version of the script from commit 312fd5f. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1470224274-31522-2-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2016-08-02checkpatch: add check for bzeroPaolo Bonzini
Tested-By: Peter Xu <peterx@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-07-26iotest: fix python based IO testsDaniel P. Berrange
The previous commit refactoring iotests.py: commit 66613974468fb6e1609fb3eabf55981b1ee436cf Author: Daniel P. Berrange <berrange@redhat.com> Date: Wed Jul 20 14:23:10 2016 +0100 scripts: refactor the VM class in iotests for reuse was not properly tested and included a number of broken bits. - The 'event_match' method was not moved into qemu.py - The 'self._args' list parameter in QEMUMachine needs to be copied otherwise modifications will affect the global 'qemu_opts' variable in iotests.py - The QEMUQtestMachine class methods had inverted parameter order for the super() calls - The QEMUQtestMachine class forgot to add '-machine accel=qtest' - The QEMUQtestMachine class constructor needs to set a default 'name' value before using it as it may be None - The QEMUQtestMachine class constructor needs to use named parameters when calling the super constructor as it is leaving out some positional parameters. - The 'qemu_prog' variable should be a string not a list in iotests.py - The VM classs constructor needs to use named parameters when calling the super constructor as it is leaving out some positional parameters. - The path to the socket-scm-helper needs to be passed into the QEMUMachine class Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1469549767-27249-1-git-send-email-berrange@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-07-22scripts: ensure monitor socket has SO_REUSEADDR setDaniel P. Berrange
If tests use a TCP based monitor socket, the connection will go into a TIMED_WAIT state when the test exits. This will randomly prevent the test from being re-run without a certain time period. Set the SO_REUSEADDR flag on the socket to ensure we can immediately re-run the tests Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1469020993-29426-6-git-send-email-berrange@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2016-07-22scripts: set timeout when waiting for qemu monitor connectionDaniel P. Berrange
If QEMU fails to launch for some reason, the QEMUMonitorProtocol class accept() method will wait forever in a socket accept call. Set a timeout of 15 seconds so that we fail more gracefully instead of hanging the test script forever Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1469020993-29426-5-git-send-email-berrange@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2016-07-22scripts: refactor the VM class in iotests for reuseDaniel P. Berrange
The iotests module has a python class for controlling QEMU processes. Pull the generic functionality out of this file and create a scripts/qemu.py module containing a QEMUMachine class. Put the QTest integration support into a subclass QEMUQtestMachine. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1469020993-29426-4-git-send-email-berrange@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2016-07-22scripts: add a 'debug' parameter to QEMUMonitorProtocolDaniel P. Berrange
Add a 'debug' parameter to the QEMUMonitorProtocol class which will cause it to print out all JSON strings on sys.stderr Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1469020993-29426-3-git-send-email-berrange@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2016-07-22scripts: add __init__.py file to scripts/qmp/Daniel P. Berrange
When searching for modules to load, python will ignore any sub-directory which does not contain __init__.py. This means that both scripts and scripts/qmp/ have to be explicitly added to the python path. By adding a __init__.py file to scripts/qmp, we only need add scripts/ to the python path and can then simply do 'from qmp import qmp' to load scripts/qmp/qmp.py. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1469020993-29426-2-git-send-email-berrange@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2016-07-19qapi: Implement boxed types for commands/eventsEric Blake
Turn on the ability to pass command and event arguments in a single boxed parameter, which must name a non-empty type (although the type can be a struct with all optional members). For structs, it makes it possible to pass a single qapi type instead of a breakout of all struct members (useful if the arguments are already in a struct or if the number of members is large); for other complex types, it is now possible to use a union or alternate as the data for a command or event. The empty type may be technically feasible if needed down the road, but it's easier to forbid it now and relax things to allow it later, than it is to allow it now and have to special case how the generated 'q_empty' type is handled (see commit 7ce106a9 for reasons why nothing is generated for the empty type). An alternate type is never considered empty, but now that a boxed type can be either an object or an alternate, we have to provide a trivial QAPISchemaAlternateType.is_empty(). The new call to arg_type.is_empty() during QAPISchemaCommand.check() requires that we first check the type in question; but there is no chance of introducing a cycle since objects do not refer back to commands. We still have a split in syntax checking between ad-hoc parsing up front (merely validates that 'boxed' has a sane value) and during .check() methods (if 'boxed' is set, then 'data' must name a non-empty user-defined type). Generated code is unchanged, as long as no client uses the new feature. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1468468228-27827-10-git-send-email-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Test files renamed to *-boxed-*] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-07-19qapi: Plumb in 'boxed' to qapi generator lower levelsEric Blake
The next patch will add support for passing a qapi union type as the 'data' of a command. But to do that, the user function for implementing the command, as called by the generated marshal command, must take the corresponding C struct as a single boxed pointer, rather than a breakdown into one parameter per member. Even without a union, being able to use a C struct rather than a list of parameters can make it much easier to handle coding with QAPI. This patch adds the internal plumbing of a 'boxed' flag associated with each command and event. In several cases, this means adding indentation, with one new dead branch and the remaining branch being the original code more deeply nested; this was done so that the new implementation in the next patch is easier to review without also being mixed with indentation changes. For this patch, no behavior or generated output changes, other than the testsuite outputting the value of the new flag (always False for now). Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1468468228-27827-9-git-send-email-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Identifier box renamed to boxed in two places] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-07-19qapi-event: Simplify visit of non-implicit dataEric Blake
Commit 7ce106a9 documented why we don't generated a visit_type_FOO() for implicit types; and therefore events with an anonymous type for 'data' have to open-code a visit. Note that the open-coded visit in qapi-event.c is slightly different from what is done in qapi-visit.c for normal types, in part because we don't have to check for *obj being NULL or free things on error. But where the type is not implicit, it is nicer to reuse the normal visit instead of open-coding a duplicate. At the moment, the only event with a non-implicit 'data' is in the testsuite, where test-qapi-event.c changes as follows: |@@ -155,6 +155,7 @@ void qapi_event_send___org_qemu_x_event( | __org_qemu_x_Struct param = { | __org_qemu_x_member1, (char *)__org_qemu_x_member2, has_q_wchar_t, q_wchar_t | }; |+ __org_qemu_x_Struct *arg = &param; | | emit = qmp_event_get_func_emit(); | if (!emit) { |@@ -164,16 +165,7 @@ void qapi_event_send___org_qemu_x_event( | qmp = qmp_event_build_dict("__ORG.QEMU_X-EVENT"); | | v = qmp_output_visitor_new(&obj); |- |- visit_start_struct(v, "__ORG.QEMU_X-EVENT", NULL, 0, &err); |- if (err) { |- goto out; |- } |- visit_type___org_qemu_x_Struct_members(v, &param, &err); |- if (!err) { |- if (!err) { |- visit_check_struct(v, &err); |- } |- visit_end_struct(v, NULL); |+ visit_type___org_qemu_x_Struct(v, "__ORG.QEMU_X-EVENT", &arg, &err); | if (err) { | goto out; | } Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1468468228-27827-8-git-send-email-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-07-19qapi: Drop useless gen_err_check()Eric Blake
Ever since commit 12f254f removed the last parameterization of gen_err_check(), it no longer makes sense to hide the three lines of generated C code behind a macro call. Just inline it into the remaining users. No change to generated code. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1468468228-27827-7-git-send-email-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>