1. 05 1月, 2015 1 次提交
    • M
      qapi: add visit_start_union and visit_end_union · 96c6cf6d
      Michael Roth 提交于
      In some cases an input visitor might bail out on filling out a
      struct for various reasons, such as missing fields when running
      in strict mode. In the case of a QAPI Union type, this may lead
      to cases where the .kind field which encodes the union type
      is uninitialized. Subsequently, other visitors, such as the
      dealloc visitor, may use this .kind value as if it were
      initialized, leading to assumptions about the union type which
      in this case may lead to segfaults. For example, freeing an
      integer value.
      
      However, we can generally rely on the fact that the always-present
      .data void * field that we generate for these union types will
      always be NULL in cases where .kind is uninitialized (at least,
      there shouldn't be a reason where we'd do this purposefully).
      
      So pass this information on to Visitor implementation via these
      optional start_union/end_union interfaces so this information
      can be used to guard against the situation above. We will make
      use of this information in a subsequent patch for the dealloc
      visitor.
      
      Cc: qemu-stable@nongnu.org
      Reported-by: NFam Zheng <famz@redhat.com>
      Suggested-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      (cherry picked from commit cee2dedb)
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      96c6cf6d
  2. 16 7月, 2014 1 次提交
  3. 27 6月, 2014 1 次提交
  4. 24 6月, 2014 1 次提交
    • A
      vmstate-static-checker: script to validate vmstate changes · 426d1d01
      Amit Shah 提交于
      This script compares the vmstate dumps in JSON format as output by QEMU
      with the -dump-vmstate option.
      
      It flags various errors, like version mismatch, sections going away,
      size mismatches, etc.
      
      This script is tolerant of a few changes that do not change the on-wire
      format, like embedding a few fields within substructs.
      
      The script takes -s/--src and -d/--dest parameters, to which filenames
      are given as arguments.
      
      Example:
      
      (in a qemu 2.0 tree):
      ./x86_64-softmmu/qemu-system-x86_64 -dump-vmstate qemu-2.0.json
      
      (in a qemu 2.2 tree:)
      ./x86_64-softmmu/qemu-system-x86_64 -dump-vmstate -M pc-i440fx-2.0 \
         qemu-2.2-m2.0.json
      
      ./scripts/vmstate-static-checker.py -s qemu-2.0.json -d qemu-2.2-m2.0.json
      
      The script also takes a --reverse parameter to switch the src and dest
      jsons.  This is just a shorthand for reversing the src and dest.
      
      The --help parameter shows usage information.
      Signed-off-by: NAmit Shah <amit.shah@redhat.com>
      Signed-off-by: NJuan Quintela <quintela@redhat.com>
      426d1d01
  5. 23 6月, 2014 4 次提交
  6. 16 6月, 2014 1 次提交
  7. 09 6月, 2014 2 次提交
    • L
      trace: Multi-backend tracing · 5b808275
      Lluís Vilanova 提交于
      Adds support to compile QEMU with multiple tracing backends at the same time.
      
      For example, you can compile QEMU with:
      
        $ ./configure --enable-trace-backends=ftrace,dtrace
      
      Where 'ftrace' can be handy for having an in-flight record of events, and 'dtrace' can be later used to extract more information from the system.
      
      This patch allows having both available without recompiling QEMU.
      Signed-off-by: NLluís Vilanova <vilanova@ac.upc.edu>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      5b808275
    • S
      simpletrace: add support for trace record pid field · 80ff35cd
      Stefan Hajnoczi 提交于
      Extract the pid field from the trace record and print it.
      
      Change the trace record tuple from:
        (event_num, timestamp, arg1, ..., arg6)
      to:
        (event_num, timestamp, pid, arg1, ..., arg6)
      
      Trace event methods now support 3 prototypes:
      1. <event-name>(arg1, arg2, arg3)
      2. <event-name>(timestamp, arg1, arg2, arg3)
      3. <event-name>(timestamp, pid, arg1, arg2, arg3)
      
      Existing script continue to work without changes, they only know about
      prototypes 1 and 2.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      80ff35cd
  8. 21 5月, 2014 3 次提交
    • P
      kvm_stat: allow choosing between tracepoints and old stats · b763adf1
      Paolo Bonzini 提交于
      The old stats contain information not available in the tracepoints.
      By default, keep the old behavior, but allow choosing which set of stats
      to present, or even both.
      
      Inspired by a patch from Marcelo Tosatti.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b763adf1
    • M
      qapi: zero-initialize all QMP command parameters · fc13d937
      Michael Roth 提交于
      In general QMP command parameter values are specified by consumers of the
      QMP/HMP interface, but in the case of optional parameters these values may
      be left uninitialized.
      
      It is considered a bug for code to make use of optional parameters that have
      not been flagged as being present by the marshalling code (via corresponding
      has_<parameter> parameter), however our marshalling code will still pass
      these uninitialized values on to the corresponding QMP function (to then
      be ignored). Some compilers (clang in particular) consider this unsafe
      however, and generate warnings as a result. As reported by Peter Maydell:
      
        This is something clang's -fsanitize=undefined spotted. The
        code generated by qapi-commands.py in qmp-marshal.c for
        qmp_marshal_* functions where there are some optional
        arguments looks like this:
      
            bool has_force = false;
            bool force;
      
            mi = qmp_input_visitor_new_strict(QOBJECT(args));
            v = qmp_input_get_visitor(mi);
            visit_type_str(v, &device, "device", errp);
            visit_start_optional(v, &has_force, "force", errp);
            if (has_force) {
                visit_type_bool(v, &force, "force", errp);
            }
            visit_end_optional(v, errp);
            qmp_input_visitor_cleanup(mi);
      
            if (error_is_set(errp)) {
                goto out;
            }
            qmp_eject(device, has_force, force, errp);
      
        In the case where has_force is false, we never initialize
        force, but then we use it by passing it to qmp_eject.
        I imagine we don't then actually use the value, but clang
        complains in particular for 'bool' variables because the value
        that ends up being loaded from memory for 'force' is not either
        0 or 1 (being uninitialized stack contents).
      
      Fix this by initializing all QMP command parameters to {0} in the
      marshalling code prior to passing them on to the QMP functions.
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Reported-by: NPeter Maydell <peter.maydell@linaro.org>
      Tested-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      fc13d937
    • L
      scripts/qapi.py: Avoid syntax not supported by Python 2.4 · 34788811
      Luiz Capitulino 提交于
      The Python "except Foo as x" syntax was only introduced in
      Python 2.6, but we aim to support Python 2.4 and later.
      Use the old-style "except Foo, x" syntax instead, thus
      fixing configure/compile on systems with older Python.
      Reported-by: NPeter Maydell <peter.maydell@linaro.org>
      Tested-by: NAndreas Färber <andreas.faerber@web.de>
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      34788811
  9. 16 5月, 2014 8 次提交
  10. 09 5月, 2014 2 次提交
  11. 08 5月, 2014 8 次提交
  12. 18 4月, 2014 1 次提交
  13. 31 3月, 2014 1 次提交
  14. 18 3月, 2014 1 次提交
  15. 15 3月, 2014 1 次提交
  16. 11 3月, 2014 4 次提交