1. 18 12月, 2018 1 次提交
    • 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
  2. 14 12月, 2018 1 次提交
  3. 12 12月, 2018 2 次提交
    • P
      monitor: Suspend monitor instead dropping commands · 9ab84470
      Peter Xu 提交于
      When a QMP client sends in-band commands more quickly that we can
      process them, we can either queue them without limit (QUEUE), drop
      commands when the queue is full (DROP), or suspend receiving commands
      when the queue is full (SUSPEND).  None of them is ideal:
      
      * QUEUE lets a misbehaving client make QEMU eat memory without bounds.
      Not such a hot idea.
      
      * With DROP, the client has to cope with dropped in-band commands.  To
      inform the client, we send a COMMAND_DROPPED event then.  The event is
      flawed by design in two ways: it's ambiguous (see commit d621cfe0),
      and it brings back the "eat memory without bounds" problem.
      
      * With SUSPEND, the client has to manage the flow of in-band commands to
      keep the monitor available for out-of-band commands.
      
      We currently DROP.  Switch to SUSPEND.
      
      Managing the flow of in-band commands to keep the monitor available for
      out-of-band commands isn't really hard: just count the number of
      "outstanding" in-band commands (commands sent minus replies received),
      and if it exceeds the limit, hold back additional ones until it drops
      below the limit again.
      
      Note that we need to be careful pairing the suspend with a resume, or
      else the monitor will hang, possibly forever.  And here since we need to
      make sure both:
      
           (1) popping request from the req queue, and
           (2) reading length of the req queue
      
      will be in the same critical section, we let the pop function take the
      corresponding queue lock when there is a request, then we release the
      lock from the caller.
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Signed-off-by: NPeter Xu <peterx@redhat.com>
      Message-Id: <20181009062718.1914-2-peterx@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      9ab84470
    • K
      Deprecate QMP `cpu-add` · 3800db78
      Kashyap Chamarthy 提交于
      The intended functionality of QMP `cpu-add` is replaced with
      `device_add` (and `query-hotpluggable-cpus`).  So let's deprecate
      `cpu-add`.
      
      A complete example of vCPU hotplug with the recommended way (using
      `device_add`) is provided as part of a seperate docs patch.
      
      Suggested-by: Eduardo Habkost <ehabkost@redhat.com
      Signed-off-by: NKashyap Chamarthy <kchamart@redhat.com>
      Message-Id: <20181030123526.26415-2-kchamart@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      3800db78
  4. 24 10月, 2018 1 次提交
  5. 19 10月, 2018 1 次提交
  6. 12 10月, 2018 1 次提交
  7. 09 10月, 2018 1 次提交
  8. 25 9月, 2018 1 次提交
  9. 16 7月, 2018 1 次提交
  10. 04 7月, 2018 2 次提交
    • M
      qmp: Get rid of x-oob-test command · 97ca0712
      Markus Armbruster 提交于
      tests/qmp-test tests an out-of-band command overtaking a slow in-band
      command.  To do that, it needs:
      
      1. An in-band command that *reliably* takes long enough to be
         overtaken.
      
      2. An out-of-band command to do the overtaking.
      
      3. To avoid delays, a way to make the in-band command complete quickly
         after it was overtaken.
      
      To satisfy these needs, commit 469638f9 provides the rather
      peculiar oob-capable QMP command x-oob-test:
      
      * With "lock": true, it waits for a global semaphore.
      
      * With "lock": false, it signals the global semaphore.
      
      To satisfy 1., the test runs x-oob-test in-band with "lock": true.
      To satisfy 2. and 3., it runs x-oob-test out-of-band with "lock": false.
      
      Note that waiting for a semaphore violates the rules for oob-capable
      commands.  Running x-oob-test with "lock": true hangs the monitor
      until you run x-oob-test with "lock": false on another monitor (which
      you might not have set up).
      
      Having an externally visible QMP command that may hang the monitor is
      not nice.  Let's apply a little more ingenuity to the problem.  Idea:
      have an existing command block on reading a FIFO special file, unblock
      it by opening the FIFO for writing.
      
      For 1., use
      
          {"execute": "blockdev-add",  "id": ID1,
           "arguments": {
              "driver": "blkdebug", "node-name": ID1, "config": FIFO,
              "image": { "driver": "null-co"}}}
      
      where ID1 is an arbitrary string, and FIFO is the name of the FIFO.
      
      For 2., use
      
          {"execute": "migrate-pause", "id": ID2, "control": {"run-oob": true}}
      
      where ID2 is a different arbitrary string.  Since there's no migration
      to pause, the command will fail, but that's fine; instant failure is
      still a test of out-of-band responses overtaking in-band commands.
      
      For 3., open FIFO for writing.
      
      Drop QMP command x-oob-test.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20180703085358.13941-6-armbru@redhat.com>
      [Error checking tweaked]
      97ca0712
    • M
      qmp: Document COMMAND_DROPPED design flaw · d621cfe0
      Markus Armbruster 提交于
      Events are broadcast to all monitors.  If another monitor's client has
      a command with the same ID in flight, the event will incorrectly claim
      that command was dropped.  This must be fixed before out-of-band
      execution can graduate from "experimental".
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20180703085358.13941-5-armbru@redhat.com>
      d621cfe0
  11. 03 7月, 2018 1 次提交
  12. 29 6月, 2018 1 次提交
  13. 22 6月, 2018 1 次提交
  14. 21 6月, 2018 1 次提交
  15. 01 6月, 2018 1 次提交
  16. 31 5月, 2018 4 次提交
    • I
      qmp: add set-numa-node command · f3be6781
      Igor Mammedov 提交于
      Command is allowed to run only in preconfig stage and
      will allow to configure numa mapping for CPUs depending
      on possible CPUs layout (query-hotpluggable-cpus) for
      given machine instance.
      
      Example of configuration session:
      $QEMU -smp 2 --preconfig ...
      
      QMP:
      -> {'execute': 'query-hotpluggable-cpus' }
      <- {'return': [
             {'props': {'core-id': 0, 'thread-id': 0, 'socket-id': 1}, ... },
             {'props': {'core-id': 0, 'thread-id': 0, 'socket-id': 0}, ... }
         ]}
      
      -> {'execute': 'set-numa-node', 'arguments': { 'type': 'node', 'nodeid': 0 } }
      <- {'return': {}}
      -> {'execute': 'set-numa-node', 'arguments': { 'type': 'cpu',
             'node-id': 0, 'core-id': 0, 'thread-id': 0, 'socket-id': 1, }
         }
      <- {'return': {}}
      
      -> {'execute': 'set-numa-node', 'arguments': { 'type': 'node', 'nodeid': 1 } }
      -> {'execute': 'set-numa-node', 'arguments': { 'type': 'cpu',
             'node-id': 1, 'core-id': 0, 'thread-id': 0, 'socket-id': 0 }
         }
      <- {'return': {}}
      
      -> {'execute': 'query-hotpluggable-cpus' }
      <- {'return': [
             {'props': {'core-id': 0, 'thread-id': 0, 'node-id': 0, 'socket-id': 1}, ... },
             {'props': {'core-id': 0, 'thread-id': 0, 'node-id': 1, 'socket-id': 0}, ... }
         ]}
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1525423069-61903-11-git-send-email-imammedo@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      [ehabkost: Changed "since 2.13" to "since 3.0"]
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      f3be6781
    • I
      qmp: permit query-hotpluggable-cpus in preconfig state · 899eaab4
      Igor Mammedov 提交于
      it will allow mgmt to query possible CPUs, which depends on
      used machine(version)/-smp options, without restarting
      QEMU and use results to configure numa mapping or adding
      CPUs with device_add* later.
      
      PS:
      *) device_add is not allowed to run at preconfig in this series
         but later it could be dealt with by injecting -device
         in preconfig state and letting existing -device handling
         to actually plug devices
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1525423069-61903-10-git-send-email-imammedo@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      899eaab4
    • I
      cli: add --preconfig option · 047f7038
      Igor Mammedov 提交于
      This option allows pausing QEMU in the new RUN_STATE_PRECONFIG state,
      allowing the configuration of QEMU from QMP before the machine jumps
      into board initialization code of machine_run_board_init()
      
      The intent is to allow management to query machine state and additionally
      configure it using previous query results within one QEMU instance
      (i.e. eliminate the need to start QEMU twice, 1st to query board specific
      parameters and 2nd for actual VM start using query results for
      additional parameters).
      
      The new option complements -S option and could be used with or without
      it. The difference is that -S pauses QEMU when the machine is completely
      initialized with all devices wired up and ready to execute guest code
      (QEMU needs only to unpause VCPUs to let guest execute its code),
      while the "preconfig" option pauses QEMU early before board specific init
      callback (machine_run_board_init) is executed and allows the configuration
      of machine parameters which will be used by board init code.
      
      When early introspection/configuration is done, command 'exit-preconfig'
      should be used to exit RUN_STATE_PRECONFIG and transition to the next
      requested state (i.e. if -S is used then QEMU will pause the second
      time when board/device initialization is completed or start guest
      execution if -S isn't provided on CLI)
      
      PS:
      Initially 'preconfig' is planned to be used for configuring numa
      topology depending on board specified possible cpus layout.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1526059483-42847-1-git-send-email-imammedo@redhat.com>
      [ehabkost: Changed "since 2.13" to "since 3.0"]
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      047f7038
    • I
      qapi: introduce new cmd option "allow-preconfig" · d6fe3d02
      Igor Mammedov 提交于
      New option will be used to allow commands, which are prepared/need
      to run, during preconfig state. Other commands that should be able
      to run in preconfig state, should be amended to not expect machine
      in initialized state or deal with it.
      
      For compatibility reasons, commands that don't use new flag
      'allow-preconfig' explicitly are not permitted to run in
      preconfig state but allowed in all other states like they used
      to be.
      
      Within this patch allow following commands in preconfig state:
         qmp_capabilities
         query-qmp-schema
         query-commands
         query-command-line-options
         query-status
         exit-preconfig
      to allow qmp connection, basic introspection and moving to the next
      state.
      
      PS:
      set-numa-node and query-hotpluggable-cpus will be enabled later in
      a separate patches.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1526057503-39287-1-git-send-email-imammedo@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      [ehabkost: Changed "since 2.13" to "since 3.0"]
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      d6fe3d02
  17. 29 5月, 2018 1 次提交
  18. 04 5月, 2018 4 次提交
    • L
      qapi: deprecate CpuInfoFast.arch · 6ffa3ab4
      Laszlo Ersek 提交于
      The TARGET_BASE_ARCH values from "configure" don't all map to the
      @CpuInfoArch enum constants; in particular "s390x" from the former does
      not match @s390 in the latter. Clients are known to rely on the @s390
      constant specifically, so we can't change it silently. Instead, deprecate
      the @CpuInfoFast.@arch member (in favor of @CpuInfoFast.@target) using the
      regular deprecation process.
      
      (No deprecation reminder is added to sysemu_target_to_cpuinfo_arch(): once
      @CpuInfoFast.@arch is removed, the assignment expression that calls
      sysemu_target_to_cpuinfo_arch() from qmp_query_cpus_fast() will have to
      disappear; in turn the static function left without callers will also
      break the build, thus it'll have to go.)
      
      Cc: "Daniel P. Berrange" <berrange@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Signed-off-by: NLaszlo Ersek <lersek@redhat.com>
      Message-Id: <20180427192852.15013-6-lersek@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      6ffa3ab4
    • L
      qapi: discriminate CpuInfoFast on SysEmuTarget, not CpuInfoArch · daa9d2bc
      Laszlo Ersek 提交于
      Add a new field @target (of type @SysEmuTarget) to the output of the
      @query-cpus-fast command, which provides more information about the
      emulation target than the field @arch (of type @CpuInfoArch). Make @target
      the new discriminator for the @CpuInfoFast return structure. Keep @arch
      for compatibility.
      
      Cc: "Daniel P. Berrange" <berrange@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Signed-off-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20180427192852.15013-5-lersek@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      daa9d2bc
    • L
      qapi: change the type of TargetInfo.arch from string to enum SysEmuTarget · b47aa7b3
      Laszlo Ersek 提交于
      Now that we have @SysEmuTarget, it makes sense to restrict
      @TargetInfo.@arch to valid sysemu targets at the schema level.
      
      Cc: "Daniel P. Berrange" <berrange@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Signed-off-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20180427192852.15013-4-lersek@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      b47aa7b3
    • L
      qapi: fill in CpuInfoFast.arch in query-cpus-fast · 96054f56
      Laszlo Ersek 提交于
      * Commit ca230ff3 added the @arch field to @CpuInfoFast, but it failed
        to set the new field in qmp_query_cpus_fast(), when TARGET_S390X was not
        defined. The updated @query-cpus-fast example in "qapi-schema.json"
        showed "arch":"x86" only because qmp_query_cpus_fast() calls g_malloc0()
        to allocate @CpuInfoFast, and the CPU_INFO_ARCH_X86 enum constant is
        generated with value 0.
      
        All @arch values other than @s390 implied the @CpuInfoOther sub-struct
        for @CpuInfoFast -- at the time of writing the patch --, thus no fields
        other than @arch needed to be set when TARGET_S390X was not defined. Set
        @arch now, by copying the corresponding assignments from
        qmp_query_cpus().
      
      * Commit 25fa194b added the @riscv enum constant to @CpuInfoArch (used
        in both @CpuInfo and @CpuInfoFast -- the return types of the @query-cpus
        and @query-cpus-fast commands, respectively), and assigned, in both
        return structures, the @CpuInfoRISCV sub-structure to the new enum
        value.
      
        However, qmp_query_cpus_fast() would not populate either the @arch field
        or the @CpuInfoRISCV sub-structure, when TARGET_RISCV was defined; only
        qmp_query_cpus() would.
      
        Assign @CpuInfoOther to the @riscv enum constant in @CpuInfoFast, and
        populate only the @arch field in qmp_query_cpus_fast(). Getting CPU
        state without interrupting KVM is an exceptional thing that only S390X
        does currently. Quoting Cornelia Huck <cohuck@redhat.com>, "s390x is
        exceptional in that it has state in QEMU that is actually interesting
        for upper layers and can be retrieved without performance penalty". See
        also
        <https://www.redhat.com/archives/libvir-list/2018-February/msg00121.html>.
      
      Cc: Cornelia Huck <cohuck@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Cc: Viktor VM Mihajlovski <mihajlov@linux.vnet.ibm.com>
      Cc: qemu-stable@nongnu.org
      Fixes: ca230ff3
      Fixes: 25fa194bSigned-off-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NCornelia Huck <cohuck@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20180427192852.15013-2-lersek@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      96054f56
  19. 20 3月, 2018 4 次提交
  20. 14 3月, 2018 2 次提交
  21. 13 3月, 2018 1 次提交
  22. 07 3月, 2018 1 次提交
  23. 06 3月, 2018 2 次提交
    • A
      qmp: Add qom-list-properties to list QOM object properties · 961c47bb
      Alexey Kardashevskiy 提交于
      There is already 'device-list-properties' which does most of the job,
      however it does not handle everything returned by qom-list-types such
      as machines as they inherit directly from TYPE_OBJECT and not TYPE_DEVICE.
      It does not handle abstract classes either.
      
      This adds a new qom-list-properties command which prints properties
      of a specific class and its instance. It is pretty much a simplified copy
      of the device-list-properties handler.
      
      Since it creates an object instance, device properties should appear
      in the output as they are copied to QOM properties at the instance_init
      hook.
      
      This adds a object_class_property_iter_init() helper to allow class
      properties enumeration uses it in the new QMP command to allow properties
      listing for abstract classes.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Message-Id: <20180301130939.15875-3-aik@ozlabs.ru>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      961c47bb
    • A
      qmp: Merge ObjectPropertyInfo and DevicePropertyInfo · 35f63767
      Alexey Kardashevskiy 提交于
      ObjectPropertyInfo is more generic and only missing @description.
      This adds a description to ObjectPropertyInfo and removes
      DevicePropertyInfo so the resulting ObjectPropertyInfo can be used
      elsewhere.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Message-Id: <20180301130939.15875-2-aik@ozlabs.ru>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      35f63767
  24. 03 3月, 2018 4 次提交