- Sep 30, 2020
-
-
Paolo Bonzini authored
Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Add the function that will compute a relocated version of the directories in CONFIG_QEMU_*DIR and CONFIG_QEMU_*PATH. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
If the exec_dir cannot be retrieved, just assume it's the installation directory that was specified at configure time. This makes it simpler to reason about what the callers will do if they get back an empty path. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Just return the directory without requiring the caller to free it. This also removes a bogus check for NULL in os_find_datadir and module_load_one; g_strdup of a static variable cannot return NULL. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Sep 29, 2020
-
-
Laurent Vivier authored
Dumping one line of hexadecimal/ASCII from a buffer is often needed. Move this part from qemu_hexdump() and use it Acked-by:
Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by:
Laurent Vivier <lvivier@redhat.com> Message-Id: <20200925091055.186023-2-lvivier@redhat.com> Reviewed-by:
Michael S. Tsirkin <mst@redhat.com> Signed-off-by:
Michael S. Tsirkin <mst@redhat.com>
-
- Sep 23, 2020
-
-
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:
Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by:
Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200923105646.47864-1-stefanha@redhat.com>
-
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:
Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1869952 Message-Id: <20200915120339.702938-2-stefanha@redhat.com>
-
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:
Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by:
Li Qiang <liq3ea@gmail.com> Message-Id: <20200917094455.822379-2-stefanha@redhat.com>
-
- Sep 17, 2020
-
-
zhaolichang authored
I found that there are many spelling errors in the comments of qemu, so I used the spellcheck tool to check the spelling errors and finally found some spelling errors in the util folder. Signed-off-by:
zhaolichang <zhaolichang@huawei.com> Reviewed-by:
Alex Bennee <alex.bennee@linaro.org> Message-Id: <20200917075029.313-6-zhaolichang@huawei.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
- Sep 16, 2020
-
-
Yonggang Luo authored
This is a fixes for (C:\work\xemu\qemu\build\tests\test-aio-multithread.exe:19100): GLib-CRITICAL **: 23:03:24.965: g_source_remove_poll: assertion '!SOURCE_DESTROYED (source)' failed ERROR test-aio-multithread - Bail out! GLib-FATAL-CRITICAL: g_source_remove_poll: assertion '!SOURCE_DESTROYED (source)' failed (C:\work\xemu\qemu\build\tests\test-bdrv-drain.exe:21036): GLib-CRITICAL **: 23:03:29.861: g_source_remove_poll: assertion '!SOURCE_DESTROYED (source)' failed ERROR test-bdrv-drain - Bail out! GLib-FATAL-CRITICAL: g_source_remove_poll: assertion '!SOURCE_DESTROYED (source)' failed And the idea comes from https://patchwork.kernel.org/patch/9975239/ Signed-off-by:
Yonggang Luo <luoyonggang@gmail.com> Message-Id: <20200915171234.236-19-luoyonggang@gmail.com> Signed-off-by:
Thomas Huth <thuth@redhat.com>
-
Daniel P. Berrangé authored
A common error scenario is to tell QEMU to use O_DIRECT in combination with a filesystem that doesn't support it. To aid users to diagnosing their mistake we want to provide a clear error message when this happens. Reviewed-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Eric Blake <eblake@redhat.com> Signed-off-by:
Daniel P. Berrangé <berrange@redhat.com>
-
Daniel P. Berrangé authored
qemu_open_old() works like open(): set errno and return -1 on failure. It has even more failure modes, though. Reporting the error clearly to users is basically impossible for many of them. Our standard cure for "errno is too coarse" is the Error object. Introduce two new helper methods: int qemu_open(const char *name, int flags, Error **errp); int qemu_create(const char *name, int flags, mode_t mode, Error **errp); Note that with this design we no longer require or even accept the O_CREAT flag. Avoiding overloading the two distinct operations means we can avoid variable arguments which would prevent 'errp' from being the last argument. It also gives us a guarantee that the 'mode' is given when creating files, avoiding a latent security bug. Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Daniel P. Berrangé <berrange@redhat.com>
-
Daniel P. Berrangé authored
Instead of relying on the limited information from errno, we can now also provide detailed error messages to callers that ask for it. Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Daniel P. Berrangé <berrange@redhat.com>
-
Daniel P. Berrangé authored
This simple refactoring prepares for future patches. The variadic args handling is split from the main bulk of the open logic. Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Daniel P. Berrangé <berrange@redhat.com>
-
Daniel P. Berrangé authored
We want to introduce a new version of qemu_open() that uses an Error object for reporting problems and make this it the preferred interface. Rename the existing method to release the namespace for the new impl. Reviewed-by:
Eric Blake <eblake@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Daniel P. Berrangé <berrange@redhat.com>
-
Daniel P. Berrangé authored
We're going to have multiple callers to open() from qemu_open() soon. Readability would thus benefit from having a helper for dealing with O_CLOEXEC. Reviewed-by:
Markus Armbruster <armbru@redhat.com> Signed-off-by:
Daniel P. Berrangé <berrange@redhat.com>
-
Daniel P. Berrangé authored
Currently code has to call monitor_fdset_get_fd, then dup the return fd, and then add the duplicate FD back into the fdset. This dance is overly verbose for the caller and introduces extra failure modes which can be avoided by folding all the logic into monitor_fdset_dup_fd_add and removing monitor_fdset_get_fd entirely. Signed-off-by:
Daniel P. Berrangé <berrange@redhat.com>
-
Maxim Levitsky authored
This will allow is to preserve the semantics of hmp_device_del, that the device is deleted immediatly which was changed by previos patch that delayed this to RCU callback Signed-off-by:
Maxim Levitsky <mlevitsk@redhat.com> Suggested-by:
Stefan Hajnoczi <stefanha@gmail.com> Reviewed-by:
Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20200915121318.247-2-luoyonggang@gmail.com> Signed-off-by:
Thomas Huth <thuth@redhat.com>
-
- Sep 15, 2020
-
-
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:
Gerd Hoffmann <kraxel@redhat.com> Message-id: 20200914134224.29769-7-kraxel@redhat.com
-
- Sep 11, 2020
-
-
Philippe Mathieu-Daudé authored
qemu_hexdump()'s pointer to the buffer and length of the buffer are closely related arguments but are widely separated in the argument list order (also, the format of <stdio.h> function prototypes is usually to have the FILE* argument coming first). Reorder the arguments as "fp, prefix, buf, size" which is more logical. Suggested-by:
Peter Maydell <peter.maydell@linaro.org> Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by:
Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by:
Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20200822180950.1343963-3-f4bug@amsat.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Philippe Mathieu-Daudé authored
Most uses of qemu_hexdump() do not take an array of char as input, forcing use of cast. Since we can use this helper to dump any kind of buffer, use a pointer to void argument instead. Signed-off-by:
Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by:
Alistair Francis <alistair.francis@wdc.com> Reviewed-by:
Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by:
Li Qiang <liq3ea@gmail.com> Reviewed-by:
Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20200822180950.1343963-2-f4bug@amsat.org> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
- Sep 09, 2020
-
-
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:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20200806141334.3646302-5-armbru@redhat.com Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
- Sep 07, 2020
-
-
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:
Paolo Bonzini <pbonzini@redhat.com> Reviewed-by:
Daniel P. Berrangé <berrange@redhat.com> Signed-off-by:
Thomas Huth <thuth@redhat.com>
-
- Sep 01, 2020
-
-
Philippe Mathieu-Daudé authored
Some 'qemu_vfio_*' trace events sizes are displayed using decimal notation, other using hexadecimal notation: qemu_vfio_ram_block_added s 0xaaaaf2448d90 host 0xffff5bc00000 size 0x4000000 qemu_vfio_dma_map s 0xaaaaf2448d90 host 0xffff5bc00000 size 67108864 temporary 0 iova (nil) qemu_vfio_find_mapping s 0xaaaaf2448d90 host 0xffff5bc00000 qemu_vfio_new_mapping s 0xaaaaf2448d90 host 0xffff5bc00000 size 67108864 index 4 iova 0x114000 qemu_vfio_do_mapping s 0xaaaaf2448d90 host 0xffff5bc00000 size 67108864 iova 0x114000 As it is hard to follow, unify using hexadecimal for all sizes: qemu_vfio_ram_block_added s 0xaaaaf1c60d90 host 0xffff2bc00000 size 0x4000000 qemu_vfio_dma_map s 0xaaaaf1c60d90 host 0xffff2bc00000 size 0x4000000 temporary 0 iova (nil) qemu_vfio_find_mapping s 0xaaaaf1c60d90 host 0xffff2bc00000 qemu_vfio_new_mapping s 0xaaaaf1c60d90 host 0xffff2bc00000 size 0x4000000 index 4 iova 0x114000 qemu_vfio_do_mapping s 0xaaaaf1c60d90 host 0xffff2bc00000 size 0x4000000 iova 0x114000 Signed-off-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Cornelia Huck <cohuck@redhat.com> Reviewed-by:
Li Qiang <liq3ea@gmail.com> Message-Id: <20200820171006.1140228-1-philmd@redhat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Philippe Mathieu-Daudé authored
Remove the second 'and' introduced in commit 418026ca ("util: Introduce vfio helpers"). Signed-off-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Li Qiang <liq3ea@gmail.com> Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200811151643.21293-4-philmd@redhat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
Philippe Mathieu-Daudé authored
Remove the second 'and' introduced in commit e81f8679 ("qemu-timer: avoid checkpoints for virtual clock timers in external subsystems"). Signed-off-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Li Qiang <liq3ea@gmail.com> Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200811151643.21293-3-philmd@redhat.com> Signed-off-by:
Laurent Vivier <laurent@vivier.eu>
-
- Aug 21, 2020
-
-
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:
Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20200821154853.94379-1-sgarzare@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
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:
Paolo Bonzini <pbonzini@redhat.com>
-
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:
Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
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:
Paolo Bonzini <pbonzini@redhat.com>
-
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:
Paolo Bonzini <pbonzini@redhat.com>
-
- Aug 13, 2020
-
-
Stefan Hajnoczi authored
Polling only monitors the ctx->notified field and does not need the ctx->notifier EventNotifier to be signalled. Keep ctx->aio_notify_me disabled while polling to avoid unnecessary EventNotifier syscalls. This optimization improves virtio-blk 4KB random read performance by 18%. The following results are with an IOThread and the null-co block driver: Test IOPS Error Before 244518.62 ± 1.20% After 290706.11 ± 0.44% Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20200806131802.569478-4-stefanha@redhat.com Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
Stefan Hajnoczi authored
aio_notify() does not set ctx->notified when called with ctx->aio_notify_me disabled. Therefore aio_notify_me needs to be enabled during polling. This is suboptimal since expensive event_notifier_set(&ctx->notifier) and event_notifier_test_and_clear(&ctx->notifier) calls are required when ctx->aio_notify_me is enabled. Change aio_notify() so that aio->notified is always set, regardless of ctx->aio_notify_me. This will make polling cheaper since ctx->aio_notify_me can remain disabled. Move the event_notifier_test_and_clear() to the fd handler function (which is now no longer an empty function so "dummy" has been dropped from its name). The next patch takes advantage of this by optimizing polling in util/aio-posix.c. Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20200806131802.569478-3-stefanha@redhat.com [Paolo Bonzini pointed out that the smp_wmb() in aio_notify_accept() should be smp_wb() but the comment should be smp_wmb() instead of smp_wb(). Fixed. --Stefan] Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
Stefan Hajnoczi authored
The event_notifier_*() prefix can be confused with the EventNotifier APIs that are also called event_notifier_*(). Rename the functions to aio_context_notifier_*() to make it clear that they relate to the AioContext::notifier field. Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com> Message-id: 20200806131802.569478-2-stefanha@redhat.com Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
- Jul 27, 2020
-
-
Alex Bennée authored
Compile tested only. Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> Reviewed-by:
Stefan Weil <sw@weilnetz.de> Message-Id: <20200724064509.331-6-alex.bennee@linaro.org>
-
Alex Bennée authored
This will be used in a future patch. For POSIX systems _SC_PHYS_PAGES isn't standardised but at least appears in the man pages for Open/FreeBSD. The result is advisory so any users of it shouldn't just fail if we can't work it out. The win32 stub currently returns 0 until someone with a Windows system can develop and test a patch. Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Cc: BALATON Zoltan <balaton@eik.bme.hu> Cc: Christian Ehrhardt <christian.ehrhardt@canonical.com> Message-Id: <20200724064509.331-5-alex.bennee@linaro.org>
-
- Jul 21, 2020
-
-
Gerd Hoffmann authored
Just return in case module_load_qom_one(NULL) is called. vga_interface_available() can do that. Signed-off-by:
Gerd Hoffmann <kraxel@redhat.com> Message-Id: <20200720100352.2477-3-kraxel@redhat.com>
-
- Jul 20, 2020
-
-
David CARLIER authored
Implement qemu_get_thread_id() for OpenBSD hosts, using getthrid(). Signed-off-by:
David Carlier <devnexen@gmail.com> Reviewed-by:
Brad Smith <brad@comstyle.com> Message-id: CA+XhMqxD6gQDBaj8tX0CMEj3si7qYKsM8u1km47e_-U7MC37Pg@mail.gmail.com Reviewed-by:
Peter Maydell <peter.maydell@linaro.org> [PMM: tidied up commit message] Signed-off-by:
Peter Maydell <peter.maydell@linaro.org>
-
- Jul 15, 2020
-
-
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:
Laurent Vivier <lvivier@redhat.com> Reviewed-by:
Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by:
Jason Wang <jasowang@redhat.com>
-