Skip to content
Snippets Groups Projects
  1. Mar 22, 2022
  2. Oct 29, 2021
  3. Oct 27, 2021
  4. Mar 19, 2021
    • Markus Armbruster's avatar
      qapi: New -compat deprecated-input=crash · dbb675c1
      Markus Armbruster authored
      
      Policy "crash" calls abort() when deprecated input is received.
      
      Bugs in integration tests may mask the error from policy "reject".
      Provide a larger hammer: crash outright.  Masking that seems unlikely.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20210318155519.1224118-12-armbru@redhat.com>
      dbb675c1
    • Markus Armbruster's avatar
      qapi: Implement deprecated-input=reject for QMP command arguments · db291641
      Markus Armbruster authored
      
      This policy rejects deprecated input, and thus permits "testing the
      future".  Implement it for QMP command arguments: reject commands with
      deprecated ones.  Example: when QEMU is run with -compat
      deprecated-input=reject, then
      
          {"execute": "eject", "arguments": {"device": "cd"}}
      
      fails like this
      
          {"error": {"class": "GenericError", "desc": "Deprecated parameter 'device' disabled by policy"}}
      
      When the deprecated parameter is removed, the error will change to
      
          {"error": {"class": "GenericError", "desc": "Parameter 'device' is unexpected"}}
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20210318155519.1224118-11-armbru@redhat.com>
      db291641
    • Markus Armbruster's avatar
      qapi: Implement deprecated-input=reject for QMP commands · d2032598
      Markus Armbruster authored
      
      This policy rejects deprecated input, and thus permits "testing the
      future".  Implement it for QMP commands: make deprecated ones fail.
      Example: when QEMU is run with -compat deprecated-input=reject, then
      
          {"execute": "query-cpus"}
      
      fails like this
      
          {"error": {"class": "CommandNotFound", "desc": "Deprecated command query-cpus disabled by policy"}}
      
      When the deprecated command is removed, the error will change to
      
          {"error": {"class": "CommandNotFound", "desc": "The command query-cpus has not been found"}}
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20210318155519.1224118-10-armbru@redhat.com>
      d2032598
    • Markus Armbruster's avatar
      qapi: Implement deprecated-output=hide for QMP command results · 91fa93e5
      Markus Armbruster authored
      
      This policy suppresses deprecated bits in output, and thus permits
      "testing the future".  Implement it for QMP command results.  Example:
      when QEMU is run with -compat deprecated-output=hide, then
      
          {"execute": "query-cpus-fast"}
      
      yields
      
          {"return": [{"thread-id": 9805, "props": {"core-id": 0, "thread-id": 0, "socket-id": 0}, "qom-path": "/machine/unattached/device[0]", "cpu-index": 0, "target": "x86_64"}]}
      
      instead of
      
          {"return": [{"arch": "x86", "thread-id": 22436, "props": {"core-id": 0, "thread-id": 0, "socket-id": 0}, "qom-path": "/machine/unattached/device[0]", "cpu-index": 0, "target": "x86_64"}]}
      
      Note the suppression of deprecated member "arch".
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20210318155519.1224118-4-armbru@redhat.com>
      91fa93e5
    • Markus Armbruster's avatar
      qemu-options: New -compat to set policy for deprecated interfaces · 6dd75472
      Markus Armbruster authored
      
      New option -compat lets you configure what to do when deprecated
      interfaces get used.  This is intended for testing users of the
      management interfaces.  It is experimental.
      
      -compat deprecated-input=<input-policy> configures what to do when
      deprecated input is received.  Input policy can be "accept" (accept
      silently), or "reject" (reject the request with an error).
      
      -compat deprecated-output=<out-policy> configures what to do when
      deprecated output is sent.  Output policy can be "accept" (pass on
      unchanged), or "hide" (filter out the deprecated parts).
      
      Default is "accept".  Policies other than "accept" are implemented
      later in this series.
      
      For now, -compat covers only syntactic aspects of QMP, i.e. stuff
      tagged with feature 'deprecated'.  We may want to extend it to cover
      semantic aspects, CLI, and experimental features.
      
      Note that there is no good way for management application to detect
      presence of -compat: it's not visible output of query-qmp-schema or
      query-command-line-options.  Tolerable, because it's meant for
      testing.  If running with -compat fails, skip the test.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20210318155519.1224118-3-armbru@redhat.com>
      6dd75472
  5. Mar 17, 2021
  6. Dec 15, 2020
  7. Oct 09, 2020
  8. Apr 02, 2020
    • Marc-André Lureau's avatar
      qmp: fix leak on callbacks that return both value and error · b3fbb328
      Marc-André Lureau authored
      
      Direct leak of 4120 byte(s) in 1 object(s) allocated from:
          #0 0x7fa114931887 in __interceptor_calloc (/lib64/libasan.so.6+0xb0887)
          #1 0x7fa1144ad8f0 in g_malloc0 (/lib64/libglib-2.0.so.0+0x588f0)
          #2 0x561e3c9c8897 in qmp_object_add /home/elmarco/src/qemu/qom/qom-qmp-cmds.c:291
          #3 0x561e3cf48736 in qmp_dispatch /home/elmarco/src/qemu/qapi/qmp-dispatch.c:155
          #4 0x561e3c8efb36 in monitor_qmp_dispatch /home/elmarco/src/qemu/monitor/qmp.c:145
          #5 0x561e3c8f09ed in monitor_qmp_bh_dispatcher /home/elmarco/src/qemu/monitor/qmp.c:234
          #6 0x561e3d08c993 in aio_bh_call /home/elmarco/src/qemu/util/async.c:136
          #7 0x561e3d08d0a5 in aio_bh_poll /home/elmarco/src/qemu/util/async.c:164
          #8 0x561e3d0a535a in aio_dispatch /home/elmarco/src/qemu/util/aio-posix.c:380
          #9 0x561e3d08e3ca in aio_ctx_dispatch /home/elmarco/src/qemu/util/async.c:298
          #10 0x7fa1144a776e in g_main_context_dispatch (/lib64/libglib-2.0.so.0+0x5276e)
      
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20200325184723.2029630-3-marcandre.lureau@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b3fbb328
  9. Mar 17, 2020
  10. Sep 28, 2019
  11. Aug 16, 2019
    • Markus Armbruster's avatar
      sysemu: Split sysemu/runstate.h off sysemu/sysemu.h · 54d31236
      Markus Armbruster authored
      
      sysemu/sysemu.h is a rather unfocused dumping ground for stuff related
      to the system-emulator.  Evidence:
      
      * It's included widely: in my "build everything" tree, changing
        sysemu/sysemu.h still triggers a recompile of some 1100 out of 6600
        objects (not counting tests and objects that don't depend on
        qemu/osdep.h, down from 5400 due to the previous two commits).
      
      * It pulls in more than a dozen additional headers.
      
      Split stuff related to run state management into its own header
      sysemu/runstate.h.
      
      Touching sysemu/sysemu.h now recompiles some 850 objects.  qemu/uuid.h
      also drops from 1100 to 850, and qapi/qapi-types-run-state.h from 4400
      to 4200.  Touching new sysemu/runstate.h recompiles some 500 objects.
      
      Since I'm touching MAINTAINERS to add sysemu/runstate.h anyway, also
      add qemu/main-loop.h.
      
      Suggested-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20190812052359.30071-30-armbru@redhat.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      [Unbreak OS-X build]
      54d31236
  12. Mar 26, 2019
  13. Mar 18, 2019
  14. Aug 30, 2018
  15. Aug 24, 2018
    • Markus Armbruster's avatar
      json: Redesign the callback to consume JSON values · 62815d85
      Markus Armbruster authored
      
      The classical way to structure parser and lexer is to have the client
      call the parser to get an abstract syntax tree, the parser call the
      lexer to get the next token, and the lexer call some function to get
      input characters.
      
      Another way to structure them would be to have the client feed
      characters to the lexer, the lexer feed tokens to the parser, and the
      parser feed abstract syntax trees to some callback provided by the
      client.  This way is more easily integrated into an event loop that
      dispatches input characters as they arrive.
      
      Our JSON parser is kind of between the two.  The lexer feeds tokens to
      a "streamer" instead of a real parser.  The streamer accumulates
      tokens until it got the sequence of tokens that comprise a single JSON
      value (it counts curly braces and square brackets to decide).  It
      feeds those token sequences to a callback provided by the client.  The
      callback passes each token sequence to the parser, and gets back an
      abstract syntax tree.
      
      I figure it was done that way to make a straightforward recursive
      descent parser possible.  "Get next token" becomes "pop the first
      token off the token sequence".  Drawback: we need to store a complete
      token sequence.  Each token eats 13 + input characters + malloc
      overhead bytes.
      
      Observations:
      
      1. This is not the only way to use recursive descent.  If we replaced
         "get next token" by a coroutine yield, we could do without a
         streamer.
      
      2. The lexer reports errors by passing a JSON_ERROR token to the
         streamer.  This communicates the offending input characters and
         their location, but no more.
      
      3. The streamer reports errors by passing a null token sequence to the
         callback.  The (already poor) lexical error information is thrown
         away.
      
      4. Having the callback receive a token sequence duplicates the code to
         convert token sequence to abstract syntax tree in every callback.
      
      5. Known bug: the streamer silently drops incomplete token sequences.
      
      This commit rectifies 4. by lifting the call of the parser from the
      callbacks into the streamer.  Later commits will address 3. and 5.
      
      The lifting removes a bug from qjson.c's parse_json(): it passed a
      pointer to a non-null Error * in certain cases, as demonstrated by
      check-qjson.c.
      
      json_parser_parse() is now unused.  It's a stupid wrapper around
      json_parser_parse_err().  Drop it, and rename json_parser_parse_err()
      to json_parser_parse().
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20180823164025.12553-35-armbru@redhat.com>
      62815d85
  16. Jul 03, 2018
  17. May 30, 2018
    • Igor Mammedov's avatar
      cli: add --preconfig option · 047f7038
      Igor Mammedov authored
      
      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: default avatarIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: default avatarEric 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: default avatarEduardo Habkost <ehabkost@redhat.com>
      047f7038
  18. May 04, 2018
  19. Mar 19, 2018
    • Peter Xu's avatar
      qmp: support out-of-band (oob) execution · cf869d53
      Peter Xu authored
      
      Having "allow-oob":true for a command does not mean that this command
      will always be run in out-of-band mode.  The out-of-band quick path will
      only be executed if we specify the extra "run-oob" flag when sending the
      QMP request:
      
          { "execute":   "command-that-allows-oob",
            "arguments": { ... },
            "control":   { "run-oob": true } }
      
      The "control" key is introduced to store this extra flag.  "control"
      field is used to store arguments that are shared by all the commands,
      rather than command specific arguments.  Let "run-oob" be the first.
      
      Note that in the patch I exported qmp_dispatch_check_obj() to be used to
      check the request earlier, and at the same time allowed "id" field to be
      there since actually we always allow that.
      
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
      Message-Id: <20180309090006.10018-19-peterx@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      [eblake: rebase to qobject_to(), spelling fix]
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      cf869d53
    • Hanna Reitz's avatar
      qapi: Replace qobject_to_X(o) by qobject_to(X, o) · 7dc847eb
      Hanna Reitz authored
      
      This patch was generated using the following Coccinelle script:
      
      @@
      expression Obj;
      @@
      (
      - qobject_to_qnum(Obj)
      + qobject_to(QNum, Obj)
      |
      - qobject_to_qstring(Obj)
      + qobject_to(QString, Obj)
      |
      - qobject_to_qdict(Obj)
      + qobject_to(QDict, Obj)
      |
      - qobject_to_qlist(Obj)
      + qobject_to(QList, Obj)
      |
      - qobject_to_qbool(Obj)
      + qobject_to(QBool, Obj)
      )
      
      and a bit of manual fix-up for overly long lines and three places in
      tests/check-qjson.c that Coccinelle did not find.
      
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      Reviewed-by: default avatarAlberto Garcia <berto@igalia.com>
      Message-Id: <20180224154033.29559-4-mreitz@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      [eblake: swap order from qobject_to(o, X), rebase to master, also a fix
      to latent false-positive compiler complaint about hw/i386/acpi-build.c]
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      7dc847eb
  20. Feb 09, 2018
Loading