Skip to content
Snippets Groups Projects
  1. Sep 30, 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
    • Stefan Hajnoczi's avatar
      fdmon-poll: reset npfd when upgrading to fdmon-epoll · 5cd9c382
      Stefan Hajnoczi authored
      
      npfd keeps track of how many pollfds are currently being monitored. It
      must be reset to 0 when fdmon_poll_wait() returns.
      
      When npfd reaches a treshold we switch to fdmon-epoll because it scales
      better.
      
      This patch resets npfd in the case where we switch to fdmon-epoll.
      Forgetting to do so results in the following assertion failure:
      
        util/fdmon-poll.c:65: fdmon_poll_wait: Assertion `npfd == 0' failed.
      
      Fixes: 1f050a46 ("aio-posix: extract ppoll(2) and epoll(7) fd monitoring")
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1869952
      Message-Id: <20200915120339.702938-2-stefanha@redhat.com>
      5cd9c382
    • Stefan Hajnoczi's avatar
      util/iov: add iov_discard_undo() · 9dd6f7c2
      Stefan Hajnoczi authored
      
      The iov_discard_front/back() operations are useful for parsing iovecs
      but they modify the array elements. If the original array is needed
      after parsing finishes there is currently no way to restore it.
      
      Although g_memdup() can be used before performing destructive
      iov_discard_front/back() operations, this is inefficient.
      
      Introduce iov_discard_undo() to restore the array to the state prior to
      an iov_discard_front/back() operation.
      
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarLi Qiang <liq3ea@gmail.com>
      Message-Id: <20200917094455.822379-2-stefanha@redhat.com>
      9dd6f7c2
  4. Sep 17, 2020
  5. Sep 16, 2020
  6. Sep 15, 2020
    • Gerd Hoffmann's avatar
      virtio-gpu: build modular · 7b0de5b7
      Gerd Hoffmann authored
      
      Only build virtio-gpu-device modular (the code which actually depends on
      the external virglrenderer library).  virtio-gpu-pci and virtio-vga are
      compiled into core qemu still.
      
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      Message-id: 20200914134224.29769-7-kraxel@redhat.com
      7b0de5b7
  7. Sep 11, 2020
  8. Sep 09, 2020
    • Markus Armbruster's avatar
      trace-events: Fix attribution of trace points to source · b15e402f
      Markus Armbruster authored
      
      Some trace points are attributed to the wrong source file.  Happens
      when we neglect to update trace-events for code motion, or add events
      in the wrong place, or misspell the file name.
      
      Clean up with help of scripts/cleanup-trace-events.pl.  Funnies
      requiring manual post-processing:
      
      * accel/tcg/cputlb.c trace points are in trace-events.
      
      * block.c and blockdev.c trace points are in block/trace-events.
      
      * hw/block/nvme.c uses the preprocessor to hide its trace point use
        from cleanup-trace-events.pl.
      
      * hw/tpm/tpm_spapr.c uses pseudo trace point tpm_spapr_show_buffer to
        guard debug code.
      
      * include/hw/xen/xen_common.h trace points are in hw/xen/trace-events.
      
      * linux-user/trace-events abbreviates a tedious list of filenames to
        */signal.c.
      
      * net/colo-compare and net/filter-rewriter.c use pseudo trace points
        colo_compare_miscompare and colo_filter_rewriter_debug to guard
        debug code.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Message-id: 20200806141334.3646302-5-armbru@redhat.com
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      b15e402f
  9. Sep 07, 2020
    • Thomas Huth's avatar
      stubs: Move qemu_fd_register stub to util/main-loop.c · 8c278762
      Thomas Huth authored
      
      The linker of MinGW sometimes runs into the following problem:
      
      libqemuutil.a(util_main-loop.c.obj): In function `qemu_fd_register':
      /builds/huth/qemu/build/../util/main-loop.c:331: multiple definition of
       `qemu_fd_register'
      libqemuutil.a(stubs_fd-register.c.obj):/builds/huth/qemu/stubs/fd-register.c:5:
       first defined here
      collect2: error: ld returned 1 exit status
      /builds/huth/qemu/rules.mak:88: recipe for target 'tests/test-timed-average.exe'
       failed
      
      qemu_fd_register() is defined in util/main-loop.c for WIN32, so let's simply
      move the stub also there in the #else part of the corresponding #ifndef
      to fix this problem.
      
      Message-Id: <20200903054503.425435-1-thuth@redhat.com>
      Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
      8c278762
  10. Sep 01, 2020
  11. Aug 21, 2020
    • Stefano Garzarella's avatar
      util/meson.build: fix fdmon-io_uring build · 6dd93c2b
      Stefano Garzarella authored
      
      libqemuutil.a build fails with this error:
      
        /usr/bin/ld: libqemuutil.a(util_fdmon-io_uring.c.o): in function `get_sqe':
        qemu/build/../util/fdmon-io_uring.c:83: undefined reference to `io_uring_get_sqe'
        /usr/bin/ld: qemu/build/../util/fdmon-io_uring.c:92: undefined reference to `io_uring_submit'
        /usr/bin/ld: qemu/build/../util/fdmon-io_uring.c:96: undefined reference to `io_uring_get_sqe'
        /usr/bin/ld: libqemuutil.a(util_fdmon-io_uring.c.o): in function `fdmon_io_uring_wait':
        qemu/build/../util/fdmon-io_uring.c:289: undefined reference to `io_uring_submit_and_wait'
        /usr/bin/ld: libqemuutil.a(util_fdmon-io_uring.c.o): in function `fdmon_io_uring_setup':
        qemu/build/../util/fdmon-io_uring.c:328: undefined reference to `io_uring_queue_init'
        /usr/bin/ld: libqemuutil.a(util_fdmon-io_uring.c.o): in function `fdmon_io_uring_destroy':
        qemu/build/../util/fdmon-io_uring.c:343: undefined reference to `io_uring_queue_exit'
        collect2: error: ld returned 1 exit status
      
      This patch fix the issue adding 'linux_io_uring' dependency for
      fdmon-io_uring.c
      
      Fixes: a81df1b6 ("libqemuutil, qapi, trace: convert to meson")
      Cc: pbonzini@redhat.com
      Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
      Message-Id: <20200821154853.94379-1-sgarzare@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      6dd93c2b
    • Paolo Bonzini's avatar
      meson: replace create-config with meson configure_file · 859aef02
      Paolo Bonzini authored
      
      Move the create-config logic to meson.build; create a
      configuration_data object and let meson handle the
      quoting and output.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      859aef02
    • Paolo Bonzini's avatar
      meson: link emulators without Makefile.target · 64ed6f92
      Paolo Bonzini authored
      
      The binaries move to the root directory, e.g. qemu-system-i386 or
      qemu-arm.  This requires changes to qtests, CI, etc.
      
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      64ed6f92
    • Paolo Bonzini's avatar
      libqemuutil, qapi, trace: convert to meson · a81df1b6
      Paolo Bonzini authored
      
      This shows how to do some "computations" in meson.build using its array
      and dictionary data structures, and also a basic usage of the sourceset
      module for conditional compilation.
      
      Notice the new "if have_system" part of util/meson.build, which fixes
      a bug in the old build system was buggy: util/dbus.c was built even for
      non-softmmu builds, but the dependency on -lgio was lost when the linking
      was done through libqemuutil.a.  Because all of its users required gio
      otherwise, the bug was hidden.  Meson instead propagates libqemuutil's
      dependencies down to its users, and shows the problem.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      a81df1b6
    • Paolo Bonzini's avatar
      trace: switch position of headers to what Meson requires · 243af022
      Paolo Bonzini authored
      
      Meson doesn't enjoy the same flexibility we have with Make in choosing
      the include path.  In particular the tracing headers are using
      $(build_root)/$(<D).
      
      In order to keep the include directives unchanged,
      the simplest solution is to generate headers with patterns like
      "trace/trace-audio.h" and place forwarding headers in the source tree
      such that for example "audio/trace.h" includes "trace/trace-audio.h".
      
      This patch is too ugly to be applied to the Makefiles now.  It's only
      a way to separate the changes to the tracing header files from the
      Meson rewrite of the tracing logic.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      243af022
  12. Aug 13, 2020
  13. Jul 27, 2020
  14. Jul 21, 2020
  15. Jul 20, 2020
  16. Jul 15, 2020
    • Laurent Vivier's avatar
      net: check if the file descriptor is valid before using it · 894022e6
      Laurent Vivier authored
      
      qemu_set_nonblock() checks that the file descriptor can be used and, if
      not, crashes QEMU. An assert() is used for that. The use of assert() is
      used to detect programming error and the coredump will allow to debug
      the problem.
      
      But in the case of the tap device, this assert() can be triggered by
      a misconfiguration by the user. At startup, it's not a real problem, but it
      can also happen during the hot-plug of a new device, and here it's a
      problem because we can crash a perfectly healthy system.
      
      For instance:
       # ip link add link virbr0 name macvtap0 type macvtap mode bridge
       # ip link set macvtap0 up
       # TAP=/dev/tap$(ip -o link show macvtap0 | cut -d: -f1)
       # qemu-system-x86_64 -machine q35 -device pcie-root-port,id=pcie-root-port-0 -monitor stdio 9<> $TAP
       (qemu) netdev_add type=tap,id=hostnet0,vhost=on,fd=9
       (qemu) device_add driver=virtio-net-pci,netdev=hostnet0,id=net0,bus=pcie-root-port-0
       (qemu) device_del net0
       (qemu) netdev_del hostnet0
       (qemu) netdev_add type=tap,id=hostnet1,vhost=on,fd=9
       qemu-system-x86_64: .../util/oslib-posix.c:247: qemu_set_nonblock: Assertion `f != -1' failed.
       Aborted (core dumped)
      
      To avoid that, add a function, qemu_try_set_nonblock(), that allows to report the
      problem without crashing.
      
      In the same way, we also update the function for vhostfd in net_init_tap_one() and
      for fd in net_init_socket() (both descriptors are provided by the user and can
      be wrong).
      
      Signed-off-by: default avatarLaurent Vivier <lvivier@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      894022e6
Loading