1. 18 12月, 2018 4 次提交
    • M
      vl: Use error_fatal to simplify obvious fatal errors (again) · 92917cd2
      Markus Armbruster 提交于
      Patch created mechanically by rerunning:
      
          $ spatch --in-place --sp-file scripts/coccinelle/use-error_fatal.cocci \
                   --macro-file scripts/cocci-macro-file.h vl.c
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NLaurent Vivier <laurent@vivier.eu>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-Id: <20181213175807.12039-1-armbru@redhat.com>
      Signed-off-by: NLaurent Vivier <laurent@vivier.eu>
      92917cd2
    • D
      qmp hmp: Make system_wakeup check wake-up support and run state · fb064112
      Daniel Henrique Barboza 提交于
      The qmp/hmp command 'system_wakeup' is simply a direct call to
      'qemu_system_wakeup_request' from vl.c. This function verifies if
      runstate is SUSPENDED and if the wake up reason is valid before
      proceeding. However, no error or warning is thrown if any of those
      pre-requirements isn't met. There is no way for the caller to
      differentiate between a successful wakeup or an error state caused
      when trying to wake up a guest that wasn't suspended.
      
      This means that system_wakeup is silently failing, which can be
      considered a bug. Adding error handling isn't an API break in this
      case - applications that didn't check the result will remain broken,
      the ones that check it will have a chance to deal with it.
      
      Adding to that, the commit before previous created a new QMP API called
      query-current-machine, with a new flag called wakeup-suspend-support,
      that indicates if the guest has the capability of waking up from suspended
      state. Although such guest will never reach SUSPENDED state and erroring
      it out in this scenario would suffice, it is more informative for the user
      to differentiate between a failure because the guest isn't suspended versus
      a failure because the guest does not have support for wake up at all.
      
      All this considered, this patch changes qmp_system_wakeup to check if
      the guest is capable of waking up from suspend, and if it is suspended.
      After this patch, this is the output of system_wakeup in a guest that
      does not have wake-up from suspend support (ppc64):
      
      (qemu) system_wakeup
      wake-up from suspend is not supported by this guest
      (qemu)
      
      And this is the output of system_wakeup in a x86 guest that has the
      support but isn't suspended:
      
      (qemu) system_wakeup
      Unable to wake up: guest is not in suspended state
      (qemu)
      Reported-by: NBalamuruhan S <bala24@linux.vnet.ibm.com>
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Message-Id: <20181205194701.17836-4-danielhb413@gmail.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Acked-by: NEduardo Habkost <ehabkost@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      fb064112
    • D
      qmp: query-current-machine with wakeup-suspend-support · 46ea94ca
      Daniel Henrique Barboza 提交于
      When issuing the qmp/hmp 'system_wakeup' command, what happens in a
      nutshell is:
      
      - qmp_system_wakeup_request set runstate to RUNNING, sets a wakeup_reason
      and notify the event
      - in the main_loop, all vcpus are paused, a system reset is issued, all
      subscribers of wakeup_notifiers receives a notification, vcpus are then
      resumed and the wake up QAPI event is fired
      
      Note that this procedure alone doesn't ensure that the guest will awake
      from SUSPENDED state - the subscribers of the wake up event must take
      action to resume the guest, otherwise the guest will simply reboot. At
      this moment, only the ACPI machines via acpi_pm1_cnt_init and xen_hvm_init
      have wake-up from suspend support.
      
      However, only the presence of 'system_wakeup' is required for QGA to
      support 'guest-suspend-ram' and 'guest-suspend-hybrid' at this moment.
      This means that the user/management will expect to suspend the guest using
      one of those suspend commands and then resume execution using system_wakeup,
      regardless of the support offered in system_wakeup in the first place.
      
      This patch creates a new API called query-current-machine [1], that holds
      a new flag called 'wakeup-suspend-support' that indicates if the guest
      supports wake up from suspend via system_wakeup. The machine is considered
      to implement wake-up support if a call to a new 'qemu_register_wakeup_support'
      is made during its init, as it is now being done inside acpi_pm1_cnt_init
      and xen_hvm_init. This allows for any other machine type to declare wake-up
      support regardless of ACPI state or wakeup_notifiers subscription, making easier
      for newer implementations that might have their own mechanisms in the future.
      
      This is the expected output of query-current-machine when running a x86
      guest:
      
      {"execute" : "query-current-machine"}
      {"return": {"wakeup-suspend-support": true}}
      
      Running the same x86 guest, but with the --no-acpi option:
      
      {"execute" : "query-current-machine"}
      {"return": {"wakeup-suspend-support": false}}
      
      This is the output when running a pseries guest:
      
      {"execute" : "query-current-machine"}
      {"return": {"wakeup-suspend-support": false}}
      
      With this extra tool, management can avoid situations where a guest
      that does not have proper suspend/wake capabilities ends up in
      inconsistent state (e.g.
      https://github.com/open-power-host-os/qemu/issues/31).
      
      [1] the decision of creating the query-current-machine API is based
      on discussions in the QEMU mailing list where it was decided that
      query-target wasn't a proper place to store the wake-up flag, neither
      was query-machines because this isn't a static property of the
      machine object. This new API can then be used to store other
      dynamic machine properties that are scattered around the code
      ATM. More info at:
      https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg04235.htmlReported-by: NBalamuruhan S <bala24@linux.vnet.ibm.com>
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Message-Id: <20181205194701.17836-2-danielhb413@gmail.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Acked-by: NEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      46ea94ca
    • D
      qmp: Add reason to SHUTDOWN and RESET events · ecd7a0d5
      Dominik Csapak 提交于
      This makes it possible to determine what the exact reason was for
      a RESET or a SHUTDOWN. A management layer might need the specific reason
      of those events to determine which cleanups or other actions it needs to do.
      
      This patch also updates the iotests to the new expected output that includes
      the reason.
      Signed-off-by: NDominik Csapak <d.csapak@proxmox.com>
      Message-Id: <20181205110131.23049-3-d.csapak@proxmox.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      [Commit message tweaked]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      ecd7a0d5
  2. 12 12月, 2018 1 次提交
  3. 27 11月, 2018 3 次提交
  4. 12 11月, 2018 1 次提交
    • T
      bt: Mark the bluetooth subsystem as deprecated · c0188e69
      Thomas Huth 提交于
      It has been unmaintained since years, and there were only trivial or
      tree-wide changes to the related files since many years, so the
      code is likely very bitrotten and broken. For example the following
      segfaults as soon as as you press a key:
      
       qemu-system-x86_64 -usb -device usb-bt-dongle -bt hci -bt device:keyboard
      
      Since we are not aware of anybody using bluetooth with the current
      version of QEMU, let's mark the subsystem as deprecated, with a special
      request for the users to write to the qemu-devel mailing list in case
      they still use it (so we could revert the deprecation status in that
      case).
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Message-id: 1542016830-19189-1-git-send-email-thuth@redhat.com
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      c0188e69
  5. 07 11月, 2018 1 次提交
    • E
      vl: Avoid crash when -mon is underspecified · 0c57893d
      Eric Blake 提交于
      A quick coredump on an incomplete command line:
      ./x86_64-softmmu/qemu-system-x86_64 -mon mode=control,pretty=on
      
       #0  0x00007ffff723d9e4 in g_str_hash () at /lib64/libglib-2.0.so.0
       #1  0x00007ffff723ce38 in g_hash_table_lookup () at /lib64/libglib-2.0.so.0
       #2  0x0000555555cc0073 in object_class_property_find (klass=0x5555566a94b0, name=0x0, errp=0x0) at qom/object.c:1135
       #3  0x0000555555cc004b in object_class_property_find (klass=0x5555566a9440, name=0x0, errp=0x0) at qom/object.c:1129
       #4  0x0000555555cbfe6e in object_property_find (obj=0x5555568348c0, name=0x0, errp=0x0) at qom/object.c:1080
       #5  0x0000555555cc183d in object_resolve_path_component (parent=0x5555568348c0, part=0x0) at qom/object.c:1762
       #6  0x0000555555d82071 in qemu_chr_find (name=0x0) at chardev/char.c:802
       #7  0x00005555559d77cb in mon_init_func (opaque=0x0, opts=0x5555566b65a0, errp=0x0) at vl.c:2291
      
      Fix it to instead fail gracefully.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20181023213600.364086-1-eblake@redhat.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
      Reviewed-by: NPeter Xu <peterx@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      0c57893d
  6. 05 11月, 2018 2 次提交
  7. 24 10月, 2018 2 次提交
    • I
      vl:c: make sure that sockets are calculated correctly in '-smp X' case · 268430be
      Igor Mammedov 提交于
      commit
        (5cdc9b76 vl.c: Remove dead assignment)
      removed sockets calculation when 'sockets' weren't provided on CLI
      since there wasn't any users for it back then. Exiting checks
      are neither reachable
         } else if (sockets * cores * threads < cpus) {
      or nor triggerable
         if (sockets * cores * threads > max_cpus)
      so we weren't noticing wrong topology since then, since users
      recalculate sockets adhoc on their own.
      
      However with deprecation check it becomes noticable, for example
        -smp 2
      will start printing warning:
        "warning: Invalid CPU topology deprecated: sockets (1) * cores (1) * threads (1) != maxcpus (2)"
      calculating sockets if they weren't specified.
      
      Fix it by returning back sockets calculation if it's omitted on CLI.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: NAndrew Jones <drjones@redhat.com>
      Message-Id: <1536836762-273036-3-git-send-email-imammedo@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      268430be
    • I
      vl.c deprecate incorrect CPUs topology · bc1fb850
      Igor Mammedov 提交于
      -smp [cpus],sockets/cores/threads[,maxcpus] should describe topology
      so that total number of logical CPUs [sockets * cores * threads]
      would be equal to [maxcpus], however historically we didn't have
      such check in QEMU and it is possible to start VM with an invalid
      topology.
      Deprecate invalid options combination so we can make sure that
      the topology VM started with is always correct in the future.
      Users with an invalid sockets/cores/threads/maxcpus values should
      fix their CLI to make sure that
         [sockets * cores * threads] == [maxcpus]
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: NAndrew Jones <drjones@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <1536836762-273036-2-git-send-email-imammedo@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      [ehabkost: squashed unit test fix]
      Message-Id: <20181019215345.521d58d7@igors-macbook-pro.local>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      bc1fb850
  8. 19 10月, 2018 21 次提交
  9. 05 10月, 2018 2 次提交
  10. 03 10月, 2018 3 次提交
    • M
      chardev: mark the calls that allow an implicit mux monitor · 95e30b2a
      Marc-André Lureau 提交于
      This is mostly for readability of the code. Let's make it clear which
      callers can create an implicit monitor when the chardev is muxed.
      
      This will also enforce a safer behaviour, as we don't really support
      creating monitor anywhere/anytime at the moment. Add an assert() to
      make sure the programmer explicitely wanted that behaviour.
      
      There are documented cases, such as: -serial/-parallel/-virtioconsole
      and to less extent -debugcon.
      
      Less obvious and questionable ones are -gdb, SLIRP -guestfwd and Xen
      console. Add a FIXME note for those, but keep the support for now.
      
      Other qemu_chr_new() callers either have a fixed parameter/filename
      string or do not need it, such as -qtest:
      
      * qtest.c: qtest_init()
        Afaik, only used by tests/libqtest.c, without mux. I don't think we
        support it outside of qemu testing: drop support for implicit mux
        monitor (qemu_chr_new() call: no implicit mux now).
      
      * hw/
        All with literal @filename argument that doesn't enable mux monitor.
      
      * tests/
        All with @filename argument that doesn't enable mux monitor.
      
      On a related note, the list of monitor creation places:
      
      - the chardev creators listed above: all from command line (except
        perhaps Xen console?)
      
      - -gdb & hmp gdbserver will create a "GDB monitor command" chardev
        that is wired to an HMP monitor.
      
      - -mon command line option
      
      From this short study, I would like to think that a monitor may only
      be created in the main thread today, though I remain skeptical :)
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      95e30b2a
    • P
      replay: allow loading any snapshots before recording · bb3d7702
      Pavel Dovgalyuk 提交于
      This patch enables using -loadvm in recording mode to allow starting
      the execution recording from any of the available snapshots.
      It also fixes loading of the record/replay state, therefore snapshots
      created in replay mode may also be used for starting the new recording.
      Signed-off-by: NPavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
      Message-Id: <20180912081939.3228.56131.stgit@pasha-VirtualBox>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      bb3d7702
    • M
      Delete PID file on exit · 90a84d13
      Marc-André Lureau 提交于
      Register an exit notifier to remove the PID file. By the time atexit()
      is called, qemu_write_pidfile() guarantees QEMU owns the PID file,
      thus we could safely remove it when exiting.
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20180907121319.8607-4-marcandre.lureau@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      90a84d13