Skip to content
Snippets Groups Projects
  1. Jun 05, 2023
    • Jean-Louis Dupond's avatar
      qcow2: add discard-no-unref option · 42a2890a
      Jean-Louis Dupond authored
      When we for example have a sparse qcow2 image and discard: unmap is enabled,
      there can be a lot of fragmentation in the image after some time. Especially on VM's
      that do a lot of writes/deletes.
      This causes the qcow2 image to grow even over 110% of its virtual size,
      because the free gaps in the image get too small to allocate new
      continuous clusters. So it allocates new space at the end of the image.
      
      Disabling discard is not an option, as discard is needed to keep the
      incremental backup size as low as possible. Without discard, the
      incremental backups would become large, as qemu thinks it's just dirty
      blocks but it doesn't know the blocks are unneeded.
      So we need to avoid fragmentation but also 'empty' the unneeded blocks in
      the image to have a small incremental backup.
      
      In addition, we also want to send the discards further down the stack, so
      the underlying blocks are still discarded.
      
      Therefor we introduce a new qcow2 option "discard-no-unref".
      When setting this option to true, discards will no longer have the qcow2
      driver relinquish cluster allocations. Other than that, the request is
      handled as normal: All clusters in range are marked as zero, and, if
      pass-discard-request is true, it is passed further down the stack.
      The only difference is that the now-zero clusters are preallocated
      instead of being unallocated.
      This will avoid fragmentation on the qcow2 image.
      
      Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1621
      
      
      Signed-off-by: default avatarJean-Louis Dupond <jean-louis@dupond.be>
      Message-Id: <20230605084523.34134-2-jean-louis@dupond.be>
      Reviewed-by: default avatarHanna Czenczek <hreitz@redhat.com>
      Signed-off-by: default avatarHanna Czenczek <hreitz@redhat.com>
      42a2890a
  2. Jun 02, 2023
    • Eric Blake's avatar
      cutils: Adjust signature of parse_uint[_full] · bd1386cc
      Eric Blake authored
      
      It's already confusing that we have two very similar functions for
      wrapping the parse of a 64-bit unsigned value, differing mainly on
      whether they permit leading '-'.  Adjust the signature of parse_uint()
      and parse_uint_full() to be like all of qemu_strto*(): put the result
      parameter last, use the same types (uint64_t and unsigned long long
      have the same width, but are not always the same type), and mark
      endptr const (this latter change only affects the rare caller of
      parse_uint).  Adjust all callers in the tree.
      
      While at it, note that since cutils.c already includes:
      
          QEMU_BUILD_BUG_ON(sizeof(int64_t) != sizeof(long long));
      
      we are guaranteed that the result of parse_uint* cannot exceed
      UINT64_MAX (or the build would have failed), so we can drop
      pre-existing dead comparisons in opts-visitor.c that were never false.
      
      Reviewed-by: default avatarHanna Czenczek <hreitz@redhat.com>
      Message-Id: <20230522190441.64278-8-eblake@redhat.com>
      [eblake: Drop dead code spotted by Markus]
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      bd1386cc
  3. Jun 01, 2023
  4. May 28, 2023
  5. May 23, 2023
  6. May 22, 2023
  7. May 15, 2023
  8. May 10, 2023
    • Vladimir Sementsov-Ogievskiy's avatar
      build: move COLO under CONFIG_REPLICATION · 51e47cf8
      Vladimir Sementsov-Ogievskiy authored
      
      We don't allow to use x-colo capability when replication is not
      configured. So, no reason to build COLO when replication is disabled,
      it's unusable in this case.
      
      Note also that the check in migrate_caps_check() is not the only
      restriction: some functions in migration/colo.c will just abort if
      called with not defined CONFIG_REPLICATION, for example:
      
          migration_iteration_finish()
             case MIGRATION_STATUS_COLO:
                 migrate_start_colo_process()
                     colo_process_checkpoint()
                         abort()
      
      It could probably make sense to have possibility to enable COLO without
      REPLICATION, but this requires deeper audit of colo & replication code,
      which may be done later if needed.
      
      Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
      Acked-by: default avatarDr. David Alan Gilbert <dave@treblig.org>
      Reviewed-by: default avatarJuan Quintela <quintela@redhat.com>
      Message-Id: <20230428194928.1426370-4-vsementsov@yandex-team.ru>
      Signed-off-by: default avatarJuan Quintela <quintela@redhat.com>
      51e47cf8
    • Markus Armbruster's avatar
      qapi: Reformat doc comments to conform to current conventions · a937b6aa
      Markus Armbruster authored
      
      Change
      
          # @name: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
          #        do eiusmod tempor incididunt ut labore et dolore magna aliqua.
      
      to
      
          # @name: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
          #     do eiusmod tempor incididunt ut labore et dolore magna aliqua.
      
      See recent commit "qapi: Relax doc string @name: description
      indentation rules" for rationale.
      
      Reflow paragraphs to 70 columns width, and consistently use two spaces
      to separate sentences.
      
      To check the generated documentation does not change, I compared the
      generated HTML before and after this commit with "wdiff -3".  Finds no
      differences.  Comparing with diff is not useful, as the reflown
      paragraphs are visible there.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20230428105429.1687850-18-armbru@redhat.com>
      Reviewed-by: default avatarJuan Quintela <quintela@redhat.com>
      Acked-by: default avatarLukas Straub <lukasstraub2@web.de>
      [Straightforward conflicts in qapi/audio.json qapi/misc-target.json
      qapi/run-state.json resolved]
      a937b6aa
  9. May 09, 2023
  10. May 05, 2023
    • Dorinda Bassey's avatar
      audio/pwaudio.c: Add Pipewire audio backend for QEMU · c2d3d1c2
      Dorinda Bassey authored
      
      This commit adds a new audiodev backend to allow QEMU to use Pipewire as
      both an audio sink and source. This backend is available on most systems
      
      Add Pipewire entry points for QEMU Pipewire audio backend
      Add wrappers for QEMU Pipewire audio backend in qpw_pcm_ops()
      qpw_write function returns the current state of the stream to pwaudio
      and Writes some data to the server for playback streams using pipewire
      spa_ringbuffer implementation.
      qpw_read function returns the current state of the stream to pwaudio and
      reads some data from the server for capture streams using pipewire
      spa_ringbuffer implementation. These functions qpw_write and qpw_read
      are called during playback and capture.
      Added some functions that convert pw audio formats to QEMU audio format
      and vice versa which would be needed in the pipewire audio sink and
      source functions qpw_init_in() & qpw_init_out().
      These methods that implement playback and recording will create streams
      for playback and capture that will start processing and will result in
      the on_process callbacks to be called.
      Built a connection to the Pipewire sound system server in the
      qpw_audio_init() method.
      
      Signed-off-by: default avatarDorinda Bassey <dbassey@redhat.com>
      Reviewed-by: default avatarVolker Rümelin <vr_qemu@t-online.de>
      Message-Id: <20230417105654.32328-1-dbassey@redhat.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      c2d3d1c2
    • Daniel Henrique Barboza's avatar
      target/riscv: add query-cpy-definitions support · c0177f91
      Daniel Henrique Barboza authored
      
      This command is used by tooling like libvirt to retrieve a list of
      supported CPUs. Each entry returns a CpuDefinitionInfo object that
      contains more information about each CPU.
      
      This initial support includes only the name of the CPU and its typename.
      Here's what the command produces for the riscv64 target:
      
      $ ./build/qemu-system-riscv64 -S -M virt -display none -qmp stdio
      {"QMP": {"version": (...)}
      {"execute": "qmp_capabilities", "arguments": {"enable": ["oob"]}}
      {"return": {}}
      {"execute": "query-cpu-definitions"}
      {"return": [
      {"name": "rv64", "typename": "rv64-riscv-cpu", "static": false, "deprecated": false},
      {"name": "sifive-e51", "typename": "sifive-e51-riscv-cpu", "static": false, "deprecated": false},
      {"name": "any", "typename": "any-riscv-cpu", "static": false, "deprecated": false},
      {"name": "x-rv128", "typename": "x-rv128-riscv-cpu", "static": false, "deprecated": false},
      {"name": "shakti-c", "typename": "shakti-c-riscv-cpu", "static": false, "deprecated": false},
      {"name": "thead-c906", "typename": "thead-c906-riscv-cpu", "static": false, "deprecated": false},
      {"name": "sifive-u54", "typename": "sifive-u54-riscv-cpu", "static": false, "deprecated": false}]
      }
      
      Next patch will introduce a way to tell whether a given CPU is static or
      not.
      
      Signed-off-by: default avatarDaniel Henrique Barboza <dbarboza@ventanamicro.com>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Reviewed-by: default avatarAlistair Francis <alistair.francis@wdc.com>
      Message-Id: <20230411183511.189632-3-dbarboza@ventanamicro.com>
      Signed-off-by: default avatarAlistair Francis <alistair.francis@wdc.com>
      c0177f91
  11. May 02, 2023
  12. Apr 28, 2023
  13. Apr 24, 2023
  14. Apr 20, 2023
    • Paolo Bonzini's avatar
      monitor: mark mixed functions that can suspend · a50c99bc
      Paolo Bonzini authored
      
      There should be no paths from a coroutine_fn to aio_poll, however in
      practice coroutine_mixed_fn will call aio_poll in the !qemu_in_coroutine()
      path.  By marking mixed functions, we can track accurately the call paths
      that execute entirely in coroutine context, and find more missing
      coroutine_fn markers.  This results in more accurate checks that
      coroutine code does not end up blocking.
      
      If the marking were extended transitively to all functions that call
      these ones, static analysis could be done much more efficiently.
      However, this is a start and makes it possible to use vrc's path-based
      searches to find potential bugs where coroutine_fns call blocking functions.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      a50c99bc
  15. Mar 14, 2023
  16. Mar 13, 2023
  17. Mar 07, 2023
    • Jonathan Cameron's avatar
      hw/mem/cxl_type3: Add CXL RAS Error Injection Support. · 415442a1
      Jonathan Cameron authored
      
      CXL uses PCI AER Internal errors to signal to the host that an error has
      occurred. The host can then read more detailed status from the CXL RAS
      capability.
      
      For uncorrectable errors: support multiple injection in one operation
      as this is needed to reliably test multiple header logging support in an
      OS. The equivalent feature doesn't exist for correctable errors, so only
      one error need be injected at a time.
      
      Note:
       - Header content needs to be manually specified in a fashion that
         matches the specification for what can be in the header for each
         error type.
      
      Injection via QMP:
      { "execute": "qmp_capabilities" }
      ...
      { "execute": "cxl-inject-uncorrectable-errors",
        "arguments": {
          "path": "/machine/peripheral/cxl-pmem0",
          "errors": [
              {
                  "type": "cache-address-parity",
                  "header": [ 3, 4]
              },
              {
                  "type": "cache-data-parity",
                  "header": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]
              },
              {
                  "type": "internal",
                  "header": [ 1, 2, 4]
              }
              ]
        }}
      ...
      { "execute": "cxl-inject-correctable-error",
          "arguments": {
              "path": "/machine/peripheral/cxl-pmem0",
              "type": "physical"
          } }
      
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Message-Id: <20230302133709.30373-9-Jonathan.Cameron@huawei.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      415442a1
    • Zhenwei Pi's avatar
      cryptodev: Support query-stats QMP command · f2b90109
      Zhenwei Pi authored
      
      Now we can use "query-stats" QMP command to query statistics of
      crypto devices. (Originally this was designed to show statistics
      by '{"execute": "query-cryptodev"}'. Daniel Berrangé suggested that
      querying configuration info by "query-cryptodev", and querying
      runtime performance info by "query-stats". This makes sense!)
      
      Example:
      ~# virsh qemu-monitor-command vm '{"execute": "query-stats", \
         "arguments": {"target": "cryptodev"} }' | jq
      {
        "return": [
          {
            "provider": "cryptodev",
            "stats": [
              {
                "name": "asym-verify-bytes",
                "value": 7680
              },
              ...
              {
                "name": "asym-decrypt-ops",
                "value": 32
              },
              {
                "name": "asym-encrypt-ops",
                "value": 48
              }
            ],
            "qom-path": "/objects/cryptodev0" # support asym only
          },
          {
            "provider": "cryptodev",
            "stats": [
              {
                "name": "asym-verify-bytes",
                "value": 0
              },
              ...
              {
                "name": "sym-decrypt-bytes",
                "value": 5376
              },
              ...
            ],
            "qom-path": "/objects/cryptodev1" # support asym/sym
          }
        ],
        "id": "libvirt-422"
      }
      
      Suggested-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Signed-off-by: default avatarzhenwei pi <pizhenwei@bytedance.com>
      Message-Id: <20230301105847.253084-12-pizhenwei@bytedance.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      f2b90109
    • Zhenwei Pi's avatar
      cryptodev: support QoS · 2580b452
      Zhenwei Pi authored
      
      Add 'throttle-bps' and 'throttle-ops' limitation to set QoS. The
      two arguments work with both QEMU command line and QMP command.
      
      Example of QEMU command line:
      -object cryptodev-backend-builtin,id=cryptodev1,throttle-bps=1600,\
      throttle-ops=100
      
      Example of QMP command:
      virsh qemu-monitor-command buster --hmp qom-set /objects/cryptodev1 \
      throttle-ops 100
      
      or cancel limitation:
      virsh qemu-monitor-command buster --hmp qom-set /objects/cryptodev1 \
      throttle-ops 0
      
      Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Signed-off-by: default avatarzhenwei pi <pizhenwei@bytedance.com>
      Message-Id: <20230301105847.253084-11-pizhenwei@bytedance.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      2580b452
Loading