Skip to content
Snippets Groups Projects
  1. Oct 09, 2020
  2. Sep 29, 2020
  3. Sep 23, 2020
    • Stefan Hajnoczi's avatar
      qemu/atomic.h: rename atomic_ to qatomic_ · d73415a3
      Stefan Hajnoczi authored
      
      clang's C11 atomic_fetch_*() functions only take a C11 atomic type
      pointer argument. QEMU uses direct types (int, etc) and this causes a
      compiler error when a QEMU code calls these functions in a source file
      that also included <stdatomic.h> via a system header file:
      
        $ CC=clang CXX=clang++ ./configure ... && make
        ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
      
      Avoid using atomic_*() names in QEMU's atomic.h since that namespace is
      used by <stdatomic.h>. Prefix QEMU's APIs with 'q' so that atomic.h
      and <stdatomic.h> can co-exist. I checked /usr/include on my machine and
      searched GitHub for existing "qatomic_" users but there seem to be none.
      
      This patch was generated using:
      
        $ git grep -h -o '\<atomic\(64\)\?_[a-z0-9_]\+' include/qemu/atomic.h | \
          sort -u >/tmp/changed_identifiers
        $ for identifier in $(</tmp/changed_identifiers); do
              sed -i "s%\<$identifier\>%q$identifier%g" \
                  $(git grep -I -l "\<$identifier\>")
          done
      
      I manually fixed line-wrap issues and misaligned rST tables.
      
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <20200923105646.47864-1-stefanha@redhat.com>
      d73415a3
    • Marc Hartmayer's avatar
      libvhost-user: handle endianness as mandated by the spec · 2ffc5470
      Marc Hartmayer authored
      Since virtio existed even before it got standardized, the virtio
      standard defines the following types of virtio devices:
      
       + legacy device (pre-virtio 1.0)
       + non-legacy or VIRTIO 1.0 device
       + transitional device (which can act both as legacy and non-legacy)
      
      Virtio 1.0 defines the fields of the virtqueues as little endian,
      while legacy uses guest's native endian [1]. Currently libvhost-user
      does not handle virtio endianness at all, i.e. it works only if the
      native endianness matches with whatever is actually needed. That means
      things break spectacularly on big-endian targets. Let us handle virtio
      endianness for non-legacy as required by the virtio specification [1]
      and fence legacy virtio, as there is no safe way to figure out the
      needed endianness conversions for all cases. The fencing of legacy
      virtio devices is done in `vu_set_features_exec`.
      
      [1] https://docs.oasis-open.org/virtio/virtio/v1.1/cs01/virtio-v1.1-cs01.html#x1-210003
      
      
      
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMarc Hartmayer <mhartmay@linux.ibm.com>
      Message-id: 20200901150019.29229-3-mhartmay@linux.ibm.com
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      2ffc5470
  4. Sep 17, 2020
  5. Sep 10, 2020
    • Alex Bennée's avatar
      plugins: move the more involved plugins to contrib · c17a386b
      Alex Bennée authored
      
      We have an exploding complexity problem in the testing so lets just
      move the more involved plugins into contrib. tests/plugins still exist
      for the basic plugins that exercise the API. We restore the old
      pre-meson style Makefile for contrib as it also doubles as a guide for
      out-of-tree plugin builds.
      
      While we are at it add some examples to the documentation and a
      specific plugins build target.
      
      Signed-off-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-Id: <20200909112742.25730-11-alex.bennee@linaro.org>
      c17a386b
  6. Sep 01, 2020
  7. Aug 27, 2020
  8. Aug 21, 2020
  9. Jul 27, 2020
  10. Jul 10, 2020
    • Markus Armbruster's avatar
      qemu-option: Use returned bool to check for failure · 235e59cf
      Markus Armbruster authored
      
      The previous commit enables conversion of
      
          foo(..., &err);
          if (err) {
              ...
          }
      
      to
      
          if (!foo(..., &err)) {
              ...
          }
      
      for QemuOpts functions that now return true / false on success /
      error.  Coccinelle script:
      
          @@
          identifier fun = {
              opts_do_parse, parse_option_bool, parse_option_number,
              parse_option_size, qemu_opt_parse, qemu_opt_rename, qemu_opt_set,
              qemu_opt_set_bool, qemu_opt_set_number, qemu_opts_absorb_qdict,
              qemu_opts_do_parse, qemu_opts_from_qdict_entry, qemu_opts_set,
              qemu_opts_validate
          };
          expression list args, args2;
          typedef Error;
          Error *err;
          @@
          -    fun(args, &err, args2);
          -    if (err)
          +    if (!fun(args, &err, args2))
               {
                   ...
               }
      
      A few line breaks tidied up manually.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-Id: <20200707160613.848843-15-armbru@redhat.com>
      [Conflict with commit 0b6786a9 "block/amend: refactor qcow2 amend
      options" resolved by rerunning Coccinelle on master's version]
      235e59cf
  11. Jun 12, 2020
    • Stefan Hajnoczi's avatar
      libvhost-user: advertise vring features · a9a5c473
      Stefan Hajnoczi authored
      
      libvhost-user implements several vring features without advertising
      them. There is no way for the vhost-user master to detect support for
      these features.
      
      Things more or less work today because QEMU assumes the vhost-user
      backend always implements certain feature bits like
      VIRTIO_RING_F_EVENT_IDX. This is not documented anywhere.
      
      This patch explicitly advertises features implemented in libvhost-user
      so that the vhost-user master does not need to make undocumented
      assumptions.
      
      Feature bits that libvhost-user now advertises can be removed from
      vhost-user-blk.c. Devices should not be responsible for advertising
      vring feature bits, that is libvhost-user's job.
      
      Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Message-Id: <20200529161338.456017-1-stefanha@redhat.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      a9a5c473
    • Raphael Norwitz's avatar
      Lift max ram slots limit in libvhost-user · b650d5f4
      Raphael Norwitz authored
      
      Historically, VMs with vhost-user devices could hot-add memory a maximum
      of 8 times. Now that the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS
      protocol feature has been added, VMs with vhost-user backends which
      support this new feature can support a configurable number of ram slots
      up to the maximum supported by the target platform.
      
      This change adds VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS support for
      backends built with libvhost-user, and increases the number of supported
      ram slots from 8 to 32.
      
      Memory hot-add, hot-remove and postcopy migration were tested with
      the vhost-user-bridge sample.
      
      Signed-off-by: default avatarRaphael Norwitz <raphael.norwitz@nutanix.com>
      Message-Id: <1588533678-23450-11-git-send-email-raphael.norwitz@nutanix.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      b650d5f4
    • Raphael Norwitz's avatar
      Support individual region unmap in libvhost-user · 875b9fd9
      Raphael Norwitz authored
      
      When the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS protocol feature is
      enabled, on memory hot-unplug qemu will transmit memory regions to
      remove individually using the new message VHOST_USER_REM_MEM_REG
      message. With this change, vhost-user backends build with libvhost-user
      can now unmap individual memory regions when receiving the
      VHOST_USER_REM_MEM_REG message.
      
      Qemu only sends VHOST_USER_REM_MEM_REG messages when the
      VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS feature is negotiated, and
      support for that feature has not yet been added in libvhost-user, this
      new functionality is not yet used.
      
      Signed-off-by: default avatarRaphael Norwitz <raphael.norwitz@nutanix.com>
      Message-Id: <1588533678-23450-10-git-send-email-raphael.norwitz@nutanix.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      875b9fd9
    • Raphael Norwitz's avatar
      Support adding individual regions in libvhost-user · ec94c8e6
      Raphael Norwitz authored
      
      When the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS is enabled, qemu will
      transmit memory regions to a backend individually using the new message
      VHOST_USER_ADD_MEM_REG. With this change vhost-user backends built with
      libvhost-user can now map in new memory regions when VHOST_USER_ADD_MEM_REG
      messages are received.
      
      Qemu only sends VHOST_USER_ADD_MEM_REG messages when the
      VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS feature is negotiated, and
      since it is not yet supported in libvhost-user, this new functionality
      is not yet used.
      
      Signed-off-by: default avatarRaphael Norwitz <raphael.norwitz@nutanix.com>
      Message-Id: <1588533678-23450-9-git-send-email-raphael.norwitz@nutanix.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      ec94c8e6
    • Raphael Norwitz's avatar
      Support ram slot configuration in libvhost-user · 6fb2e173
      Raphael Norwitz authored
      
      The VHOST_USER_GET_MAX_MEM_SLOTS message allows a vhost-user backend to
      specify a maximum number of ram slots it is willing to support. This
      change adds support for libvhost-user to process this message. For now
      the backend will reply with 8 as the maximum number of regions
      supported.
      
      libvhost-user does not yet support the vhost-user protocol feature
      VHOST_USER_PROTOCOL_F_CONFIGIRE_MEM_SLOTS, so qemu should never
      send the VHOST_USER_GET_MAX_MEM_SLOTS message. Therefore this new
      functionality is not currently used.
      
      Signed-off-by: default avatarRaphael Norwitz <raphael.norwitz@nutanix.com>
      Message-Id: <1588533678-23450-8-git-send-email-raphael.norwitz@nutanix.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      6fb2e173
    • Raphael Norwitz's avatar
      Refactor out libvhost-user fault generation logic · 08fccf8f
      Raphael Norwitz authored
      
      In libvhost-user, the incoming postcopy migration path for setting the
      backend's memory tables has become convolued. In particular, moving the
      logic which starts generating faults, having received the final ACK from
      qemu can be moved to a separate function. This simplifies the code
      substantially.
      
      This logic will also be needed by the postcopy path once the
      VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS feature is supported.
      
      Signed-off-by: default avatarRaphael Norwitz <raphael.norwitz@nutanix.com>
      Message-Id: <1588533678-23450-7-git-send-email-raphael.norwitz@nutanix.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      08fccf8f
  12. Apr 15, 2020
  13. Mar 16, 2020
Loading