Misc patches for 2018-12-12
Subsystems (4)
The following changes since commit bb9bf94b3e8926553290bc9a7cb84315af422086:
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging (2018-12-11 19:18:58 +0000)
are available in the git repository at:
git://github.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to e2a9129b491fdb3be3661baf08a9fa4c2e19a028:
vhost-user-test: create a temporary directory per TestServer (2018-12-12 13:49:31 +0100)
This introduces a new dependency on perl's Test::Harness package. This is distributed in package perl-Test-Harness for Fedora, and libtest-harness-perl for Debian. I couldn't find anything for BSD or macOS, but at least the Patchew BSD images already have it so it is probably bundled with Perl.
Thanks,
Paolo
----------------------------------------------------------------
* HAX support for Linux hosts (Alejandro)
* esp bugfixes (Guenter)
* Windows build cleanup (Marc-André)
* checkpatch logic improvements (Paolo)
* coalesced range bugfix (Paolo)
* switch testsuite to TAP (Paolo)
* QTAILQ rewrite (Paolo)
* enable vhost for TCG and clean up vhost-user-test (Paolo)
* block/iscsi.c cancellation fixes (Stefan)
* improve selection of the default accelerator (Thomas)
* add explicit checks for the compiler version and cleanup (Thomas)
----------------------------------------------------------------
Alexandro Sanchez Bach (1):
hax: Support for Linux hosts
Guenter Roeck (2):
esp-pci: Fix status register write erase control
scsi: esp: Defer command completion until previous interrupts have been handled
Marc-André Lureau (5):
vhost-user-bridge: fix "unknown type name" compilation error
build-sys: don't include windows.h, osdep.h does it
build-sys: move windows defines in osdep.h header
build-sys: build with Vista API by default
RFC: qga: drop < Vista compatibility
Paolo Bonzini (32):
checkpatch: fix premature exit when no input or --mailback
checkpatch: check Signed-off-by in --mailback mode
checkpatch: improve handling of multiple patches or files
checkpatch: colorize output to terminal
pam: wrap MemoryRegion initialization in a transaction
memory: extract flat_range_coalesced_io_{del,add}
memory: avoid unnecessary coalesced_io_del operations
memory: update coalesced_range on transaction_commit
test: execute g_test_run when tests are skipped
test: replace gtester with a TAP driver
qemu/queue.h: do not access tqe_prev directly
vfio: make vfio_address_spaces static
qemu/queue.h: leave head structs anonymous unless necessary qemu/queue.h: typedef QTAILQ heads
qemu/queue.h: remove Q_TAILQ_{HEAD,ENTRY}
qemu/queue.h: reimplement QTAILQ without pointer-to-pointers qemu/queue.h: simplify reverse access to QTAILQ
checkpatch: warn about qemu/queue.h head structs that are not typedef-ed
vhost-net: move stubs to a separate file
vhost-net-user: add stubs for when no virtio-net device is present
vhost: restrict Linux dependency to kernel vhost
vhost-net: compile it on all targets that have virtio-net.
vhost-net: revamp configure logic
vhost-user-test: use g_cond_broadcast
vhost-user-test: signal data_cond when s->rings changes
vhost-user: support cross-endian vnet headers
vhost-user-test: support VHOST_USER_PROTOCOL_F_CROSS_ENDIAN
vhost-user-test: skip if there is no memory at address 0
vhost-user-test: reduce usage of global_qtest
vhost-user-test: create a main loop per TestServer
vhost-user-test: small changes to init_hugepagefs
vhost-user-test: create a temporary directory per TestServer
Peng Hao (1):
hw/watchdog/wdt_i6300esb : remove a unnecessary comment
Stefan Hajnoczi (4):
block/iscsi: drop unused IscsiAIOCB->buf field block/iscsi: take iscsilun->mutex in iscsi_timed_check_events() block/iscsi: fix ioctl cancel use-after-free block/iscsi: cancel libiscsi task when ABORT TASK TMF completes
Thomas Huth (9):
accel: Improve selection of the default accelerator
compiler.h: Add an explicit check for the compiler version
configure: Add a test for the minimum compiler version
configure: Remove obsolete check for Clang < 3.2
configure: Remove old -fno-gcse workaround for GCC 4.6.x and 4.7.[012] tcg/tcg.h: Remove GCC check for tcg_debug_assert() macro audio/alsaaudio: Remove compiler check around pragma
includes: Replace QEMU_GNUC_PREREQ with "__has_builtin || !defined(__clang__)" Remove QEMU_ARTIFICIAL macro
Makefile.target | 3 -
accel/accel.c | 18 +-
accel/kvm/kvm-all.c | 4 +-
accel/tcg/translate-all.c | 4 -
audio/alsaaudio.c | 2 -
backends/Makefile.objs | 5 +-
block/gluster.c | 2 +-
block/iscsi.c | 47 +++-
block/mirror.c | 2 +-
block/qcow2-bitmap.c | 4 +-
block/qcow2.h | 2 +-
block/sheepdog.c | 6 +-
block/vhdx.h | 2 +-
blockdev.c | 4 +-
configure | 151 ++++++-----
contrib/ivshmem-client/ivshmem-client.h | 4 +-
contrib/ivshmem-server/ivshmem-server.h | 5 +-
cpus-common.c | 2 +-
default-configs/virtio.mak | 4 +-
dump.c | 2 +-
exec.c | 5 +-
fsdev/qemu-fsdev.c | 2 +-
hw/block/nvme.h | 8 +-
hw/block/xen_disk.c | 6 +-
hw/core/qdev.c | 4 +-
hw/core/reset.c | 2 +-
hw/i386/xen/xen-mapcache.c | 2 +-
hw/net/Makefile.objs | 4 +-
hw/net/vhost_net-stub.c | 92 +++++++
hw/net/vhost_net.c | 78 +-----
hw/pci-host/pam.c | 2 +
hw/ppc/spapr_iommu.c | 2 +-
hw/scsi/esp-pci.c | 10 +-
hw/scsi/esp.c | 33 ++-
hw/scsi/scsi-bus.c | 2 +-
hw/scsi/trace-events | 1 +
hw/usb/ccid-card-emulated.c | 4 +-
hw/usb/combined-packet.c | 2 +-
hw/usb/dev-mtp.c | 4 +-
hw/usb/dev-network.c | 2 +-
hw/usb/hcd-ehci.c | 2 +-
hw/usb/hcd-ehci.h | 2 +-
hw/usb/hcd-uhci.c | 4 +-
hw/usb/xen-usb.c | 6 +-
hw/vfio/common.c | 4 +-
hw/virtio/Makefile.objs | 5 +-
hw/virtio/vhost-backend.c | 11 +-
hw/watchdog/watchdog.c | 2 +-
hw/watchdog/wdt_i6300esb.c | 1 -
hw/xen/xen_pvdev.c | 4 +-
include/exec/memory.h | 6 +-
include/exec/poison.h | 1 -
include/hw/qdev-core.h | 2 +-
include/hw/scsi/esp.h | 2 +
include/hw/usb.h | 2 +-
include/hw/vfio/vfio-common.h | 4 +-
include/hw/vfio/vfio-platform.h | 2 +-
include/net/net.h | 2 +-
include/qemu/compiler.h | 16 +-
include/qemu/host-utils.h | 4 +-
include/qemu/option_int.h | 2 +-
include/qemu/osdep.h | 17 ++
include/qemu/queue.h | 153 +++++------
include/qemu/rcu_queue.h | 45 ++--
include/qom/cpu.h | 9 +-
include/sysemu/accel.h | 2 +-
include/sysemu/kvm.h | 2 -
include/sysemu/memory_mapping.h | 2 +-
include/sysemu/rng.h | 2 +-
linux-user/elfload.c | 2 +-
memory.c | 97 ++++---
memory_mapping.c | 2 +-
migration/block-dirty-bitmap.c | 2 +-
migration/block.c | 4 +-
migration/ram.c | 2 +-
monitor.c | 4 +-
net/Makefile.objs | 4 +-
net/filter.c | 2 +-
net/net.c | 4 +-
net/queue.c | 2 +-
net/slirp.c | 2 +-
net/vhost-user-stub.c | 23 ++
net/vhost-user.c | 13 +
qga/commands-posix.c | 2 +-
qga/commands-win32.c | 70 +----
scripts/checkpatch.pl | 96 +++++--
scripts/cocci-macro-file.h | 25 +-
scripts/gtester-cat | 26 --
scripts/tap-driver.pl | 378 +++++++++++++++++++++++++++
scripts/tap-merge.pl | 110 ++++++++
slirp/slirp.c | 2 +-
target/arm/kvm.c | 2 +-
target/i386/Makefile.objs | 6 +-
target/i386/hax-i386.h | 6 +-
target/i386/hax-mem.c | 2 +-
target/i386/{hax-darwin.c => hax-posix.c} | 0
target/i386/{hax-darwin.h => hax-posix.h} | 0
tcg/tcg.c | 2 +-
tcg/tcg.h | 10 +-
tests/Makefile.include | 59 +++--
tests/cdrom-test.c | 2 +-
tests/docker/dockerfiles/centos7.docker | 1 +
tests/docker/dockerfiles/debian-amd64.docker | 1 +
tests/docker/dockerfiles/debian-ports.docker | 1 +
tests/docker/dockerfiles/debian-sid.docker | 1 +
tests/docker/dockerfiles/debian8.docker | 1 +
tests/docker/dockerfiles/debian9.docker | 1 +
tests/docker/dockerfiles/fedora.docker | 1 +
tests/docker/dockerfiles/ubuntu.docker | 1 +
tests/libqos/malloc.c | 2 +-
tests/migration-test.c | 8 +-
tests/test-rcu-list.c | 2 +-
tests/test-vmstate.c | 8 +-
tests/vhost-user-bridge.c | 3 +-
tests/vhost-user-test.c | 234 +++++++++--------
ui/console.c | 4 +-
ui/input.c | 14 +-
util/qemu-option.c | 4 +-
util/qemu-thread-win32.c | 4 -
vl.c | 4 +-
120 files changed, 1373 insertions(+), 737 deletions(-)
create mode 100644 hw/net/vhost_net-stub.c
create mode 100644 net/vhost-user-stub.c
delete mode 100755 scripts/gtester-cat
create mode 100755 scripts/tap-driver.pl
create mode 100755 scripts/tap-merge.pl
rename target/i386/{hax-darwin.c => hax-posix.c} (100%)
rename target/i386/{hax-darwin.h => hax-posix.h} (100%)Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 01/54] accel: Improve selection of the default accelerator
From: Thomas Huth <[email protected]>
When compiling with "--disable-tcg", we currently still use "tcg" as default accelerator. "kvm" should be used in this case instead. Also, some downstream distros provide QEMU binaries which have "kvm" in their names (e.g. "qemu-kvm" on RHEL or "kvm" on Ubuntu) that use KVM by default - and some users might want to do something similar with upstream binaries, too. Accomodate them by using "kvm:tcg" as default when we detect such a binary name.
Message-Id: <[email protected]>
--- accel/accel.c | 18 +++++++++++++++--- include/sysemu/accel.h | 2 +- vl.c | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-)
accel/accel.c +15 -3
@@ -69,7 +69,7 @@ static int accel_init_machine(AccelClass *acc, MachineState *ms)return ret; } -void configure_accelerator (MachineState *ms) +void configure_accelerator (MachineState *ms,const char *progname) {const char *accel;char **accel_list, **tmp;
@@ -80,8 +80,20 @@ void configure_accelerator(MachineState *ms) accel =qemu_opt_get (qemu_get_machine_opts (),"accel" );if (accel ==NULL ) { -/* Use the default "accelerator", tcg */ - accel ="tcg" ; +/* Select the default accelerator */ +int pnlen =strlen (progname); +if (pnlen >=3 &&g_str_equal (&progname[pnlen -3 ],"kvm" )) { +/* If the program name ends with "kvm", we prefer KVM */ + accel ="kvm:tcg" ; + }else { +#if defined(CONFIG_TCG ) + accel ="tcg" ; +#elif defined(CONFIG_KVM ) + accel ="kvm" ; +#else +#error "No default accelerator available" +#endif + } } accel_list =g_strsplit (accel,":" ,0 );
include/sysemu/accel.h +1 -1
@@ -66,7 +66,7 @@ typedef struct AccelClass {extern unsigned long tcg_tb_size; -void configure_accelerator (MachineState *ms); +void configure_accelerator (MachineState *ms,const char *progname);/* Register accelerator specific global properties */ void accel_register_compat_props (AccelState *accel);/* Called just before os_setup_post (ie just before drop OS privs) */
vl.c +1 -1
@@ -4308,7 +4308,7 @@ int main(int argc, char **argv, char **envp)qemu_opt_foreach (machine_opts, machine_set_property, current_machine, &error_fatal); -configure_accelerator (current_machine); +configure_accelerator (current_machine, argv[0 ]);if (!qtest_enabled () && machine_class->deprecation_reason) { error_report("Machine type '%s' is deprecated: %s",
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 09/54] memory: avoid unnecessary coalesced_io_del operations
In reply to Paolo BonziniStore whether the FlatRange has had any coalesced I/O ranges applied, and if not avoid calling coalesced_io_del. This is useful in preparation for the next patch, which will call coalesced_io_del when rendering memory regions.
--- memory.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
memory.c +11 -0
@@ -217,6 +217,7 @@ struct FlatRange {bool romd_mode;bool readonly;bool nonvolatile; +bool has_coalesced_range; };#define FOR_EACH_FLAT_RANGE (var, view) \
@@ -650,6 +651,7 @@ static void render_memory_region(FlatView *view, fr.romd_mode = mr->romd_mode; fr.readonly = readonly; fr.nonvolatile = nonvolatile; + fr.has_coalesced_range = false;/* Render the region itself into any gaps left by the current view. */ for (i =0 ; i < view->nr &&int128_nz (remain); ++i) {
@@ -852,6 +854,10 @@ static void address_space_update_ioeventfds(AddressSpace *as)static void flat_range_coalesced_io_del (FlatRange *fr,AddressSpace *as) { +if (!fr->has_coalesced_range) { +return ; + } +MEMORY_LISTENER_UPDATE_REGION (fr, as, Reverse, coalesced_io_del,int128_get64 (fr->addr.start),int128_get64 (fr->addr.size));
@@ -863,6 +869,11 @@ static void flat_range_coalesced_io_add(FlatRange *fr, AddressSpace *as)CoalescedMemoryRange *cmr;AddrRange tmp; +if (QTAILQ_EMPTY (&mr->coalesced)) { +return ; + } + + fr->has_coalesced_range = true; QTAILQ_FOREACH(cmr, &mr->coalesced, link) { tmp = addrrange_shift(cmr->addr, int128_sub(fr->addr.start,
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 11/54] hax: Support for Linux hosts
In reply to Paolo BonziniFrom: Alexandro Sanchez Bach <[email protected]>
Intel HAXM supports now 32-bit and 64-bit Linux hosts. This patch includes the corresponding userland changes.
Since the Darwin userland backend is POSIX-compliant, the hax-darwin.{c,h} files have been renamed to hax-posix.{c,h}. This prefix is consistent with the naming used in the rest of QEMU.
Message-Id: <[email protected]>
---
target/i386/Makefile.objs | 6 +++---
target/i386/hax-i386.h | 6 +++---
target/i386/{hax-darwin.c => hax-posix.c} | 0
target/i386/{hax-darwin.h => hax-posix.h} | 0
4 files changed, 6 insertions(+), 6 deletions(-)
rename target/i386/{hax-darwin.c => hax-posix.c} (100%)
rename target/i386/{hax-darwin.h => hax-posix.h} (100%)target/i386/Makefile.objs +3 -3
@@ -12,10 +12,10 @@ obj-$(call lnot,$(CONFIG_HYPERV)) += hyperv-stub.o ifeq ($(CONFIG_WIN32),y) obj-$(CONFIG_HAX) += hax-all.o hax-mem.o hax-windows.o endif -ifeq ($(CONFIG_DARWIN),y) -obj-$(CONFIG_HAX) += hax-all.o hax-mem.o hax-darwin.o -obj-$(CONFIG_HVF) += hvf/ +ifeq ($(CONFIG_POSIX),y) +obj-$(CONFIG_HAX) += hax-all.o hax-mem.o hax-posix.o endif +obj-$(CONFIG_HVF) += hvf/ obj-$(CONFIG_WHPX) += whpx-all.o endif obj-$(CONFIG_SEV) += sev.o
target/i386/hax-i386.h +3 -3
@@ -16,7 +16,7 @@#include "cpu.h" #include "sysemu/hax.h" -#ifdef CONFIG_DARWIN +#ifdef CONFIG_POSIX typedef int hax_fd ;#endif
@@ -82,8 +82,8 @@ hax_fd hax_mod_open(void);void hax_memory_init (void ); -#ifdef CONFIG_DARWIN -#include "target/i386/hax-darwin.h" +#ifdef CONFIG_POSIX +#include "target/i386/hax-posix.h" #endif #ifdef CONFIG_WIN32
target/i386/hax-posix.c renamed from target/i386/hax-darwin.c +0 -0
target/i386/hax-posix.h renamed from target/i386/hax-darwin.h +0 -0
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 04/54] checkpatch: check Signed-off-by in --mailback mode
In reply to Paolo BonziniPull the test before the anticipated exits from the process sub.
--- scripts/checkpatch.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +4 -3
@@ -2817,6 +2817,10 @@ sub process { } } + if ($is_patch && $chk_signoff && $signoff == 0) { + ERROR("Missing Signed-off-by: line(s)\n"); + } + # If we have no input at all, then there is nothing to report on # so just keep quiet. if ($#rawlines == -1) {
@@ -2838,9 +2842,6 @@ sub process { if (!$is_patch) { ERROR("Does not appear to be a unified-diff format patch\n"); } - if ($is_patch && $chk_signoff && $signoff == 0) { - ERROR("Missing Signed-off-by: line(s)\n"); - } print report_dump(); if ($summary && !($clean == 1 && $quiet == 1)) {
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 14/54] block/iscsi: fix ioctl cancel use-after-free
In reply to Paolo BonziniFrom: Stefan Hajnoczi <[email protected]>
iscsi_aio_cancel() does not increment the request's reference count, causing a use-after-free when ABORT TASK finishes after the request has already completed.
There are some additional issues with iscsi_aio_cancel():
1. Several ABORT TASKs may be sent for the same task if iscsi_aio_cancel() is invoked multiple times. It's better to avoid this just in case the command identifier is reused.
2. The iscsilun->mutex protection is missing in iscsi_aio_cancel().
Message-Id: <[email protected]>
--- block/iscsi.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
block/iscsi.c +18 -3
@@ -124,6 +124,7 @@ typedef struct IscsiAIOCB {#ifdef __linux__sg_io_hdr_t *ioh;#endif +bool cancelled; } IscsiAIOCB;/* libiscsi uses time_t so its enough to process events every second */
@@ -287,6 +288,7 @@ static void iscsi_co_init_iscsitask(IscsiLun *iscsilun, struct IscsiTask *iTask) }; } +/* Called (via iscsi_service) with QemuMutex held. */ static void iscsi_abort_task_cb (struct iscsi_context *iscsi,int status,void *command_data,void *private_data)
@@ -295,6 +297,7 @@ iscsi_abort_task_cb(struct iscsi_context *iscsi, int status, void *command_data, acb->status = -ECANCELED ;iscsi_schedule_bh (acb); +qemu_aio_unref (acb);/* acquired in iscsi_aio_cancel() */ } static void
@@ -303,14 +306,25 @@ iscsi_aio_cancel(BlockAIOCB *blockacb)IscsiAIOCB *acb = (IscsiAIOCB *)blockacb;IscsiLun *iscsilun = acb->iscsilun; -if (acb->status != -EINPROGRESS ) { +qemu_mutex_lock (&iscsilun->mutex); + +/* If it was cancelled or completed already, our work is done here */ +if (acb->cancelled || acb->status != -EINPROGRESS ) { +qemu_mutex_unlock (&iscsilun->mutex);return ; } + acb->cancelled = true; + +qemu_aio_ref (acb);/* released in iscsi_abort_task_cb() */ +/* send a task mgmt call to the target to cancel the task on the target */ -iscsi_task_mgmt_abort_task_async (iscsilun->iscsi, acb->task, - iscsi_abort_task_cb, acb); +if (iscsi_task_mgmt_abort_task_async (iscsilun->iscsi, acb->task, + iscsi_abort_task_cb, acb) <0 ) { +qemu_aio_unref (acb);/* since iscsi_abort_task_cb() won't be called */ + } +qemu_mutex_unlock (&iscsilun->mutex); }static const AIOCBInfo iscsi_aiocb_info = {
@@ -1008,6 +1022,7 @@ static BlockAIOCB *iscsi_aio_ioctl(BlockDriverState *bs, acb->bh =NULL ; acb->status = -EINPROGRESS ; acb->ioh = buf; + acb->cancelled = false;if (req !=SG_IO ) {iscsi_ioctl_handle_emulated (acb, req, buf);
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 05/54] checkpatch: improve handling of multiple patches or files
In reply to Paolo BonziniSimilar to how patchew output looks like for multiple patches, say what file or patch is being tested _before_ emitting errors. This is clearer to a human that scans the output from top to bottom.
In addition, provide a truncated commit hash and subject instead of the full hash, and process the commits first-to-last rather than last-to-first.
Inspired by Linux commit 0dea9f1eef86bedacad91b6f652ca1ab0d08854c ("checkpatch: reduce number of git log calls with --git", 2016-03-20).
--- scripts/checkpatch.pl | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-)
scripts/checkpatch.pl +23 -7
@@ -340,13 +340,18 @@ my @lines = (); my $vname; if ($chk_branch) { my @patches; + my %git_commits = (); my $HASH; - open($HASH, "-|", "git", "log", "--format=%H", $ARGV[0]) || - die "$P: git log --format=%H $ARGV[0] failed - $!\n"; - - while (<$HASH>) { - chomp; - push @patches, $_; + open($HASH, "-|", "git", "log", "--reverse", "--no-merges", "--format=%H %s", $ARGV[0]) || + die "$P: git log --reverse --no-merges --format='%H %s' $ARGV[0] failed - $!\n"; + + for my $line (<$HASH>) { + $line =~ /^([0-9a-fA-F]{40,40}) (.*)$/; + next if (!defined($1) || !defined($2)); + my $sha1 = $1; + my $subject = $2; + push(@patches, $sha1); + $git_commits{$sha1} = $subject; } close $HASH;
@@ -354,21 +359,31 @@ if ($chk_branch) { die "$P: no revisions returned for revlist '$chk_branch'\n" unless @patches; + my $i = 1; + my $num_patches = @patches; for my $hash (@patches) { my $FILE; open($FILE, '-|', "git", "show", $hash) || die "$P: git show $hash - $!\n"; - $vname = $hash; while (<$FILE>) { chomp; push(@rawlines, $_); } close($FILE); + $vname = substr($hash, 0, 12) . ' (' . $git_commits{$hash} . ')'; + if ($num_patches > 1 && $quiet == 0) { + print "$i/$num_patches Checking commit $vname\n"; + $vname = "Patch $i/$num_patches"; + } else { + $vname = "Commit " . $vname; + } if (!process($hash)) { $exit = 1; + print "\n" if ($num_patches > 1 && $quiet == 0); } @rawlines = (); @lines = (); + $i++; } } else { for my $filename (@ARGV) {
@@ -387,6 +402,7 @@ if ($chk_branch) { } else { $vname = $filename; } + print "Checking $filename...\n" if @ARGV > 1 && $quiet == 0; while (<$FILE>) { chomp; push(@rawlines, $_);
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 08/54] memory: extract flat_range_coalesced_io_{del, add}
In reply to Paolo BonziniExtract two new functions from memory_region_update_coalesced_range_as. To avoid duplication in the creation of the MemoryRegionSection, use MEMORY_LISTENER_UPDATE_REGION instead of MEMORY_LISTENER_CALL to invoke the listener callback.
--- memory.c | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-)
memory.c +29 -24
@@ -850,6 +850,33 @@ static void address_space_update_ioeventfds(AddressSpace *as)flatview_unref (view); } +static void flat_range_coalesced_io_del (FlatRange *fr,AddressSpace *as) +{ +MEMORY_LISTENER_UPDATE_REGION (fr, as, Reverse, coalesced_io_del, +int128_get64 (fr->addr.start), +int128_get64 (fr->addr.size)); +} + +static void flat_range_coalesced_io_add (FlatRange *fr,AddressSpace *as) +{ +MemoryRegion *mr = fr->mr; +CoalescedMemoryRange *cmr; +AddrRange tmp; + + QTAILQ_FOREACH(cmr, &mr->coalesced, link) { + tmp =addrrange_shift (cmr->addr, +int128_sub (fr->addr.start, +int128_make64 (fr->offset_in_region))); +if (!addrrange_intersects (tmp, fr->addr)) { +continue ; + } + tmp =addrrange_intersection (tmp, fr->addr); +MEMORY_LISTENER_UPDATE_REGION (fr, as, Forward, coalesced_io_add, +int128_get64 (tmp.start), +int128_get64 (tmp.size)); + } +} + static void address_space_update_topology_pass(AddressSpace *as, const FlatView *old_view, const FlatView *new_view,
@@ -2136,34 +2163,12 @@ static void memory_region_update_coalesced_range_as(MemoryRegion *mr, AddressSpa {FlatView *view;FlatRange *fr; -CoalescedMemoryRange *cmr; -AddrRange tmp; -MemoryRegionSection section; view =address_space_get_flatview (as); FOR_EACH_FLAT_RANGE(fr, view) {if (fr->mr == mr) { - section = (MemoryRegionSection ) { - .fv = view, - .offset_within_address_space =int128_get64 (fr->addr.start), - .size = fr->addr.size, - }; - -MEMORY_LISTENER_CALL (as, coalesced_io_del, Reverse, §ion, -int128_get64 (fr->addr.start), -int128_get64 (fr->addr.size)); - QTAILQ_FOREACH(cmr, &mr->coalesced, link) { - tmp =addrrange_shift (cmr->addr, -int128_sub (fr->addr.start, -int128_make64 (fr->offset_in_region))); -if (!addrrange_intersects (tmp, fr->addr)) { -continue ; - } - tmp =addrrange_intersection (tmp, fr->addr); -MEMORY_LISTENER_CALL (as, coalesced_io_add, Forward, §ion, -int128_get64 (tmp.start), -int128_get64 (tmp.size)); - } +flat_range_coalesced_io_del (fr, as); +flat_range_coalesced_io_add (fr, as); } }flatview_unref (view);
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 03/54] checkpatch: fix premature exit when no input or --mailback
In reply to Paolo BonziniIn some cases, checkpatch's process subroutine is exiting the whole process. This is wrong, just return from the subroutine instead.
--- scripts/checkpatch.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +3 -3
@@ -2820,19 +2820,19 @@ sub process { # If we have no input at all, then there is nothing to report on # so just keep quiet. if ($#rawlines == -1) { - exit(0); + return 1; } # In mailback mode only produce a report in the negative, for # things that appear to be patches. if ($mailback && ($clean == 1 || !$is_patch)) { - exit(0); + return 1; } # This is not a patch, and we are are in 'no-patch' mode so # just keep quiet. if (!$chk_patch && !$is_patch) { - exit(0); + return 1; } if (!$is_patch) {
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 20/54] build-sys: build with Vista API by default
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
Both qemu & qga build with Vista API by default already, by defining _WIN32_WINNT 0x0600. Set it globally in osdep.h instead.
This replaces WINVER by _WIN32_WINNT in osdep.h. WINVER doesn't seem to be really useful these days.
(see also https://blogs.msdn.microsoft.com/oldnewthing/20070411-00/?p=27283)
Message-Id: <[email protected]>
--- include/qemu/osdep.h | 4 ++-- qga/commands-win32.c | 6 +----- util/qemu-thread-win32.c | 4 ---- 3 files changed, 3 insertions(+), 11 deletions(-)
include/qemu/osdep.h +2 -2
@@ -76,8 +76,8 @@ extern int daemon(int, int);#ifdef _WIN32/* as defined in sdkddkver.h */ -#ifndef WINVER -#define WINVER 0x0501/* XP */ +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0600/* Vista */ #endif /* reduces the number of implicitly included headers */ #ifndef WIN32_LEAN_AND_MEAN
qga/commands-win32.c +1 -5
@@ -10,12 +10,8 @@* This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ - -#ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0600 -#endif -#include "qemu/osdep.h" +#include <wtypes.h> #include <powrprof.h> #include <winsock2.h>
util/qemu-thread-win32.c +0 -4
@@ -11,10 +11,6 @@* */ -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif -#include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/thread.h"
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 06/54] checkpatch: colorize output to terminal
In reply to Paolo BonziniAdd optional colors to make seeing message types a bit easier. The default is to show them on a tty.
Inspired by Linux commits 57230297116fa ("checkpatch: colorize output to terminal") and 737c0767758b ("checkpatch: change format of --color argument to --color[=WHEN]").
--- scripts/checkpatch.pl | 49 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 7 deletions(-)
scripts/checkpatch.pl +42 -7
@@ -7,6 +7,7 @@ use strict; use warnings; +use Term::ANSIColor qw(:constants); my $P = $0; $P =~ s@.*/@@g;
@@ -26,6 +27,7 @@ my $tst_only; my $emacs = 0; my $terse = 0; my $file = undef; +my $color = "auto"; my $no_warnings = 0; my $summary = 1; my $mailback = 0;
@@ -64,6 +66,8 @@ Options: is all off) --test-only=WORD report only warnings/errors containing WORD literally + --color[=WHEN] Use colors 'always', 'never', or only when output + is a terminal ('auto'). Default is 'auto'. -h, --help, --version display this help and exit When FILE is - read standard input.
@@ -72,6 +76,14 @@ EOM exit($exitcode); } +# Perl's Getopt::Long allows options to take optional arguments after a space. +# Prevent --color by itself from consuming other arguments +foreach (@ARGV) { + if ($_ eq "--color" || $_ eq "-color") { + $_ = "--color=$color"; + } +} + GetOptions( 'q|quiet+' => \$quiet, 'tree!' => \$tree,
@@ -89,6 +101,8 @@ GetOptions( 'debug=s' => \%debug, 'test-only=s' => \$tst_only, + 'color=s' => \$color, + 'no-color' => sub { $color = 'never'; }, 'h|help' => \$help, 'version' => \$help ) or help(1);
@@ -144,6 +158,16 @@ if (!$chk_patch && !$chk_branch && !$file) { die "One of --file, --branch, --patch is required\n"; } +if ($color =~ /^always$/i) { + $color = 1; +} elsif ($color =~ /^never$/i) { + $color = 0; +} elsif ($color =~ /^auto$/i) { + $color = (-t STDOUT); +} else { + die "Invalid color mode: $color\n"; +} + my $dbg_values = 0; my $dbg_possible = 0; my $dbg_type = 0;
@@ -372,7 +396,9 @@ if ($chk_branch) { close($FILE); $vname = substr($hash, 0, 12) . ' (' . $git_commits{$hash} . ')'; if ($num_patches > 1 && $quiet == 0) { - print "$i/$num_patches Checking commit $vname\n"; + my $prefix = "$i/$num_patches"; + $prefix = BLUE . BOLD . $prefix . RESET if $color; + print "$prefix Checking commit $vname\n"; $vname = "Patch $i/$num_patches"; } else { $vname = "Commit " . $vname;
@@ -1182,14 +1208,23 @@ sub possible { my $prefix = ''; sub report { - if (defined $tst_only && $_[0] !~ /\Q$tst_only\E/) { + my ($level, $msg) = @_; + if (defined $tst_only && $msg !~ /\Q$tst_only\E/) { return 0; } - my $line = $prefix . $_[0]; - $line = (split('\n', $line))[0] . "\n" if ($terse); + my $output = ''; + $output .= BOLD if $color; + $output .= $prefix; + $output .= RED if $color && $level eq 'ERROR'; + $output .= MAGENTA if $color && $level eq 'WARNING'; + $output .= $level . ':'; + $output .= RESET if $color; + $output .= ' ' . $msg . "\n"; + + $output = (split('\n', $output))[0] . "\n" if ($terse); - push(our @report, $line); + push(our @report, $output); return 1; }
@@ -1197,13 +1232,13 @@ sub report_dump { our @report; } sub ERROR { - if (report("ERROR: $_[0]\n")) { + if (report("ERROR", $_[0])) { our $clean = 0; our $cnt_error++; } } sub WARN { - if (report("WARNING: $_[0]\n")) { + if (report("WARNING", $_[0])) { our $clean = 0; our $cnt_warn++; }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 07/54] pam: wrap MemoryRegion initialization in a transaction
In reply to Paolo BonziniThis avoids a few re-rendering of the memory AddressSpace.
--- hw/pci-host/pam.c | 2 ++ 1 file changed, 2 insertions(+)
hw/pci-host/pam.c +2 -0
@@ -52,11 +52,13 @@ void init_pam(DeviceState *dev, MemoryRegion *ram_memory,memory_region_init_alias (&mem->alias[2 ],OBJECT (dev),"pam-pci" , ram_memory, start, size); +memory_region_transaction_begin ();for (i =0 ; i <4 ; ++i) {memory_region_set_enabled (&mem->alias[i], false);memory_region_add_subregion_overlap (system_memory, start, &mem->alias[i],1 ); } +memory_region_transaction_commit (); mem->current =0 ; }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 15/54] block/iscsi: cancel libiscsi task when ABORT TASK TMF completes
In reply to Paolo BonziniFrom: Stefan Hajnoczi <[email protected]>
The libiscsi iscsi_task_mgmt_async() API documentation says:
abort_task will also cancel the scsi task. The callback for the scsi task will be invoked with SCSI_STATUS_CANCELLED
The libiscsi implementation does not fulfil this promise. The task's callback is not invoked and its struct iscsi_pdu remains in the internal list (effectively leaked).
This patch invokes the libiscsi iscsi_scsi_cancel_task() API to force the task's callback to be invoked with SCSI_STATUS_CANCELLED when the ABORT TASK TMF completes and the task's callback hasn't been invoked yet.
Message-Id: <[email protected]>
--- block/iscsi.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
block/iscsi.c +14 -2
@@ -295,8 +295,12 @@ iscsi_abort_task_cb(struct iscsi_context *iscsi, int status, void *command_data, {IscsiAIOCB *acb = private_data; - acb->status = -ECANCELED ; -iscsi_schedule_bh (acb); +/* If the command callback hasn't been called yet, drop the task */ +if (!acb->bh) { +/* Call iscsi_aio_ioctl_cb() with SCSI_STATUS_CANCELLED */ +iscsi_scsi_cancel_task (iscsi, acb->task); + } +qemu_aio_unref (acb);/* acquired in iscsi_aio_cancel() */ }
@@ -947,6 +951,14 @@ iscsi_aio_ioctl_cb(struct iscsi_context *iscsi, int status, {IscsiAIOCB *acb = opaque; +if (status ==SCSI_STATUS_CANCELLED ) { +if (!acb->bh) { + acb->status = -ECANCELED ; +iscsi_schedule_bh (acb); + } +return ; + } + acb->status =0 ;if (status <0 ) { error_report("Failed to ioctl(SG_IO) to iSCSI lun. %s",
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 24/54] compiler.h: Add an explicit check for the compiler version
In reply to Paolo BonziniFrom: Thomas Huth <[email protected]>
The questions about our minimum compiler requirement pops up every couple of months, and we then have to recall the details each time. So let's document this in a proper way, by adding a comment and check for the right compiler version to our compiler.h header.
Message-Id: <[email protected]>
--- include/qemu/compiler.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/qemu/compiler.h +8 -0
@@ -22,6 +22,14 @@# define QEMU_GNUC_PREREQ (maj, min) 0#endif +/* +* We need at least GCC 4.1 for atomics support. Clang also supports these, +* and reports itself as GCC 4.2, so it passes this check, too. +*/ +#if !QEMU_GNUC_PREREQ (4 ,1 ) +#error QEMU needs a compiler that is compatible with GCC v4.1 or newer +#endif +#define QEMU_NORETURN __attribute__ ((__noreturn__))#define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PULL 24/54] compiler.h: Add an explicit check for the compiler version
Quoted 19 lines · Paolo Bonzini
From: Thomas Huth <[email protected]>
The questions about our minimum compiler requirement pops up every couple of months, and we then have to recall the details each time. So let's document this in a proper way, by adding a comment and check for the right compiler version to our
compiler.hheader.Signed-off-by Thomas Huth <[email protected]>Message-Id: <[email protected]>
Signed-off-by Paolo Bonzini <[email protected]>--- include/qemu/compiler.h | 8 ++++++++ 1 file changed, 8 insertions(+)include/qemu/compiler.h +0
-0
include/qemu/compiler.h line 31
Quoted 10 lines
include/qemu/compiler.h +7
-0@@ -22,6 +22,14 @@# define QEMU_GNUC_PREREQ (maj, min) 0#endif +/* +* We need at least GCC 4.1 for atomics support. Clang also supports these, +* and reports itself as GCC 4.2, so it passes this check, too. +*/ +#if !QEMU_GNUC_PREREQ (4 ,1 ) +#error QEMU needs a compiler that is compatible with GCC v4.1 or newer +#endif
You can drop this patch, it has been obsoleted by the configure check.
Thomas
[Qemu-devel] [PULL 25/54] qemu/queue.h: do not access tqe_prev directly
In reply to Paolo BonziniUse the QTAILQ_IN_USE macro instead, it does the same thing but the next patch will change it to a different definition.
--- blockdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
blockdev.c +1 -1
@@ -4259,7 +4259,7 @@ void qmp_blockdev_del(const char *node_name, Error **errp) goto out; } -if (!bs->monitor_list.tqe_prev) { +if (!QTAILQ_IN_USE (bs, monitor_list)) {error_setg (errp,"Node %s is not owned by the monitor" , bs->node_name); goto out;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 26/54] vfio: make vfio_address_spaces static
In reply to Paolo BonziniIt is not used outside hw/vfio/common.c, so it does not need to be extern.
--- hw/vfio/common.c | 2 +- include/hw/vfio/vfio-common.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
hw/vfio/common.c +1 -1
@@ -39,7 +39,7 @@struct vfio_group_head vfio_group_list =QLIST_HEAD_INITIALIZER (vfio_group_list); -struct vfio_as_head vfio_address_spaces = +static QLIST_HEAD(, VFIOAddressSpace) vfio_address_spaces =QLIST_HEAD_INITIALIZER (vfio_address_spaces);#ifdef CONFIG_KVM
include/hw/vfio/vfio-common.h +0 -1
@@ -181,7 +181,6 @@ int vfio_get_device(VFIOGroup *group, const char *name,extern const MemoryRegionOps vfio_region_ops; extern QLIST_HEAD(vfio_group_head, VFIOGroup) vfio_group_list; -extern QLIST_HEAD(vfio_as_head, VFIOAddressSpace) vfio_address_spaces;#ifdef CONFIG_LINUX int vfio_get_region_info(VFIODevice *vbasedev, int index,
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 02/54] vhost-user-bridge: fix "unknown type name" compilation error
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
osdep.h should be included first:
CC tests/vhost-user-bridge.o
In file included from /home/elmarco/src/qemu/tests/vhost-user-bridge.c:32:/home/elmarco/src/qemu/include/qemu/atomic.h:480:1: error: unknown type name ‘int64_t’
int64_t atomic_read_i64(const int64_t *ptr);
^~~~~~~/home/elmarco/src/qemu/include/qemu/atomic.h:480:32: error: unknown type name ‘int64_t’
int64_t atomic_read_i64(const int64_t *ptr);
^~~~~~~/home/elmarco/src/qemu/include/qemu/atomic.h:481:1: error: unknown type name ‘uint64_t’
uint64_t atomic_read_u64(const uint64_t *ptr);
^~~~~~~~/home/elmarco/src/qemu/include/qemu/atomic.h:481:32: error: unknown type name ‘uint64_t’
uint64_t atomic_read_u64(const uint64_t *ptr);
^~~~~~~~
/home/elmarco/src/qemu/include/qemu/atomic.h:482:21: error: unknown type name ‘int64_t’
void atomic_set_i64(int64_t *ptr, int64_t val);
^~~~~~~
/home/elmarco/src/qemu/include/qemu/atomic.h:482:35: error: unknown type name ‘int64_t’
void atomic_set_i64(int64_t *ptr, int64_t val);
^~~~~~~
/home/elmarco/src/qemu/include/qemu/atomic.h:483:21: error: unknown type name ‘uint64_t’
void atomic_set_u64(uint64_t *ptr, uint64_t val);
^~~~~~~~
/home/elmarco/src/qemu/include/qemu/atomic.h:483:36: error: unknown type name ‘uint64_t’
void atomic_set_u64(uint64_t *ptr, uint64_t val);
^~~~~~~~(regression from 782da5b2921c4d18777d5d5bd9385b9f7beae360)
Message-Id: <[email protected]>
--- tests/vhost-user-bridge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tests/vhost-user-bridge.c +2 -1
@@ -29,8 +29,9 @@#define _FILE_OFFSET_BITS 64 -#include "qemu/atomic.h" #include "qemu/osdep.h" + +#include "qemu/atomic.h" #include "qemu/iov.h" #include "standard-headers/linux/virtio_net.h" #include "contrib/libvhost-user/libvhost-user.h"
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 13/54] block/iscsi: take iscsilun->mutex in iscsi_timed_check_events()
In reply to Paolo BonziniFrom: Stefan Hajnoczi <[email protected]>
Commit d045c466d9e62b4321fadf586d024d54ddfd8bd4 ("iscsi: do not use aio_context_acquire/release") introduced iscsilun->mutex but appears to have overlooked iscsi_timed_check_events() when introducing the mutex.
iscsi_service() and iscsi_set_events() must be called with iscsilun->mutex held.
iscsi_timed_check_events() is invoked from the AioContext and does not take the mutex.
Message-Id: <[email protected]>
--- block/iscsi.c | 4 ++++ 1 file changed, 4 insertions(+)
block/iscsi.c +4 -0
@@ -344,6 +344,8 @@ static void iscsi_timed_check_events(void *opaque) {IscsiLun *iscsilun = opaque; +qemu_mutex_lock (&iscsilun->mutex); +/* check for timed out requests */ iscsi_service (iscsilun->iscsi,0 );
@@ -356,6 +358,8 @@ static void iscsi_timed_check_events(void *opaque)* to return to service once this situation changes. */ iscsi_set_events (iscsilun); +qemu_mutex_unlock (&iscsilun->mutex); +timer_mod (iscsilun->event_timer,qemu_clock_get_ms (QEMU_CLOCK_REALTIME ) +EVENT_INTERVAL ); }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 16/54] esp-pci: Fix status register write erase control
In reply to Paolo BonziniFrom: Guenter Roeck <[email protected]>
Per AM53C974 datasheet, definition of "SCSI Bus and Control (SBAC)" register:
Bit 24 'STATUS' Write Erase Control
This bit controls the Write Erase feature on bits 3:1 and bit 6 of the DMA Status Register ((B)+54h). When this bit is programmed to '1', the state of bits 3:1 are preserved when read. Bits 3:1 are only cleared when a '1' is written to the corresponding bit location. For example, to clear bit 1, the value of '0000_0010b' should be written to the register. When the DMA Status Preserve bit is '0', bits 3:1 are cleared when read.
The status register is currently defined to bit 12, not bit 24. Also, its implementation is reversed: The status is auto-cleared if the bit is set to 1, and must be cleared explicitly when the bit is set to 0. This results in spurious interrupts reported by the Linux kernel, and in some cases even results in stalled SCSI operations.
Set SBAC_STATUS to bit 24 and reverse the logic to fix the problem.
Message-Id: <[email protected]>
--- hw/scsi/esp-pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
hw/scsi/esp-pci.c +3 -3
@@ -59,7 +59,7 @@#define DMA_STAT_SCSIINT 0x10#define DMA_STAT_BCMBLT 0x20 -#define SBAC_STATUS 0x1000 +#define SBAC_STATUS (1 << 24) typedef struct PCIESPState { /*< private >*/
@@ -136,7 +136,7 @@ static void esp_pci_dma_write(PCIESPState *pci, uint32_t saddr, uint32_t val) pci->dma_regs[saddr] = val;break ;case DMA_STAT : -if (!(pci->sbac &SBAC_STATUS )) { +if (pci->sbac &SBAC_STATUS ) {/* clear some bits on write */ uint32_t mask =DMA_STAT_ERROR |DMA_STAT_ABORT |DMA_STAT_DONE ; pci->dma_regs[DMA_STAT ] &= ~(val & mask);
@@ -157,7 +157,7 @@ static uint32_t esp_pci_dma_read(PCIESPState *pci, uint32_t saddr)if (pci->esp.rregs[ESP_RSTAT ] &STAT_INT ) { val |=DMA_STAT_SCSIINT ; } -if (pci->sbac &SBAC_STATUS ) { +if (!(pci->sbac &SBAC_STATUS )) { pci->dma_regs[DMA_STAT ] &= ~(DMA_STAT_ERROR |DMA_STAT_ABORT |DMA_STAT_DONE ); }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 19/54] build-sys: move windows defines in osdep.h header
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
This removes some clutter in compilation logging, and allows some easier tweaking per compilation unit/CFLAGS overriding.
Note that we can't move those define in os-win32.h, since they must be set before the first system headers are included.
Message-Id: <[email protected]>
--- configure | 3 --- include/qemu/osdep.h | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-)
configure +0 -3
@@ -905,9 +905,6 @@ fi if test "$mingw32" = "yes" ; then EXESUF=".exe" DSOSUF=".dll" - QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" - # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) - QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" # MinGW needs -mthreads for TLS and macro _MT. QEMU_CFLAGS="-mthreads $QEMU_CFLAGS" LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
include/qemu/osdep.h +17 -0
@@ -74,13 +74,30 @@ typedef __float128 _Float128;extern int daemon (int ,int );#endif +#ifdef _WIN32 +/* as defined in sdkddkver.h */ +#ifndef WINVER +#define WINVER 0x0501/* XP */ +#endif +/* reduces the number of implicitly included headers */ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#endif +#include <stdarg.h> #include <stddef.h> #include <stdbool.h> #include <stdint.h> #include <sys/types.h> #include <stdlib.h> + +/* enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) */ +#ifdef __MINGW32__ +#define __USE_MINGW_ANSI_STDIO 1 +#endif #include <stdio.h> +#include <string.h> #include <strings.h> #include <inttypes.h>
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 21/54] RFC: qga: drop < Vista compatibility
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
Building QGA for XP seems possible so far: the dependency on libqemuutil.a implies building qemu-thread-win32.c, which requires Vista API since commit 12f8def0 (v2.9). But qemu-thread isn't being used in QGA, the resulting binary may still work on XP. XP is no longer supported for the past 4.5y, it's time to drop support for it.
Message-Id: <[email protected]>
--- qga/commands-win32.c | 64 ---------------------------------------------------- 1 file changed, 64 deletions(-)
qga/commands-win32.c +0 -64
@@ -466,13 +466,11 @@ static STORAGE_BUS_TYPE win2qemu[] = { [BusTypeFibre] = GUEST_DISK_BUS_TYPE_SSA, [BusTypeUsb] = GUEST_DISK_BUS_TYPE_USB, [BusTypeRAID] = GUEST_DISK_BUS_TYPE_RAID, -#if (_WIN32_WINNT >= 0x0600) [BusTypeiScsi] = GUEST_DISK_BUS_TYPE_ISCSI, [BusTypeSas] = GUEST_DISK_BUS_TYPE_SAS, [BusTypeSata] = GUEST_DISK_BUS_TYPE_SATA, [BusTypeSd] = GUEST_DISK_BUS_TYPE_SD, [BusTypeMmc] =GUEST_DISK_BUS_TYPE_MMC , -#endif #if (_WIN32_WINNT >= 0x0601) [BusTypeVirtual] = GUEST_DISK_BUS_TYPE_VIRTUAL, [BusTypeFileBackedVirtual] = GUEST_DISK_BUS_TYPE_FILE_BACKED_VIRTUAL,
@@ -724,10 +722,8 @@ static void get_single_disk_info(GuestDiskAddress *disk, Error **errp)if (disk->bus_type ==GUEST_DISK_BUS_TYPE_SCSI || disk->bus_type ==GUEST_DISK_BUS_TYPE_IDE || disk->bus_type ==GUEST_DISK_BUS_TYPE_RAID -#if (_WIN32_WINNT >= 0x0600)/* This bus type is not supported before Windows Server 2003 SP1 */ || disk->bus_type ==GUEST_DISK_BUS_TYPE_SAS -#endif ) {/* We are able to use the same ioctls for different bus types * according to Microsoft docs
@@ -1322,7 +1318,6 @@ static char *guest_addr_to_str(IP_ADAPTER_UNICAST_ADDRESS *ip_addr,return NULL ; } -#if (_WIN32_WINNT >=0x0600 )static int64_t guest_ip_prefix (IP_ADAPTER_UNICAST_ADDRESS *ip_addr) {/* For Windows Vista/2008 and newer, use the OnLinkPrefixLength
@@ -1330,60 +1325,6 @@ static int64_t guest_ip_prefix(IP_ADAPTER_UNICAST_ADDRESS *ip_addr)*/ return ip_addr->OnLinkPrefixLength; } -#else -/* When using the Windows XP and 2003 build environment, do the best we can to -* figure out the prefix. -*/ -static IP_ADAPTER_INFO *guest_get_adapters_info (void ) -{ -IP_ADAPTER_INFO *adptr_info =NULL ; -ULONG adptr_info_len =0 ; -DWORD ret; - -/* Call the first time to get the adptr_info_len. */ -GetAdaptersInfo (adptr_info, &adptr_info_len); - - adptr_info =g_malloc (adptr_info_len); - ret =GetAdaptersInfo (adptr_info, &adptr_info_len); -if (ret !=ERROR_SUCCESS ) { -g_free (adptr_info); - adptr_info =NULL ; - } -return adptr_info; -} - -static int64_t guest_ip_prefix (IP_ADAPTER_UNICAST_ADDRESS *ip_addr) -{ -int64_t prefix =-1 ;/* Use for AF_INET6 and unknown/undetermined values. */ -IP_ADAPTER_INFO *adptr_info, *info; -IP_ADDR_STRING *ip; -struct in_addr *p; - -if (ip_addr->Address.lpSockaddr->sa_family !=AF_INET ) { -return prefix; - } - adptr_info =guest_get_adapters_info (); -if (adptr_info ==NULL ) { -return prefix; - } - -/* Match up the passed in ip_addr with one found in adaptr_info. -* The matching one in adptr_info will have the netmask. -*/ - p = &((struct sockaddr_in *)ip_addr->Address.lpSockaddr)->sin_addr; -for (info = adptr_info; info; info = info->Next) { -for (ip = &info->IpAddressList; ip; ip = ip->Next) { -if (p->S_un.S_addr ==inet_addr (ip->IpAddress.String)) { - prefix =ctpop32 (inet_addr (ip->IpMask.String)); - goto out; - } - } - } -out: -g_free (adptr_info); -return prefix; -} -#endif #define INTERFACE_PATH_BUF_SZ 512
@@ -1904,7 +1845,6 @@ typedef struct _GA_WTSINFOA {GuestUserList *qmp_guest_get_users (Error **err) { -#if (_WIN32_WINNT >=0x0600 )#define QGA_NANOSECONDS 10000000GHashTable *cache =NULL ;
@@ -1974,10 +1914,6 @@ GuestUserList *qmp_guest_get_users(Error **err) }g_hash_table_destroy (cache);return head; -#else -error_setg (err,QERR_UNSUPPORTED ); -return NULL ; -#endif } typedef struct _ga_matrix_lookup_t {
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PULL 21/54] RFC: qga: drop < Vista compatibility
Doing a pull request for a patch with "RFC: " in the subject is a bit odd - just s/RFC: // i geuss.
Quoted 137 lines · Paolo Bonzini
From: Marc-André Lureau <[email protected]>
Building QGA for XP seems possible so far: the dependency on libqemuutil.a implies building
qemu-thread-win32.c, which requires Vista API since commit12f8def0(v2.9). But qemu-thread isn't being used in QGA, the resulting binary may still work on XP. XP is no longer supported for the past 4.5y, it's time to drop support for it.Signed-off-by Marc-André Lureau <[email protected]>Message-Id: <[email protected]>
Signed-off-by Paolo Bonzini <[email protected]>--- qga/commands-win32.c | 64 ---------------------------------------------------- 1 file changed, 64 deletions(-)qga/commands-win32.c +0
-64@@ -466,13 +466,11 @@ static STORAGE_BUS_TYPE win2qemu[] = { [BusTypeFibre] = GUEST_DISK_BUS_TYPE_SSA, [BusTypeUsb] = GUEST_DISK_BUS_TYPE_USB, [BusTypeRAID] = GUEST_DISK_BUS_TYPE_RAID, -#if (_WIN32_WINNT >= 0x0600) [BusTypeiScsi] = GUEST_DISK_BUS_TYPE_ISCSI, [BusTypeSas] = GUEST_DISK_BUS_TYPE_SAS, [BusTypeSata] = GUEST_DISK_BUS_TYPE_SATA, [BusTypeSd] = GUEST_DISK_BUS_TYPE_SD, [BusTypeMmc] =GUEST_DISK_BUS_TYPE_MMC , -#endif #if (_WIN32_WINNT >= 0x0601) [BusTypeVirtual] = GUEST_DISK_BUS_TYPE_VIRTUAL, [BusTypeFileBackedVirtual] = GUEST_DISK_BUS_TYPE_FILE_BACKED_VIRTUAL,@@ -724,10 +722,8 @@ static void get_single_disk_info(GuestDiskAddress *disk, Error **errp)if (disk->bus_type ==GUEST_DISK_BUS_TYPE_SCSI || disk->bus_type ==GUEST_DISK_BUS_TYPE_IDE || disk->bus_type ==GUEST_DISK_BUS_TYPE_RAID -#if (_WIN32_WINNT >= 0x0600)/* This bus type is not supported before Windows Server 2003 SP1 */ || disk->bus_type ==GUEST_DISK_BUS_TYPE_SAS -#endif ) {/* We are able to use the same ioctls for different bus types * according to Microsoft docs @@ -1322,7 +1318,6 @@ static char *guest_addr_to_str(IP_ADAPTER_UNICAST_ADDRESS *ip_addr,return NULL ; } -#if (_WIN32_WINNT >=0x0600 )static int64_t guest_ip_prefix (IP_ADAPTER_UNICAST_ADDRESS *ip_addr) {/* For Windows Vista/2008 and newer, use the OnLinkPrefixLength @@ -1330,60 +1325,6 @@ static int64_t guest_ip_prefix(IP_ADAPTER_UNICAST_ADDRESS *ip_addr)*/ return ip_addr->OnLinkPrefixLength; } -#else -/* When using the Windows XP and 2003 build environment, do the best we can to -* figure out the prefix. -*/ -static IP_ADAPTER_INFO *guest_get_adapters_info (void ) -{ -IP_ADAPTER_INFO *adptr_info =NULL ; -ULONG adptr_info_len =0 ; -DWORD ret; - -/* Call the first time to get the adptr_info_len. */ -GetAdaptersInfo (adptr_info, &adptr_info_len); - - adptr_info =g_malloc (adptr_info_len); - ret =GetAdaptersInfo (adptr_info, &adptr_info_len); -if (ret !=ERROR_SUCCESS ) { -g_free (adptr_info); - adptr_info =NULL ; - } -return adptr_info; -} - -static int64_t guest_ip_prefix (IP_ADAPTER_UNICAST_ADDRESS *ip_addr) -{ -int64_t prefix =-1 ;/* Use for AF_INET6 and unknown/undetermined values. */ -IP_ADAPTER_INFO *adptr_info, *info; -IP_ADDR_STRING *ip; -struct in_addr *p; - -if (ip_addr->Address.lpSockaddr->sa_family !=AF_INET ) { -return prefix; - } - adptr_info =guest_get_adapters_info (); -if (adptr_info ==NULL ) { -return prefix; - } - -/* Match up the passed in ip_addr with one found in adaptr_info. -* The matching one in adptr_info will have the netmask. -*/ - p = &((struct sockaddr_in *)ip_addr->Address.lpSockaddr)->sin_addr; -for (info = adptr_info; info; info = info->Next) { -for (ip = &info->IpAddressList; ip; ip = ip->Next) { -if (p->S_un.S_addr ==inet_addr (ip->IpAddress.String)) { - prefix =ctpop32 (inet_addr (ip->IpMask.String)); - goto out; - } - } - } -out: -g_free (adptr_info); -return prefix; -} -#endif #define INTERFACE_PATH_BUF_SZ 512@@ -1904,7 +1845,6 @@ typedef struct _GA_WTSINFOA {GuestUserList *qmp_guest_get_users (Error **err) { -#if (_WIN32_WINNT >=0x0600 )#define QGA_NANOSECONDS 10000000GHashTable *cache =NULL ;@@ -1974,10 +1914,6 @@ GuestUserList *qmp_guest_get_users(Error **err) }g_hash_table_destroy (cache);return head; -#else -error_setg (err,QERR_UNSUPPORTED ); -return NULL ; -#endif } typedef struct _ga_matrix_lookup_t {Signature · 1 line
1.8.3.1
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
[Qemu-devel] [PULL 22/54] test: execute g_test_run when tests are skipped
In reply to Paolo BonziniSometimes a test's main() function recognizes that the environment does not support the test, and therefore exits. In this case, we still should run g_test_run() so that a TAP harness will print the test plan ("1..0") and the test will be marked as skipped.
Message-Id: <[email protected]>
--- tests/cdrom-test.c | 2 +- tests/migration-test.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
tests/cdrom-test.c +1 -1
@@ -169,7 +169,7 @@ int main(int argc, char **argv)if (exec_genisoimg (genisocheck)) {/* genisoimage not available - so can't run tests */ -return 0 ; +return g_test_run (); } ret =prepare_image (arch, isoimage);
tests/migration-test.c +4 -4
@@ -789,7 +789,7 @@ int main(int argc, char **argv)g_test_init (&argc, &argv,NULL );if (!ufd_version_check ()) { -return 0 ; +return g_test_run (); }/*
@@ -800,7 +800,7 @@ int main(int argc, char **argv)if (g_str_equal (qtest_get_arch (),"ppc64" ) &&access ("/sys/module/kvm_hv" ,F_OK )) {g_test_message ("Skipping test: kvm_hv not available" ); -return 0 ; +return g_test_run (); }/*
@@ -811,11 +811,11 @@ int main(int argc, char **argv)#if defined(HOST_S390X )if (access ("/dev/kvm" ,R_OK |W_OK )) {g_test_message ("Skipping test: kvm not available" ); -return 0 ; +return g_test_run (); }#else g_test_message ("Skipping test: Need s390x host to work properly" ); -return 0 ; +return g_test_run ();#endif }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 17/54] scsi: esp: Defer command completion until previous interrupts have been handled
In reply to Paolo BonziniFrom: Guenter Roeck <[email protected]>
The guest OS reads RSTAT, RSEQ, and RINTR, and expects those registers to reflect a consistent state. However, it is possible that the registers can change after RSTAT was read, but before RINTR is read, when esp_command_complete() is called.
Guest OS qemu
-------- ----
[handle interrupt]
Read RSTAT
esp_command_complete()
RSTAT = STAT_ST
esp_dma_done()
RSTAT |= STAT_TC
RSEQ = 0
RINTR = INTR_BS
Read RSEQ
Read RINTR RINTR = 0
RSTAT &= ~STAT_TC
RSEQ = SEQ_CD
The guest OS would then try to handle INTR_BS combined with an old value of RSTAT. This sometimes resulted in lost events, spurious interrupts, guest OS confusion, and stalled SCSI operations. A typical guest error log (observed with various versions of Linux) looks as follows.
scsi host1: Spurious irq, sreg=13.
...
scsi host1: Aborting command [84531f10:2a]
scsi host1: Current command [f882eea8:35]
scsi host1: Queued command [84531f10:2a]
scsi host1: Active command [f882eea8:35]
scsi host1: Dumping command log
scsi host1: ent[15] CMD val[44] sreg[90] seqreg[00] sreg2[00] ireg[20] ss[00] event[0c] scsi host1: ent[16] CMD val[01] sreg[90] seqreg[00] sreg2[00] ireg[20] ss[02] event[0c] scsi host1: ent[17] CMD val[43] sreg[90] seqreg[00] sreg2[00] ireg[20] ss[02] event[0c] scsi host1: ent[18] EVENT val[0d] sreg[92] seqreg[04] sreg2[00] ireg[18] ss[00] event[0c]
...
Defer handling command completion until previous interrupts have been handled to fix the problem.
--- hw/scsi/esp-pci.c | 4 ++-- hw/scsi/esp.c | 33 ++++++++++++++++++++++++++------- hw/scsi/trace-events | 1 + include/hw/scsi/esp.h | 2 ++ 4 files changed, 31 insertions(+), 9 deletions(-)
hw/scsi/esp-pci.c +2 -2
@@ -313,8 +313,8 @@ static void esp_pci_hard_reset(DeviceState *dev)static const VMStateDescription vmstate_esp_pci_scsi = { .name ="pciespscsi" , - .version_id =0 , - .minimum_version_id =0 , + .version_id =1 , + .minimum_version_id =1 , .fields = (VMStateField []) {VMSTATE_PCI_DEVICE (parent_obj, PCIESPState),VMSTATE_BUFFER_UNSAFE (dma_regs, PCIESPState,0 ,8 *sizeof (uint32_t )),
hw/scsi/esp.c +26 -7
@@ -286,11 +286,8 @@ static void esp_do_dma(ESPState *s)esp_dma_done (s); } -void esp_command_complete (SCSIRequest *req,uint32_t status, -size_t resid) +static void esp_report_command_complete (ESPState *s,uint32_t status) { -ESPState *s = req->hba_private; -trace_esp_command_complete ();if (s->ti_size !=0 ) {trace_esp_command_complete_unexpected ();
@@ -311,6 +308,23 @@ void esp_command_complete(SCSIRequest *req, uint32_t status, } } +void esp_command_complete (SCSIRequest *req,uint32_t status, +size_t resid) +{ +ESPState *s = req->hba_private; + +if (s->rregs[ESP_RSTAT ] &STAT_INT ) { +/* Defer handling command complete until the previous +* interrupt has been handled. +*/ +trace_esp_command_complete_deferred (); + s->deferred_status = status; + s->deferred_complete = true; +return ; + } +esp_report_command_complete (s, status); +} +void esp_transfer_data (SCSIRequest *req,uint32_t len) {ESPState *s = req->hba_private;
@@ -422,7 +436,10 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr) s->rregs[ESP_RSTAT ] &= ~STAT_TC ; s->rregs[ESP_RSEQ ] =SEQ_CD ;esp_lower_irq (s); - +if (s->deferred_complete) { +esp_report_command_complete (s, s->deferred_status); + s->deferred_complete = false; + }return old_val;case ESP_TCHI :/* Return the unique id if the value has never been written */
@@ -582,6 +599,8 @@ const VMStateDescription vmstate_esp = {VMSTATE_UINT32 (ti_wptr, ESPState),VMSTATE_BUFFER (ti_buf, ESPState),VMSTATE_UINT32 (status, ESPState), +VMSTATE_UINT32 (deferred_status, ESPState), +VMSTATE_BOOL (deferred_complete, ESPState),VMSTATE_UINT32 (dma, ESPState),VMSTATE_PARTIAL_BUFFER (cmdbuf, ESPState,16 ), VMSTATE_BUFFER_START_MIDDLE_V(cmdbuf, ESPState, 16, 4),
@@ -671,8 +690,8 @@ static void sysbus_esp_hard_reset(DeviceState *dev)static const VMStateDescription vmstate_sysbus_esp_scsi = { .name ="sysbusespscsi" , - .version_id =0 , - .minimum_version_id =0 , + .version_id =1 , + .minimum_version_id =1 , .fields = (VMStateField []) {VMSTATE_STRUCT (esp, SysBusESPState,0 , vmstate_esp, ESPState),VMSTATE_END_OF_LIST ()
hw/scsi/trace-events +1 -0
@@ -167,6 +167,7 @@ esp_handle_satn_stop(uint32_t cmdlen) "cmdlen %d" esp_write_response(uint32_t status) "Transfer status (status=%d)" esp_do_dma(uint32_t cmdlen, uint32_t len) "command len %d + %d" esp_command_complete(void) "SCSI Command complete" +esp_command_complete_deferred(void) "SCSI Command complete deferred" esp_command_complete_unexpected(void) "SCSI command completed unexpectedly" esp_command_complete_fail(void) "Command failed" esp_transfer_data(uint32_t dma_left, int32_t ti_size) "transfer %d/%d"
include/hw/scsi/esp.h +2 -0
@@ -23,6 +23,8 @@ struct ESPState {int32_t ti_size;uint32_t ti_rptr, ti_wptr;uint32_t status; +uint32_t deferred_status; +bool deferred_complete;uint32_t dma;uint8_t ti_buf[TI_BUFSZ ];SCSIBus bus;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 10/54] memory: update coalesced_range on transaction_commit
In reply to Paolo BonziniThe e1000 driver calls memory_region_add_coalescing but kvm_coalesce_mmio_region is never called for those regions. The bug dates back to the introduction of the memory region API; to fix it, delete and re-add coalesced MMIO ranges when building the FlatViews.
Because coalesced MMIO regions apply to all address spaces, the has_coalesced_range flag has to be changed into an int.
--- memory.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
memory.c +16 -4
@@ -217,7 +217,7 @@ struct FlatRange {bool romd_mode;bool readonly;bool nonvolatile; -bool has_coalesced_range; +int has_coalesced_range; };#define FOR_EACH_FLAT_RANGE (var, view) \
@@ -651,7 +651,7 @@ static void render_memory_region(FlatView *view, fr.romd_mode = mr->romd_mode; fr.readonly = readonly; fr.nonvolatile = nonvolatile; - fr.has_coalesced_range = false; + fr.has_coalesced_range =0 ;/* Render the region itself into any gaps left by the current view. */ for (i =0 ; i < view->nr &&int128_nz (remain); ++i) {
@@ -858,6 +858,10 @@ static void flat_range_coalesced_io_del(FlatRange *fr, AddressSpace *as)return ; } +if (--fr->has_coalesced_range >0 ) { +return ; + } +MEMORY_LISTENER_UPDATE_REGION (fr, as, Reverse, coalesced_io_del,int128_get64 (fr->addr.start),int128_get64 (fr->addr.size));
@@ -873,7 +877,10 @@ static void flat_range_coalesced_io_add(FlatRange *fr, AddressSpace *as)return ; } - fr->has_coalesced_range = true; +if (fr->has_coalesced_range++) { +return ; + } + QTAILQ_FOREACH(cmr, &mr->coalesced, link) { tmp = addrrange_shift(cmr->addr, int128_sub(fr->addr.start,
@@ -920,6 +927,7 @@ static void address_space_update_topology_pass(AddressSpace *as,/* In old but not in new, or in both but attributes changed. */ if (!adding) { +flat_range_coalesced_io_del (frold, as);MEMORY_LISTENER_UPDATE_REGION (frold, as, Reverse, region_del); }
@@ -927,7 +935,9 @@ static void address_space_update_topology_pass(AddressSpace *as, }else if (frold && frnew &&flatrange_equal (frold, frnew)) {/* In both and unchanged (except logging may have changed) */ -if (adding) { +if (!adding) { +flat_range_coalesced_io_del (frold, as); + }else {MEMORY_LISTENER_UPDATE_REGION (frnew, as, Forward, region_nop);if (frnew->dirty_log_mask & ~frold->dirty_log_mask) { MEMORY_LISTENER_UPDATE_REGION(frnew, as, Forward, log_start,
@@ -939,6 +949,7 @@ static void address_space_update_topology_pass(AddressSpace *as, frold->dirty_log_mask, frnew->dirty_log_mask); } +flat_range_coalesced_io_add (frnew, as); } ++iold;
@@ -948,6 +959,7 @@ static void address_space_update_topology_pass(AddressSpace *as,if (adding) {MEMORY_LISTENER_UPDATE_REGION (frnew, as, Forward, region_add); +flat_range_coalesced_io_add (frnew, as); } ++inew;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 12/54] block/iscsi: drop unused IscsiAIOCB->buf field
In reply to Paolo BonziniFrom: Stefan Hajnoczi <[email protected]>
The IscsiAIOCB->buf field has not been used since commit e49ab19fcaa617ad6cdfe1ac401327326b6a2552 ("block/iscsi: bump libiscsi requirement to 1.9.0"). It used to be a linear buffer for old libiscsi versions that didn't support scatter-gather. The minimum libiscsi version supports scatter-gather so we don't linearize buffers anymore.
Message-Id: <[email protected]>
--- block/iscsi.c | 8 -------- 1 file changed, 8 deletions(-)
block/iscsi.c +0 -8
@@ -117,7 +117,6 @@ typedef struct IscsiAIOCB {QEMUBH *bh;IscsiLun *iscsilun;struct scsi_task *task; -uint8_t *buf;int status;int64_t sector_num;int nb_sectors;
@@ -150,9 +149,6 @@ iscsi_bh_cb(void *p)qemu_bh_delete (acb->bh); -g_free (acb->buf); - acb->buf =NULL ; - acb->common.cb (acb->common.opaque, acb->status);if (acb->task !=NULL ) {
@@ -933,9 +929,6 @@ iscsi_aio_ioctl_cb(struct iscsi_context *iscsi, int status, {IscsiAIOCB *acb = opaque; -g_free (acb->buf); - acb->buf =NULL ; - acb->status =0 ;if (status <0 ) { error_report("Failed to ioctl(SG_IO) to iSCSI lun. %s",
@@ -1010,7 +1003,6 @@ static BlockAIOCB *iscsi_aio_ioctl(BlockDriverState *bs, acb->iscsilun = iscsilun; acb->bh =NULL ; acb->status = -EINPROGRESS ; - acb->buf =NULL ; acb->ioh = buf;if (req !=SG_IO ) {
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 18/54] build-sys: don't include windows.h, osdep.h does it
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
osdep.h will also define the available Windows API version for QEMU.
Message-Id: <[email protected]>
--- accel/tcg/translate-all.c | 4 ---- 1 file changed, 4 deletions(-)
accel/tcg/translate-all.c +0 -4
@@ -16,12 +16,8 @@* You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#ifdef _WIN32 -#include <windows.h> -#endif #include "qemu/osdep.h" -#include "qemu-common.h" #define NO_CPU_IO_DEFS #include "cpu.h"
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 28/54] qemu/queue.h: typedef QTAILQ heads
In reply to Paolo BonziniThis will be needed when we change the QTAILQ head and elem structs to unions. However, it is also consistent with the usage elsewhere in QEMU for other list head structs (see for example FsMountList).
Note that most QTAILQs only need their name in order to do backwards walks. Those do not break with the struct->union change, and anyway the change will also remove the need to name heads when doing backwards walks, so those are not touched here.
--- exec.c | 3 ++- hw/vfio/common.c | 2 +- include/hw/vfio/vfio-common.h | 3 ++- include/qom/cpu.h | 5 +++-- ui/input.c | 14 ++++++++------ 5 files changed, 16 insertions(+), 11 deletions(-)
exec.c +2 -1
@@ -94,7 +94,8 @@ int target_page_bits;bool target_page_bits_decided;#endif -struct CPUTailQ cpus =QTAILQ_HEAD_INITIALIZER (cpus); +CPUTailQ cpus =QTAILQ_HEAD_INITIALIZER (cpus); +/* current CPU in the current thread. It is only valid inside cpu_exec() */ __threadCPUState *current_cpu;
hw/vfio/common.c +1 -1
@@ -37,7 +37,7 @@#include "trace.h" #include "qapi/error.h" -struct vfio_group_head vfio_group_list = +VFIOGroupList vfio_group_list =QLIST_HEAD_INITIALIZER (vfio_group_list); static QLIST_HEAD(, VFIOAddressSpace) vfio_address_spaces =QLIST_HEAD_INITIALIZER (vfio_address_spaces);
include/hw/vfio/vfio-common.h +2 -1
@@ -180,7 +180,8 @@ int vfio_get_device(VFIOGroup *group, const char *name, VFIODevice *vbasedev, Error **errp);extern const MemoryRegionOps vfio_region_ops; -extern QLIST_HEAD(vfio_group_head, VFIOGroup) vfio_group_list; +typedef QLIST_HEAD(VFIOGroupList, VFIOGroup) VFIOGroupList; +extern VFIOGroupList vfio_group_list;#ifdef CONFIG_LINUX int vfio_get_region_info(VFIODevice *vbasedev, int index,
include/qom/cpu.h +3 -2
@@ -435,8 +435,9 @@ struct CPUState {GArray *iommu_notifiers; }; -QTAILQ_HEAD (CPUTailQ, CPUState); -extern struct CPUTailQ cpus; +typedef QTAILQ_HEAD(CPUTailQ, CPUState) CPUTailQ; +extern CPUTailQ cpus; +#define first_cpu QTAILQ_FIRST_RCU(&cpus)#define CPU_NEXT (cpu) QTAILQ_NEXT_RCU(cpu, node)#define CPU_FOREACH (cpu) QTAILQ_FOREACH_RCU(cpu, &cpus, node)
ui/input.c +8 -6
@@ -19,6 +19,9 @@ struct QemuInputHandlerState { };typedef struct QemuInputEventQueue QemuInputEventQueue ; +typedef QTAILQ_HEAD(QemuInputEventQueueHead, QemuInputEventQueue) +QemuInputEventQueueHead ; +struct QemuInputEventQueue {enum {QEMU_INPUT_QUEUE_DELAY =1 ,
@@ -37,8 +40,7 @@ static QTAILQ_HEAD(, QemuInputHandlerState) handlers =static NotifierList mouse_mode_notifiers =NOTIFIER_LIST_INITIALIZER (mouse_mode_notifiers); -static QTAILQ_HEAD(QemuInputEventQueueHead, QemuInputEventQueue) kbd_queue = -QTAILQ_HEAD_INITIALIZER (kbd_queue); +static QemuInputEventQueueHead kbd_queue =QTAILQ_HEAD_INITIALIZER (kbd_queue);static QEMUTimer *kbd_timer;static uint32_t kbd_default_delay_ms =10 ;static uint32_t queue_count;
@@ -257,7 +259,7 @@ static void qemu_input_event_trace(QemuConsole *src, InputEvent *evt)static void qemu_input_queue_process (void *opaque) { -struct QemuInputEventQueueHead *queue = opaque; +QemuInputEventQueueHead *queue = opaque;QemuInputEventQueue *item;g_assert (!QTAILQ_EMPTY (queue));
@@ -288,7 +290,7 @@ static void qemu_input_queue_process(void *opaque) } } -static void qemu_input_queue_delay (struct QemuInputEventQueueHead *queue, +static void qemu_input_queue_delay (QemuInputEventQueueHead *queue,QEMUTimer *timer,uint32_t delay_ms) {QemuInputEventQueue *item =g_new0 (QemuInputEventQueue,1 );
@@ -306,7 +308,7 @@ static void qemu_input_queue_delay(struct QemuInputEventQueueHead *queue, } } -static void qemu_input_queue_event (struct QemuInputEventQueueHead *queue, +static void qemu_input_queue_event (QemuInputEventQueueHead *queue,QemuConsole *src,InputEvent *evt) {QemuInputEventQueue *item =g_new0 (QemuInputEventQueue,1 );
@@ -318,7 +320,7 @@ static void qemu_input_queue_event(struct QemuInputEventQueueHead *queue, queue_count++; } -static void qemu_input_queue_sync (struct QemuInputEventQueueHead *queue) +static void qemu_input_queue_sync (QemuInputEventQueueHead *queue) {QemuInputEventQueue *item =g_new0 (QemuInputEventQueue,1 );
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 29/54] qemu/queue.h: remove Q_TAILQ_{HEAD, ENTRY}
In reply to Paolo BonziniThese are not present for other kinds of queue, and unused. Zap them before more changes are made to the QTAILQ implementation.
--- include/qemu/queue.h | 14 ++++++-------- scripts/cocci-macro-file.h | 10 ---------- 2 files changed, 6 insertions(+), 18 deletions(-)
include/qemu/queue.h +6 -8
@@ -350,22 +350,20 @@ struct { \/* * Tail queue definitions. */ -#define Q_TAILQ_HEAD(name, type, qual) \ +#define QTAILQ_HEAD (name, type) \ struct name { \ - qual type *tqh_first; /* first element */ \ - qual type *qual *tqh_last;/* addr of last next element */ \ + type *tqh_first;/* first element */ \ +type **tqh_last;/* addr of last next element */ \ } -#define QTAILQ_HEAD (name, type) Q_TAILQ_HEAD(name, struct type,)#define QTAILQ_HEAD_INITIALIZER (head) \ { NULL, &(head).tqh_first } -#define Q_TAILQ_ENTRY(type, qual) \ +#define QTAILQ_ENTRY (type) \ struct { \ - qual type *tqe_next; /* next element */ \ - qual type *qual *tqe_prev; /* address of previous next element */\ + type *tqe_next;/* next element */ \ +type **tqe_prev;/* address of previous next element */ \ } -#define QTAILQ_ENTRY(type) Q_TAILQ_ENTRY(struct type,)/* * Tail queue functions.
scripts/cocci-macro-file.h +0 -10
@@ -93,11 +93,6 @@ struct { \/* * Tail queue definitions. */ -#define Q_TAILQ_HEAD(name, type, qual) \ -struct name { \ - qual type *tqh_first; /* first element */ \ - qual type *qual *tqh_last;/* addr of last next element */ \ -}#define QTAILQ_HEAD (name, type) \ struct name { \ type *tqh_first;/* first element */ \
@@ -107,11 +102,6 @@ struct name { \#define QTAILQ_HEAD_INITIALIZER (head) \ { NULL, &(head).tqh_first } -#define Q_TAILQ_ENTRY(type, qual) \ -struct { \ - qual type *tqe_next; /* next element */ \ - qual type *qual *tqe_prev;/* address of previous next element */ \ -}#define QTAILQ_ENTRY (type) \ struct { \ type *tqe_next;/* next element */ \
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 32/54] checkpatch: warn about qemu/queue.h head structs that are not typedef-ed
In reply to Paolo BonziniThese are just like any other struct or union, so they should have CamelCase typedefs.
--- scripts/checkpatch.pl | 5 +++++ 1 file changed, 5 insertions(+)
scripts/checkpatch.pl +5 -0
@@ -2263,6 +2263,11 @@ sub process { } } + if ($line =~ /^.\s*(Q(?:S?LIST|SIMPLEQ|TAILQ)_HEAD)\s*\(\s*[^,]/ && + $line !~ /^.typedef/) { + ERROR("named $1 should be typedefed separately\n" . $herecurr); + } + # Need a space before open parenthesis after if, while etc if ($line=~/\b(if|while|for|switch)\(/) { ERROR("space required before the open parenthesis '('\n" . $herecurr);
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 33/54] configure: Add a test for the minimum compiler version
In reply to Paolo BonziniFrom: Thomas Huth <[email protected]>
So far we only had implicit requirements for the minimum compiler version, e.g. we require at least GCC 4.1 for the support of atomics. However, such old compiler versions are not tested anymore by the developers, so they are not really supported anymore. Since we recently declared explicitly what platforms we intend to support, we can also get more explicit on the compiler version now. The supported distributions use the following version of GCC:
RHEL-7: 4.8.5
Debian (Stretch): 6.3.0
Debian (Jessie): 4.8.4
OpenBSD (ports): 4.9.4
FreeBSD (ports): 8.2.0
OpenSUSE Leap 15: 7.3.1
Ubuntu (Xenial): 5.3.1
macOS (Homebrew): 8.2.0So we can safely assume GCC 4.8 these days. For Clang, the situation is a little bit more ambiguous, since it is sometimes not available in the main distros but rather third party repositories. At least Debian Jessie uses version 3.5, and EPEL7 for RHEL7 uses 3.4, so let's use 3.4 as minimum Clang version now - we still can adjust this later if necessary.
Unfortunately Apple uses different version numbers for the Clang that is included in their Xcode suite, so we need to check the version numbers for Xcode separately. Xcode 5.1 seems to be the first one that has been shipped with LLVM 3.4, so use this version as the minimum there.
Message-Id: <[email protected]>
--- configure | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
configure +25 -0
@@ -1837,6 +1837,31 @@ if test "$bogus_os" = "yes"; then error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" fi +# Check whether the compiler matches our minimum requirements: +cat > $TMPC << EOF +#if defined(__clang_major__) && defined(__clang_minor__) +# ifdef __apple_build_version__ +# if __clang_major__ < 5 || (__clang_major__ == 5 && __clang_minor__ < 1) +# error You need at least XCode Clang v5.1 to compile QEMU +# endif +# else +# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4) +# error You need at least Clang v3.4 to compile QEMU +# endif +# endif +#elif defined(__GNUC__) && defined(__GNUC_MINOR__) +# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8) +# error You need at least GCC v4.8 to compile QEMU +# endif +#else +# error You either need GCC or Clang to compiler QEMU +#endif +int main (void) { return 0; } +EOF +if ! compile_prog "" "" ; then + error_exit "You need at least GCC v4.8 or Clang v3.4 (or XCode Clang v5.1)" +fi + gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 34/54] configure: Remove obsolete check for Clang < 3.2
In reply to Paolo BonziniFrom: Thomas Huth <[email protected]>
Since we have got a check for Clang >= 3.4 now, we do not need to check for older Clang versions in the configure test for 128-bit ints anymore.
Message-Id: <[email protected]>
--- configure | 5 ----- 1 file changed, 5 deletions(-)
configure +0 -5
@@ -5145,11 +5145,6 @@ fi int128=no cat > $TMPC << EOF -#if defined(__clang_major__) && defined(__clang_minor__) -# if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2)) -# error __int128_t does not work in CLANG before 3.2 -# endif -#endif __int128_t a; __uint128_t b; int main (void) {
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 35/54] configure: Remove old -fno-gcse workaround for GCC 4.6.x and 4.7.[012]
In reply to Paolo BonziniFrom: Thomas Huth <[email protected]>
Now that we require at least GCC 4.8, we don't need this als workaround for 4.6 and 4.7 anymore.
Message-Id: <[email protected]>
--- Makefile.target | 3 --- configure | 16 ---------------- 2 files changed, 19 deletions(-)
Makefile.target +0 -3
@@ -158,9 +158,6 @@ GENERATED_FILES += hmp-commands.h hmp-commands-info.h endif # CONFIG_SOFTMMU -# Workaround for http://gcc.gnu.org/PR55489, see configure. -%/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS) - dummy := $(call unnest-vars,,obj-y) all-obj-y := $(obj-y)
configure +0 -16
@@ -1933,21 +1933,6 @@ else QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces" fi -# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and -# large functions that use global variables. The bug is in all releases of -# GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in -# 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013. -cat > $TMPC << EOF -#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2)) -int main(void) { return 0; } -#else -#error No bug in this compiler. -#endif -EOF -if compile_prog "-Werror -fno-gcse" "" ; then - TRANSLATE_OPT_CFLAGS=-fno-gcse -fi - if test "$static" = "yes" ; then if test "$modules" = "yes" ; then error_exit "static and modules are mutually incompatible"
@@ -6980,7 +6965,6 @@ echo "LIBS_QGA+=$libs_qga" >> $config_host_mak echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak echo "POD2MAN=$POD2MAN" >> $config_host_mak -echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak if test "$gcov" = "yes" ; then echo "CONFIG_GCOV=y" >> $config_host_mak echo "GCOV=$gcov_tool" >> $config_host_mak
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 36/54] tcg/tcg.h: Remove GCC check for tcg_debug_assert() macro
In reply to Paolo BonziniFrom: Thomas Huth <[email protected]>
Both GCC v4.8 and Clang v3.4 support (our minimum versions) support __builtin_unreachable(), so we can remove the version check here now.
Message-Id: <[email protected]>
--- tcg/tcg.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
tcg/tcg.h +1 -3
@@ -230,11 +230,9 @@ typedef uint64_t tcg_insn_unit;#if definedCONFIG_DEBUG_TCG || definedQEMU_STATIC_ANALYSIS # define tcg_debug_assert (X ) do { assert(X); } while (0) -#elif QEMU_GNUC_PREREQ (4 ,5 ) +#else # define tcg_debug_assert (X ) \ do { if (!(X)) { __builtin_unreachable(); } } while (0) -#else -# define tcg_debug_assert (X ) do { (void)(X); } while (0)#endif typedef struct TCGRelocation {
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 23/54] test: replace gtester with a TAP driver
In reply to Paolo Bonzinigtester is deprecated by upstream glib (see for example the announcement at https://blog.gtk.org/2018/07/11/news-from-glib-2-58/) and it does not support tests that call g_test_skip in some glib stable releases.
glib suggests instead using Automake's TAP support, which gtest itself supports since version 2.38 (QEMU's minimum requirement is 2.40). We do not support Automake, but we can use Automake's code to beautify the TAP output. I chose to use the Perl copy rather than the shell/awk one, with some changes so that it can accept TAP through stdin, in order to reuse Perl's TAP parsing package. This also avoids duplicating the parser between tap-driver.pl and tap-merge.pl.
Message-Id: <[email protected]>
--- scripts/gtester-cat | 26 -- scripts/tap-driver.pl | 378 +++++++++++++++++++++++++++ scripts/tap-merge.pl | 110 ++++++++ tests/Makefile.include | 54 ++-- tests/docker/dockerfiles/centos7.docker | 1 + tests/docker/dockerfiles/debian-amd64.docker | 1 + tests/docker/dockerfiles/debian-ports.docker | 1 + tests/docker/dockerfiles/debian-sid.docker | 1 + tests/docker/dockerfiles/debian8.docker | 1 + tests/docker/dockerfiles/debian9.docker | 1 + tests/docker/dockerfiles/fedora.docker | 1 + tests/docker/dockerfiles/ubuntu.docker | 1 + 12 files changed, 529 insertions(+), 47 deletions(-) delete mode 100755 scripts/gtester-cat create mode 100755 scripts/tap-driver.pl create mode 100755 scripts/tap-merge.pl
scripts/gtester-cat deleted +0 -26
@@ -1,26 +0,0 @@ -#!/bin/sh -# -# Copyright IBM, Corp. 2012 -# -# Authors: -# Anthony Liguori <[email protected]> -# -# This work is licensed under the terms of the GNU GPLv2 or later. -# See the COPYING file in the top-level directory. - -cat <<EOF -<?xml version="1.0"?> -<gtester> - <info> - <package>qemu</package> - <version>0.0</version> - <revision>rev</revision> - </info> -EOF - -sed \ - -e '/<?xml/d' \ - -e '/^<gtester>$/d' \ - -e '/<info>/,/<\/info>/d' \ - -e '$b' \ - -e '/^<\/gtester>$/d' "$@"
scripts/tap-driver.pl new file +378 -0
378 lines not on this page · raw message
scripts/tap-merge.pl new file +110 -0
110 lines not on this page · raw message
tests/Makefile.include +33 -21
74 lines not on this page · raw message
tests/docker/dockerfiles/centos7.docker +1 -0
@@ -22,6 +22,7 @@ ENV PACKAGES \ mesa-libEGL-devel \ mesa-libgbm-devel \ nettle-devel \ + perl-Test-Harness \ pixman-devel \ SDL-devel \ spice-glib-devel \
tests/docker/dockerfiles/debian-amd64.docker +1 -0
@@ -16,6 +16,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ liblzo2-dev \ librdmacm-dev \ libsnappy-dev \ + libtest-harness-perl \ libvte-dev # virgl
tests/docker/dockerfiles/debian-ports.docker +1 -0
@@ -29,6 +29,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ flex \ gettext \ git \ + libtest-harness-perl \ pkg-config \ psmisc \ python \
tests/docker/dockerfiles/debian-sid.docker +1 -0
@@ -26,6 +26,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ ca-certificates \ flex \ git \ + libtest-harness-perl \ pkg-config \ psmisc \ python \
tests/docker/dockerfiles/debian8.docker +1 -0
@@ -29,6 +29,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ gettext \ git \ gnupg \ + libtest-harness-perl \ pkg-config \ python-minimal
tests/docker/dockerfiles/debian9.docker +1 -0
@@ -24,6 +24,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ flex \ gettext \ git \ + libtest-harness-perl \ pkg-config \ psmisc \ python \
tests/docker/dockerfiles/fedora.docker +1 -0
@@ -70,6 +70,7 @@ ENV PACKAGES \ nss-devel \ numactl-devel \ perl \ + perl-Test-Harness \ pixman-devel \ python3 \ PyYAML \
tests/docker/dockerfiles/ubuntu.docker +1 -0
@@ -45,6 +45,7 @@ ENV PACKAGES flex bison \ libspice-protocol-dev \ libspice-server-dev \ libssh2-1-dev \ + libtest-harness-perl \ libusb-1.0-0-dev \ libusbredirhost-dev \ libvdeplug-dev \
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 27/54] qemu/queue.h: leave head structs anonymous unless necessary
In reply to Paolo BonziniMost list head structs need not be given a name. In most cases the name is given just in case one is going to use QTAILQ_LAST, QTAILQ_PREV or reverse iteration, but this does not apply to lists of other kinds, and even for QTAILQ in practice this is only rarely needed. In addition, we will soon reimplement those macros completely so that they do not need a name for the head struct. So clean up everything, not giving a name except in the rare case where it is necessary.
--- accel/kvm/kvm-all.c | 4 ++-- block/gluster.c | 2 +- block/mirror.c | 2 +- block/qcow2-bitmap.c | 4 +--- block/qcow2.h | 2 +- block/sheepdog.c | 6 +++--- block/vhdx.h | 2 +- blockdev.c | 2 +- contrib/ivshmem-client/ivshmem-client.h | 4 +--- contrib/ivshmem-server/ivshmem-server.h | 5 +---- exec.c | 2 +- fsdev/qemu-fsdev.c | 2 +- hw/block/nvme.h | 8 ++++---- hw/block/xen_disk.c | 6 +++--- hw/core/reset.c | 2 +- hw/i386/xen/xen-mapcache.c | 2 +- hw/ppc/spapr_iommu.c | 2 +- hw/usb/ccid-card-emulated.c | 4 ++-- hw/usb/dev-network.c | 2 +- hw/usb/xen-usb.c | 6 +++--- hw/watchdog/watchdog.c | 2 +- hw/xen/xen_pvdev.c | 4 ++-- include/exec/memory.h | 4 ++-- include/hw/vfio/vfio-platform.h | 2 +- include/qom/cpu.h | 4 ++-- include/sysemu/kvm.h | 2 -- include/sysemu/rng.h | 2 +- linux-user/elfload.c | 2 +- memory.c | 2 +- migration/block-dirty-bitmap.c | 2 +- migration/block.c | 4 ++-- migration/ram.c | 2 +- monitor.c | 4 ++-- net/queue.c | 2 +- net/slirp.c | 2 +- slirp/slirp.c | 2 +- target/arm/kvm.c | 2 +- target/i386/hax-mem.c | 2 +- tcg/tcg.h | 2 +- tests/test-rcu-list.c | 2 +- vl.c | 2 +- 41 files changed, 56 insertions(+), 65 deletions(-)
accel/kvm/kvm-all.c +2 -2
@@ -86,7 +86,7 @@ struct KVMStateint robust_singlestep;int debugregs;#ifdef KVM_CAP_SET_GUEST_DEBUG -struct kvm_sw_breakpoint_head kvm_sw_breakpoints; + QTAILQ_HEAD(, kvm_sw_breakpoint) kvm_sw_breakpoints;#endif int many_ioeventfds;int intx_set_mask;
@@ -102,7 +102,7 @@ struct KVMStateint nr_allocated_irq_routes;unsigned long *used_gsi_bitmap;unsigned int gsi_count; - QTAILQ_HEAD(msi_hashtab, KVMMSIRoute) msi_hashtab[KVM_MSI_HASHTAB_SIZE]; + QTAILQ_HEAD(, KVMMSIRoute) msi_hashtab[KVM_MSI_HASHTAB_SIZE];#endif KVMMemoryListener memory_listener; QLIST_HEAD(, KVMParkedVcpu) kvm_parked_vcpus;
block/gluster.c +1 -1
@@ -72,7 +72,7 @@ typedef struct ListElement {GlfsPreopened saved; } ListElement; -static QLIST_HEAD(glfs_list, ListElement) glfs_list; +static QLIST_HEAD(, ListElement) glfs_list;static QemuOptsList qemu_gluster_create_opts = { .name ="qemu-gluster-create-opts" ,
block/mirror.c +1 -1
@@ -72,7 +72,7 @@ typedef struct MirrorBlockJob {unsigned long *in_flight_bitmap;int in_flight;int64_t bytes_in_flight; - QTAILQ_HEAD(MirrorOpList, MirrorOp) ops_in_flight; + QTAILQ_HEAD(, MirrorOp) ops_in_flight;int ret;bool unmap;int target_cluster_size;
block/qcow2-bitmap.c +1 -3
@@ -77,8 +77,6 @@ typedef struct Qcow2BitmapTable {uint32_t size;/* number of 64bit entries */ QSIMPLEQ_ENTRY (Qcow2BitmapTable) entry; } Qcow2BitmapTable; -typedef QSIMPLEQ_HEAD(Qcow2BitmapTableList, Qcow2BitmapTable) -Qcow2BitmapTableList ; typedef struct Qcow2Bitmap { Qcow2BitmapTable table;
@@ -1316,7 +1314,7 @@ void qcow2_store_persistent_dirty_bitmaps(BlockDriverState *bs, Error **errp)int ret;Qcow2BitmapList *bm_list;Qcow2Bitmap *bm; -Qcow2BitmapTableList drop_tables; + QSIMPLEQ_HEAD(, Qcow2BitmapTable) drop_tables;Qcow2BitmapTable *tb, *tb_next;if (!bdrv_has_changed_persistent_bitmaps (bs)) {
block/qcow2.h +1 -1
@@ -281,7 +281,7 @@ typedef struct BDRVQcow2State {uint8_t *cluster_cache;uint8_t *cluster_data;uint64_t cluster_cache_offset; - QLIST_HEAD(QCowClusterAlloc, QCowL2Meta) cluster_allocs; + QLIST_HEAD(, QCowL2Meta) cluster_allocs;uint64_t *refcount_table;uint64_t refcount_table_offset;
block/sheepdog.c +3 -3
@@ -391,12 +391,12 @@ struct BDRVSheepdogState {uint32_t aioreq_seq_num;/* Every aio request must be linked to either of these queues. */ - QLIST_HEAD(inflight_aio_head, AIOReq) inflight_aio_head; - QLIST_HEAD(failed_aio_head, AIOReq) failed_aio_head; + QLIST_HEAD(, AIOReq) inflight_aio_head; + QLIST_HEAD(, AIOReq) failed_aio_head;CoMutex queue_lock;CoQueue overlapping_queue; - QLIST_HEAD(inflight_aiocb_head, SheepdogAIOCB) inflight_aiocb_head; + QLIST_HEAD(, SheepdogAIOCB) inflight_aiocb_head; }; typedef struct BDRVSheepdogReopenState {
block/vhdx.h +1 -1
@@ -398,7 +398,7 @@ typedef struct BDRVVHDXState {bool log_replayed_on_open; - QLIST_HEAD(VHDXRegionHead, VHDXRegionEntry) regions; + QLIST_HEAD(, VHDXRegionEntry) regions; } BDRVVHDXState;void vhdx_guid_generate (MSGUID *guid);
blockdev.c +1 -1
@@ -2269,7 +2269,7 @@ void qmp_transaction(TransactionActionList *dev_list,BlkActionState *state, *next;Error *local_err =NULL ; - QSIMPLEQ_HEAD(snap_bdrv_states, BlkActionState) snap_bdrv_states; + QSIMPLEQ_HEAD(, BlkActionState) snap_bdrv_states;QSIMPLEQ_INIT (&snap_bdrv_states);/* Does this transaction get canceled as a group on failure?
contrib/ivshmem-client/ivshmem-client.h +1 -3
@@ -46,9 +46,7 @@ typedef struct IvshmemClientPeer {int vectors[IVSHMEM_CLIENT_MAX_VECTORS ];/**< one fd per vector */ unsigned vectors_count;/**< number of vectors */ } IvshmemClientPeer; -QTAILQ_HEAD (IvshmemClientPeerList, IvshmemClientPeer); -typedef struct IvshmemClientPeerList IvshmemClientPeerList ;typedef struct IvshmemClient IvshmemClient ;/**
@@ -73,7 +71,7 @@ struct IvshmemClient {int sock_fd;/**< unix sock filedesc */ int shm_fd;/**< shm file descriptor */ -IvshmemClientPeerList peer_list;/**< list of peers */ + QTAILQ_HEAD(, IvshmemClientPeer) peer_list; /**< list of peers */IvshmemClientPeer local;/**< our own infos */ IvshmemClientNotifCb notif_cb;/**< notification callback */
contrib/ivshmem-server/ivshmem-server.h +1 -4
@@ -52,9 +52,6 @@ typedef struct IvshmemServerPeer {EventNotifier vectors[IVSHMEM_SERVER_MAX_VECTORS ];/**< one per vector */ unsigned vectors_count;/**< number of vectors */ } IvshmemServerPeer; -QTAILQ_HEAD (IvshmemServerPeerList, IvshmemServerPeer); - -typedef struct IvshmemServerPeerList IvshmemServerPeerList ;/** * Structure describing an ivshmem server
@@ -72,7 +69,7 @@ typedef struct IvshmemServer {unsigned n_vectors;/**< number of vectors */ uint16_t cur_id;/**< id to be given to next client */ bool verbose;/**< true in verbose mode */ -IvshmemServerPeerList peer_list;/**< list of peers */ + QTAILQ_HEAD(, IvshmemServerPeer) peer_list; /**< list of peers */ } IvshmemServer;/**
exec.c +1 -1
@@ -3464,7 +3464,7 @@ typedef struct MapClient { } MapClient;QemuMutex map_client_list_lock; -static QLIST_HEAD(map_client_list, MapClient) map_client_list +static QLIST_HEAD(, MapClient) map_client_list =QLIST_HEAD_INITIALIZER (map_client_list);static void cpu_unregister_map_client_do (MapClient *client)
fsdev/qemu-fsdev.c +1 -1
@@ -18,7 +18,7 @@#include "qemu/error-report.h" #include "qemu/option.h" -static QTAILQ_HEAD(FsDriverEntry_head, FsDriverListEntry) fsdriver_entries = +static QTAILQ_HEAD(, FsDriverListEntry) fsdriver_entries =QTAILQ_HEAD_INITIALIZER (fsdriver_entries);static FsDriverTable FsDrivers[] = {
hw/block/nvme.h +4 -4
@@ -29,8 +29,8 @@ typedef struct NvmeSQueue {uint64_t dma_addr;QEMUTimer *timer;NvmeRequest *io_req; - QTAILQ_HEAD(sq_req_list, NvmeRequest) req_list; - QTAILQ_HEAD(out_req_list, NvmeRequest) out_req_list; + QTAILQ_HEAD(, NvmeRequest) req_list; + QTAILQ_HEAD(, NvmeRequest) out_req_list;QTAILQ_ENTRY (NvmeSQueue) entry; } NvmeSQueue;
@@ -45,8 +45,8 @@ typedef struct NvmeCQueue {uint32_t size;uint64_t dma_addr;QEMUTimer *timer; - QTAILQ_HEAD(sq_list, NvmeSQueue) sq_list; - QTAILQ_HEAD(cq_req_list, NvmeRequest) req_list; + QTAILQ_HEAD(, NvmeSQueue) sq_list; + QTAILQ_HEAD(, NvmeRequest) req_list; } NvmeCQueue; typedef struct NvmeNamespace {
hw/block/xen_disk.c +3 -3
@@ -82,9 +82,9 @@ struct XenBlkDev {int more_work;/* request lists */ - QLIST_HEAD(inflight_head, ioreq) inflight; - QLIST_HEAD(finished_head, ioreq) finished; - QLIST_HEAD(freelist_head, ioreq) freelist; + QLIST_HEAD(, ioreq) inflight; + QLIST_HEAD(, ioreq) finished; + QLIST_HEAD(, ioreq) freelist;int requests_total;int requests_inflight;int requests_finished;
hw/core/reset.c +1 -1
@@ -35,7 +35,7 @@ typedef struct QEMUResetEntry {void *opaque; } QEMUResetEntry; -static QTAILQ_HEAD(reset_handlers, QEMUResetEntry) reset_handlers = +static QTAILQ_HEAD(, QEMUResetEntry) reset_handlers =QTAILQ_HEAD_INITIALIZER (reset_handlers);void qemu_register_reset (QEMUResetHandler *func,void *opaque)
hw/i386/xen/xen-mapcache.c +1 -1
@@ -71,7 +71,7 @@ typedef struct MapCacheRev { typedef struct MapCache { MapCacheEntry *entry; unsigned long nr_buckets; - QTAILQ_HEAD(map_cache_head, MapCacheRev) locked_entries; + QTAILQ_HEAD(, MapCacheRev) locked_entries; /* For most cases (>99.9%), the page address is the same. */ MapCacheEntry *last_entry;
hw/ppc/spapr_iommu.c +1 -1
@@ -42,7 +42,7 @@ enum sPAPRTCEAccess {#define IOMMU_PAGE_SIZE (shift) (1ULL << (shift))#define IOMMU_PAGE_MASK (shift) (~(IOMMU_PAGE_SIZE(shift) - 1)) -static QLIST_HEAD(spapr_tce_tables, sPAPRTCETable) spapr_tce_tables; +static QLIST_HEAD(, sPAPRTCETable) spapr_tce_tables;sPAPRTCETable *spapr_tce_find_by_liobn (target_ulong liobn) {
hw/usb/ccid-card-emulated.c +2 -2
@@ -119,11 +119,11 @@ struct EmulatedState {char *db;uint8_t atr[MAX_ATR_SIZE ];uint8_t atr_length; - QSIMPLEQ_HEAD(event_list, EmulEvent) event_list; + QSIMPLEQ_HEAD(, EmulEvent) event_list;QemuMutex event_list_mutex;QemuThread event_thread_id;VReader *reader; - QSIMPLEQ_HEAD(guest_apdu_list, EmulEvent) guest_apdu_list; + QSIMPLEQ_HEAD(, EmulEvent) guest_apdu_list;QemuMutex vreader_mutex;/* and guest_apdu_list mutex */ QemuMutex handle_apdu_mutex;QemuCond handle_apdu_cond;
hw/usb/dev-network.c +1 -1
@@ -648,7 +648,7 @@ typedef struct USBNetState {char usbstring_mac[13 ];NICState *nic;NICConf conf; - QTAILQ_HEAD(rndis_resp_head, rndis_response) rndis_resp; + QTAILQ_HEAD(, rndis_response) rndis_resp; } USBNetState;#define TYPE_USB_NET "usb-net"
hw/usb/xen-usb.c +3 -3
@@ -72,7 +72,7 @@ struct usbback_stub {USBPort port;unsigned int speed;bool attached; - QTAILQ_HEAD(submit_q_head, usbback_req) submit_q; + QTAILQ_HEAD(, usbback_req) submit_q; };struct usbback_req {
@@ -108,8 +108,8 @@ struct usbback_info {int num_ports;int usb_ver;bool ring_error; - QTAILQ_HEAD(req_free_q_head, usbback_req) req_free_q; - QSIMPLEQ_HEAD(hotplug_q_head, usbback_hotplug) hotplug_q; + QTAILQ_HEAD(, usbback_req) req_free_q; + QSIMPLEQ_HEAD(, usbback_hotplug) hotplug_q;struct usbback_stub ports[USBBACK_MAXPORTS ];struct usbback_stub *addr_table[USB_DEV_ADDR_SIZE ];QEMUBH *bh;
hw/watchdog/watchdog.c +1 -1
@@ -32,7 +32,7 @@#include "qemu/help_option.h" static WatchdogAction watchdog_action =WATCHDOG_ACTION_RESET ; -static QLIST_HEAD(watchdog_list, WatchdogTimerModel) watchdog_list; +static QLIST_HEAD(, WatchdogTimerModel) watchdog_list;void watchdog_add_model (WatchdogTimerModel *model) {
hw/xen/xen_pvdev.c +2 -2
@@ -31,10 +31,10 @@ struct xs_dirs {QTAILQ_ENTRY (xs_dirs) list; }; -static QTAILQ_HEAD(xs_dirs_head, xs_dirs) xs_cleanup = +static QTAILQ_HEAD(, xs_dirs) xs_cleanup =QTAILQ_HEAD_INITIALIZER (xs_cleanup); -static QTAILQ_HEAD(XenDeviceHead, XenDevice) xendevs = +static QTAILQ_HEAD(, XenDevice) xendevs =QTAILQ_HEAD_INITIALIZER (xendevs);/* ------------------------------------------------------------- */
include/exec/memory.h +2 -2
@@ -379,9 +379,9 @@ struct MemoryRegion {MemoryRegion *alias;hwaddr alias_offset;int32_t priority; - QTAILQ_HEAD(subregions, MemoryRegion) subregions; + QTAILQ_HEAD(, MemoryRegion) subregions;QTAILQ_ENTRY (MemoryRegion) subregions_link; - QTAILQ_HEAD(coalesced_ranges, CoalescedMemoryRange) coalesced; + QTAILQ_HEAD(, CoalescedMemoryRange) coalesced;const char *name;unsigned ioeventfd_nb;MemoryRegionIoeventfd *ioeventfds;
include/hw/vfio/vfio-platform.h +1 -1
@@ -53,7 +53,7 @@ typedef struct VFIOPlatformDevice {VFIORegion **regions; QLIST_HEAD(, VFIOINTp) intp_list; /* list of IRQs *//* queue of pending IRQs */ - QSIMPLEQ_HEAD(pending_intp_queue, VFIOINTp) pending_intp_queue; + QSIMPLEQ_HEAD(, VFIOINTp) pending_intp_queue;char *compat;/* DT compatible values, separated by NUL */ unsigned int num_compat;/* number of compatible values */ uint32_t mmap_timeout;/* delay to re-enable mmaps after interrupt */
include/qom/cpu.h +2 -2
@@ -375,9 +375,9 @@ struct CPUState {QTAILQ_ENTRY (CPUState) node;/* ice debug support */ - QTAILQ_HEAD(breakpoints_head, CPUBreakpoint) breakpoints; + QTAILQ_HEAD(, CPUBreakpoint) breakpoints; - QTAILQ_HEAD(watchpoints_head, CPUWatchpoint) watchpoints; + QTAILQ_HEAD(, CPUWatchpoint) watchpoints;CPUWatchpoint *watchpoint_hit;void *opaque;
include/sysemu/kvm.h +0 -2
@@ -412,8 +412,6 @@ struct kvm_sw_breakpoint {QTAILQ_ENTRY (kvm_sw_breakpoint) entry; }; -QTAILQ_HEAD (kvm_sw_breakpoint_head, kvm_sw_breakpoint); -struct kvm_sw_breakpoint *kvm_find_sw_breakpoint (CPUState *cpu,target_ulong pc);
include/sysemu/rng.h +1 -1
@@ -57,7 +57,7 @@ struct RngBackend/*< protected >*/ bool opened; - QSIMPLEQ_HEAD(requests, RngRequest) requests; + QSIMPLEQ_HEAD(, RngRequest) requests; };
linux-user/elfload.c +1 -1
@@ -2844,7 +2844,7 @@ struct elf_note_info {struct target_elf_prstatus *prstatus;/* NT_PRSTATUS */ struct target_elf_prpsinfo *psinfo;/* NT_PRPSINFO */ - QTAILQ_HEAD(thread_list_head, elf_thread_status) thread_list; + QTAILQ_HEAD(, elf_thread_status) thread_list;#if 0 /* * Current version of ELF coredump doesn't support
memory.c +1 -1
@@ -2795,7 +2795,7 @@ struct MemoryRegionList {QTAILQ_ENTRY (MemoryRegionList) mrqueue; }; -typedef QTAILQ_HEAD(mrqueue, MemoryRegionList) MemoryRegionListHead; +typedef QTAILQ_HEAD(, MemoryRegionList) MemoryRegionListHead;#define MR_SIZE (size) (int128_nz(size) ? (hwaddr)int128_get64( \ int128_sub((size), int128_one())) : 0)
migration/block-dirty-bitmap.c +1 -1
@@ -116,7 +116,7 @@ typedef struct DirtyBitmapMigBitmapState { } DirtyBitmapMigBitmapState; typedef struct DirtyBitmapMigState { - QSIMPLEQ_HEAD(dbms_list, DirtyBitmapMigBitmapState) dbms_list; + QSIMPLEQ_HEAD(, DirtyBitmapMigBitmapState) dbms_list; bool bulk_completed; bool no_bitmaps;
migration/block.c +2 -2
@@ -93,12 +93,12 @@ typedef struct BlkMigBlock { } BlkMigBlock; typedef struct BlkMigState { - QSIMPLEQ_HEAD(bmds_list, BlkMigDevState) bmds_list; + QSIMPLEQ_HEAD(, BlkMigDevState) bmds_list; int64_t total_sector_sum; bool zero_blocks; /* Protected by lock. */ - QSIMPLEQ_HEAD(blk_list, BlkMigBlock) blk_list; + QSIMPLEQ_HEAD(, BlkMigBlock) blk_list; int submitted; int read_done;
migration/ram.c +1 -1
@@ -322,7 +322,7 @@ struct RAMState {RAMBlock *last_req_rb;/* Queue of outstanding page requests from the destination */ QemuMutex src_page_req_mutex; - QSIMPLEQ_HEAD(src_page_requests, RAMSrcPageRequest) src_page_requests; + QSIMPLEQ_HEAD(, RAMSrcPageRequest) src_page_requests; };typedef struct RAMState RAMState ;
monitor.c +2 -2
@@ -266,11 +266,11 @@ typedef struct QMPRequest QMPRequest;/* Protects mon_list, monitor_qapi_event_state. */ static QemuMutex monitor_lock;static GHashTable *monitor_qapi_event_state; -static QTAILQ_HEAD(mon_list, Monitor) mon_list; +static QTAILQ_HEAD(, Monitor) mon_list;/* Protects mon_fdsets */ static QemuMutex mon_fdsets_lock; -static QLIST_HEAD(mon_fdsets, MonFdset) mon_fdsets; +static QLIST_HEAD(, MonFdset) mon_fdsets;static int mon_refcount;
net/queue.c +1 -1
@@ -55,7 +55,7 @@ struct NetQueue {uint32_t nq_count;NetQueueDeliverFunc *deliver; - QTAILQ_HEAD(packets, NetPacket) packets; + QTAILQ_HEAD(, NetPacket) packets; unsigned delivering : 1; };
net/slirp.c +1 -1
@@ -85,7 +85,7 @@ typedef struct SlirpState { } SlirpState;static struct slirp_config_str *slirp_configs; -static QTAILQ_HEAD(slirp_stacks, SlirpState) slirp_stacks = +static QTAILQ_HEAD(, SlirpState) slirp_stacks =QTAILQ_HEAD_INITIALIZER (slirp_stacks);static int slirp_hostfwd (SlirpState *s,const char *redir_str,Error **errp);
slirp/slirp.c +1 -1
@@ -47,7 +47,7 @@ static const uint8_t special_ethaddr[ETH_ALEN] = {u_int curtime; -static QTAILQ_HEAD(slirp_instances, Slirp) slirp_instances = +static QTAILQ_HEAD(, Slirp) slirp_instances =QTAILQ_HEAD_INITIALIZER (slirp_instances);static struct in_addr dns_addr;
target/arm/kvm.c +1 -1
@@ -206,7 +206,7 @@ typedef struct KVMDevice {int dev_fd; } KVMDevice; -static QSLIST_HEAD(kvm_devices_head, KVMDevice) kvm_devices_head; +static QSLIST_HEAD(, KVMDevice) kvm_devices_head;static void kvm_arm_devlistener_add (MemoryListener *listener,MemoryRegionSection *section)
target/i386/hax-mem.c +1 -1
@@ -56,7 +56,7 @@ typedef struct HAXMapping {* send to the kernel only the removal of the pages from the MMIO hole after * having computed locally the result of the deletion and additions. */ -static QTAILQ_HEAD(HAXMappingListHead, HAXMapping) mappings = +static QTAILQ_HEAD(, HAXMapping) mappings =QTAILQ_HEAD_INITIALIZER (mappings);/**
tcg/tcg.h +1 -1
@@ -704,7 +704,7 @@ struct TCGContext {/* These structures are private to tcg-target.inc.c. */ #ifdef TCG_TARGET_NEED_LDST_LABELS - QSIMPLEQ_HEAD(ldst_labels, TCGLabelQemuLdst) ldst_labels; + QSIMPLEQ_HEAD(, TCGLabelQemuLdst) ldst_labels;#endif #ifdef TCG_TARGET_NEED_POOL_LABELS struct TCGLabelPoolData *pool_labels;
tests/test-rcu-list.c +1 -1
@@ -108,7 +108,7 @@ static void reclaim_list_el(struct rcu_head *prcu) }#if TEST_LIST_TYPE ==1 -static QLIST_HEAD(q_list_head, list_element) Q_list_head; +static QLIST_HEAD(, list_element) Q_list_head;#define TEST_NAME "qlist"#define TEST_LIST_REMOVE_RCU QLIST_REMOVE_RCU
vl.c +1 -1
@@ -1529,7 +1529,7 @@ struct vm_change_state_entry {QLIST_ENTRY (vm_change_state_entry) entries; }; -static QLIST_HEAD(vm_change_state_head, vm_change_state_entry) vm_change_state_head; +static QLIST_HEAD(, vm_change_state_entry) vm_change_state_head;VMChangeStateEntry *qemu_add_vm_change_state_handler (VMChangeStateHandler *cb,void *opaque)
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 30/54] qemu/queue.h: reimplement QTAILQ without pointer-to-pointers
In reply to Paolo BonziniQTAILQ is a doubly linked list, with a pointer-to-pointer to the last element from the head, and the previous element from each node.
But if you squint enough, QTAILQ becomes a combination of a singly-linked forwards list, and another singly-linked list which goes backwards and is circular. This is the idea that lets QTAILQ implement reverse
iteration: only, because the backwards list points inside the node, accessing the previous element needs to go two steps back and one forwards.
What this patch does is implement it in these terms, without actually changing the in-memory layout at all. The coexistence of the two lists is realized by making QTAILQ_HEAD and QTAILQ_ENTRY unions of the forwards pointer and a generic QTailQLink node. Thq QTailQLink can walk the list in both directions; the union is needed so that the forwards pointer can have the correct type, as a sort of poor man's template. While there are other ways to get the same layout without a union, this one has the advantage of simpler operation in the debugger, because the fields tqh_first and tqe_next still exist as before the patch. Those fields are also used by scripts/qemugdb/mtree.py, so it's a good idea to preserve them.
The advantage of the new representation is that the two-back-one-forward dance done by backwards accesses can be done all while operating on QTailQLinks. No casting to the head struct is needed anymore because, even though the QTailQLink's forward pointer is a void *, we can use typeof to recover the correct type. This patch only changes the implementation, not the interface. The next patch will remove the head struct name from the backwards visit macros.
--- include/qemu/queue.h | 139 ++++++++++++++++++++------------------------- include/qemu/rcu_queue.h | 45 ++++++++------- scripts/cocci-macro-file.h | 14 ++--- 3 files changed, 92 insertions(+), 106 deletions(-)
include/qemu/queue.h +61 -78
@@ -346,23 +346,28 @@ struct { \#define QSIMPLEQ_FIRST (head) ((head)->sqh_first)#define QSIMPLEQ_NEXT (elm, field) ((elm)->field.sqe_next) +typedef struct QTailQLink { +void *tql_next; +struct QTailQLink *tql_prev; +}QTailQLink ;/* -* Tail queue definitions. +* Tail queue definitions. The union acts as a poor man template, as if +* it were QTailQLink<type>. */ #define QTAILQ_HEAD (name, type) \ -struct name { \ - type *tqh_first;/* first element */ \ -type **tqh_last;/* addr of last next element */ \ +union name { \ + struct type *tqh_first;/* first element */ \ +QTailQLink tqh_circ;/* link for circular backwards list */ \ }#define QTAILQ_HEAD_INITIALIZER (head) \ - { NULL, &(head).tqh_first } + { .tqh_circ = { NULL, &(head).tqh_circ } }#define QTAILQ_ENTRY (type) \ -struct { \ - type *tqe_next;/* next element */ \ -type **tqe_prev;/* address of previous next element */ \ +union { \ + struct type *tqe_next;/* next element */ \ +QTailQLink tqe_circ;/* link for circular backwards list */ \ }/*
@@ -370,51 +375,51 @@ struct { \*/ #define QTAILQ_INIT(head) do { \ (head)->tqh_first = NULL; \ - (head)->tqh_last = &(head)->tqh_first; \ + (head)->tqh_circ.tql_prev = &(head)->tqh_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ - (head)->tqh_first->field.tqe_prev = \ - &(elm)->field.tqe_next; \ + (head)->tqh_first->field.tqe_circ.tql_prev = \ + &(elm)->field.tqe_circ; \ else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ (head)->tqh_first = (elm); \ - (elm)->field.tqe_prev = &(head)->tqh_first; \ + (elm)->field.tqe_circ.tql_prev = &(head)->tqh_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.tqe_next = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - *(head)->tqh_last = (elm); \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (elm)->field.tqe_circ.tql_prev = (head)->tqh_circ.tql_prev; \ + (head)->tqh_circ.tql_prev->tql_next = (elm); \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ - (elm)->field.tqe_next->field.tqe_prev = \ - &(elm)->field.tqe_next; \ + (elm)->field.tqe_next->field.tqe_circ.tql_prev = \ + &(elm)->field.tqe_circ; \ else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ (listelm)->field.tqe_next = (elm); \ - (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ + (elm)->field.tqe_circ.tql_prev = &(listelm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) -#define QTAILQ_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - (elm)->field.tqe_next = (listelm); \ - *(listelm)->field.tqe_prev = (elm); \ - (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ +#define QTAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.tqe_circ.tql_prev = (listelm)->field.tqe_circ.tql_prev; \ + (elm)->field.tqe_next = (listelm); \ + (listelm)->field.tqe_circ.tql_prev->tql_next = (elm); \ + (listelm)->field.tqe_circ.tql_prev = &(elm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_REMOVE(head, elm, field) do { \ if (((elm)->field.tqe_next) != NULL) \ - (elm)->field.tqe_next->field.tqe_prev = \ - (elm)->field.tqe_prev; \ + (elm)->field.tqe_next->field.tqe_circ.tql_prev = \ + (elm)->field.tqe_circ.tql_prev; \ else \ - (head)->tqh_last = (elm)->field.tqe_prev; \ - *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ - (elm)->field.tqe_prev = NULL; \ + (head)->tqh_circ.tql_prev = (elm)->field.tqe_circ.tql_prev; \ + (elm)->field.tqe_circ.tql_prev->tql_next = (elm)->field.tqe_next; \ + (elm)->field.tqe_circ.tql_prev = NULL; \ } while (/*CONSTCOND*/0)#define QTAILQ_FOREACH (var, head, field) \
@@ -428,13 +433,13 @@ struct { \ (var) = (next_var))#define QTAILQ_FOREACH_REVERSE (var, head, headname, field) \ - for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ + for ((var) = QTAILQ_LAST(head, headname); \ (var); \ - (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) + (var) = QTAILQ_PREV(var, headname, field))#define QTAILQ_FOREACH_REVERSE_SAFE (var, head, headname, field, prev_var) \ - for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ - (var) && ((prev_var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)), 1); \ + for ((var) = QTAILQ_LAST(head, headname); \ + (var) && ((prev_var) = QTAILQ_PREV(var, headname, field)); \ (var) = (prev_var))/*
@@ -443,71 +448,49 @@ struct { \#define QTAILQ_EMPTY (head) ((head)->tqh_first == NULL)#define QTAILQ_FIRST (head) ((head)->tqh_first)#define QTAILQ_NEXT (elm, field) ((elm)->field.tqe_next) -#define QTAILQ_IN_USE (elm, field) ((elm)->field.tqe_prev != NULL) +#define QTAILQ_IN_USE (elm, field) ((elm)->field.tqe_circ.tql_prev != NULL) +#define QTAILQ_LINK_PREV (link) \ + ((link).tql_prev->tql_prev->tql_next)#define QTAILQ_LAST (head, headname) \ - (*(((struct headname *)((head)->tqh_last))->tqh_last)) + ((typeof((head)->tqh_first)) QTAILQ_LINK_PREV((head)->tqh_circ))#define QTAILQ_PREV (elm, headname, field) \ - (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) + ((typeof((elm)->field.tqe_next)) QTAILQ_LINK_PREV((elm)->field.tqe_circ))#define field_at_offset (base, offset, type) \ - ((type) (((char *) (base)) + (offset))) - -typedef struct DUMMY_Q_ENTRY DUMMY_Q_ENTRY ; -typedef struct DUMMY_Q DUMMY_Q ; - -struct DUMMY_Q_ENTRY { -QTAILQ_ENTRY (DUMMY_Q_ENTRY) next; -}; - -struct DUMMY_Q { - QTAILQ_HEAD(DUMMY_Q_HEAD, DUMMY_Q_ENTRY) head; -}; - -#define dummy_q ((DUMMY_Q *) 0) -#define dummy_qe ((DUMMY_Q_ENTRY *) 0) + ((type *) (((char *) (base)) + (offset)))/* -* Offsets of layout of a tail queue head. -*/ -#define QTAILQ_FIRST_OFFSET (offsetof(typeof(dummy_q->head), tqh_first)) -#define QTAILQ_LAST_OFFSET (offsetof(typeof(dummy_q->head), tqh_last)) -/* -* Raw access of elements of a tail queue +* Raw access of elements of a tail queue head. Offsets are all zero +* because it's a union. */ #define QTAILQ_RAW_FIRST (head) \ - (*field_at_offset(head, QTAILQ_FIRST_OFFSET, void **)) -#define QTAILQ_RAW_TQH_LAST (head) \ - (*field_at_offset(head, QTAILQ_LAST_OFFSET, void ***)) - -/* -* Offsets of layout of a tail queue element. -*/ -#define QTAILQ_NEXT_OFFSET (offsetof(typeof(dummy_qe->next), tqe_next)) -#define QTAILQ_PREV_OFFSET (offsetof(typeof(dummy_qe->next), tqe_prev)) + field_at_offset(head, 0, void *) +#define QTAILQ_RAW_TQH_CIRC (head) \ + field_at_offset(head, 0, QTailQLink)/* * Raw access of elements of a tail entry */ #define QTAILQ_RAW_NEXT (elm, entry) \ - (*field_at_offset(elm, entry + QTAILQ_NEXT_OFFSET, void **)) -#define QTAILQ_RAW_TQE_PREV (elm, entry) \ - (*field_at_offset(elm, entry + QTAILQ_PREV_OFFSET, void ***)) + field_at_offset(elm, entry, void *) +#define QTAILQ_RAW_TQE_CIRC (elm, entry) \ + field_at_offset(elm, entry, QTailQLink)/* -* Tail queue tranversal using pointer arithmetic. +* Tail queue traversal using pointer arithmetic. */ #define QTAILQ_RAW_FOREACH (elm, head, entry) \ - for ((elm) = QTAILQ_RAW_FIRST(head); \ + for ((elm) = *QTAILQ_RAW_FIRST(head); \ (elm); \ - (elm) = QTAILQ_RAW_NEXT(elm, entry)) + (elm) = *QTAILQ_RAW_NEXT(elm, entry))/* * Tail queue insertion using pointer arithmetic. */ -#define QTAILQ_RAW_INSERT_TAIL(head, elm, entry) do { \ - QTAILQ_RAW_NEXT(elm, entry) = NULL; \ - QTAILQ_RAW_TQE_PREV(elm, entry) = QTAILQ_RAW_TQH_LAST(head); \ - *QTAILQ_RAW_TQH_LAST(head) = (elm); \ - QTAILQ_RAW_TQH_LAST(head) = &QTAILQ_RAW_NEXT(elm, entry); \ +#define QTAILQ_RAW_INSERT_TAIL(head, elm, entry) do { \ + *QTAILQ_RAW_NEXT(elm, entry) = NULL; \ + QTAILQ_RAW_TQE_CIRC(elm, entry)->tql_prev = QTAILQ_RAW_TQH_CIRC(head)->tql_prev; \ + QTAILQ_RAW_TQH_CIRC(head)->tql_prev->tql_next = (elm); \ + QTAILQ_RAW_TQH_CIRC(head)->tql_prev = QTAILQ_RAW_TQE_CIRC(elm, entry); \ } while (/*CONSTCOND*/0)#endif /* QEMU_SYS_QUEUE_H */
include/qemu/rcu_queue.h +24 -21
71 lines not on this page · raw message
scripts/cocci-macro-file.h +7 -7
@@ -94,18 +94,18 @@ struct { \* Tail queue definitions. */ #define QTAILQ_HEAD (name, type) \ -struct name { \ - type *tqh_first;/* first element */ \ -type **tqh_last;/* addr of last next element */ \ +union name { \ + struct type *tqh_first;/* first element */ \ +QTailQLink tqh_circ;/* link for last element */ \ }#define QTAILQ_HEAD_INITIALIZER (head) \ - { NULL, &(head).tqh_first } + { .tqh_circ = { NULL, &(head).tqh_circ } }#define QTAILQ_ENTRY (type) \ -struct { \ - type *tqe_next;/* next element */ \ -type **tqe_prev;/* address of previous next element */ \ +union { \ + struct type *tqe_next;/* next element */ \ +QTailQLink tqe_circ;/* link for prev element */ \ }/* From glib */
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 31/54] qemu/queue.h: simplify reverse access to QTAILQ
In reply to Paolo BonziniThe new definition of QTAILQ does not require passing the headname, remove it.
--- cpus-common.c | 2 +- dump.c | 2 +- hw/core/qdev.c | 4 ++-- hw/scsi/scsi-bus.c | 2 +- hw/usb/combined-packet.c | 2 +- hw/usb/dev-mtp.c | 4 ++-- hw/usb/hcd-ehci.c | 2 +- hw/usb/hcd-ehci.h | 2 +- hw/usb/hcd-uhci.c | 4 ++-- include/exec/memory.h | 2 +- include/hw/qdev-core.h | 2 +- include/hw/usb.h | 2 +- include/net/net.h | 2 +- include/qemu/option_int.h | 2 +- include/qemu/queue.h | 16 ++++++++-------- include/sysemu/memory_mapping.h | 2 +- memory.c | 17 ++++++----------- memory_mapping.c | 2 +- net/filter.c | 2 +- net/net.c | 2 +- qga/commands-posix.c | 2 +- tcg/tcg.c | 2 +- tcg/tcg.h | 4 ++-- tests/libqos/malloc.c | 2 +- tests/test-vmstate.c | 8 ++++---- ui/console.c | 4 ++-- util/qemu-option.c | 4 ++-- 27 files changed, 48 insertions(+), 53 deletions(-)
cpus-common.c +1 -1
@@ -99,7 +99,7 @@ void cpu_list_remove(CPUState *cpu)return ; } -assert (!(cpu_index_auto_assigned && cpu !=QTAILQ_LAST (&cpus, CPUTailQ))); +assert (!(cpu_index_auto_assigned && cpu !=QTAILQ_LAST (&cpus)));QTAILQ_REMOVE_RCU (&cpus, cpu, node); cpu->cpu_index =UNASSIGNED_CPU_INDEX ;
dump.c +1 -1
@@ -1557,7 +1557,7 @@ static void get_max_mapnr(DumpState *s) {GuestPhysBlock *last_block; - last_block =QTAILQ_LAST (&s->guest_phys_blocks.head, GuestPhysBlockHead); + last_block =QTAILQ_LAST (&s->guest_phys_blocks.head); s->max_mapnr =dump_paddr_to_pfn (s, last_block->target_end); }
hw/core/qdev.c +2 -2
@@ -158,7 +158,7 @@ DeviceState *qdev_try_create(BusState *bus, const char *type)return dev; } -static QTAILQ_HEAD(device_listeners, DeviceListener) device_listeners +static QTAILQ_HEAD(, DeviceListener) device_listeners =QTAILQ_HEAD_INITIALIZER (device_listeners);enum ListenerDirection { Forward, Reverse };
@@ -177,7 +177,7 @@ enum ListenerDirection { Forward, Reverse };break ; \case Reverse: \QTAILQ_FOREACH_REVERSE (_listener, &device_listeners, \ - device_listeners, link) { \ + link) { \if (_listener->_callback) { \ _listener->_callback(_listener, ##_args); \ } \
hw/scsi/scsi-bus.c +1 -1
@@ -1554,7 +1554,7 @@ SCSIDevice *scsi_device_find(SCSIBus *bus, int channel, int id, int lun)BusChild *kid;SCSIDevice *target_dev =NULL ; - QTAILQ_FOREACH_REVERSE(kid, &bus->qbus.children, ChildrenHead, sibling) { + QTAILQ_FOREACH_REVERSE(kid, &bus->qbus.children, sibling) {DeviceState *qdev = kid->child;SCSIDevice *dev =SCSI_DEVICE (qdev);
hw/usb/combined-packet.c +1 -1
@@ -64,7 +64,7 @@ void usb_combined_input_packet_complete(USBDevice *dev, USBPacket *p) status = combined->first->status; actual_length = combined->first->actual_length; - short_not_ok =QTAILQ_LAST (&combined->packets, packets_head)->short_not_ok; + short_not_ok =QTAILQ_LAST (&combined->packets)->short_not_ok; QTAILQ_FOREACH_SAFE(p, &combined->packets, combined_entry, next) {if (!done) {
hw/usb/dev-mtp.c +2 -2
@@ -191,7 +191,7 @@ struct MTPState {#ifdef CONFIG_INOTIFY1 /* inotify descriptor */ int inotifyfd; - QTAILQ_HEAD(events, MTPMonEntry) events; + QTAILQ_HEAD(, MTPMonEntry) events;#endif /* Responder is expecting a write operation */ bool write_pending;
@@ -1982,7 +1982,7 @@ static void usb_mtp_handle_data(USBDevice *dev, USBPacket *p)case EP_EVENT :#ifdef CONFIG_INOTIFY1 if (!QTAILQ_EMPTY (&s->events)) { -struct MTPMonEntry *e =QTAILQ_LAST (&s->events, events); +struct MTPMonEntry *e =QTAILQ_LAST (&s->events);uint32_t handle;int len =sizeof (container) +sizeof (uint32_t );
hw/usb/hcd-ehci.c +1 -1
@@ -1815,7 +1815,7 @@ static int ehci_state_fetchqtd(EHCIQueue *q)break ;case EHCI_ASYNC_INFLIGHT :/* Check if the guest has added new tds to the queue */ - again =ehci_fill_queue (QTAILQ_LAST (&q->packets, pkts_head)); + again =ehci_fill_queue (QTAILQ_LAST (&q->packets));/* Unfinished async handled packet, go horizontal */ ehci_set_state (q->ehci, q->async,EST_HORIZONTALQH );break ;
hw/usb/hcd-ehci.h +1 -1
@@ -247,7 +247,7 @@ struct EHCIQueue {uint32_t qtdaddr;/* address QTD read from */ int last_pid;/* pid of last packet executed */ USBDevice *dev; - QTAILQ_HEAD(pkts_head, EHCIPacket) packets; + QTAILQ_HEAD(, EHCIPacket) packets; }; typedef QTAILQ_HEAD(EHCIQueueHead, EHCIQueue) EHCIQueueHead;
hw/usb/hcd-uhci.c +2 -2
@@ -99,7 +99,7 @@ struct UHCIQueue {UHCIState *uhci;USBEndpoint *ep;QTAILQ_ENTRY (UHCIQueue) next; - QTAILQ_HEAD(asyncs_head, UHCIAsync) asyncs; + QTAILQ_HEAD(, UHCIAsync) asyncs;int8_t valid; };
@@ -837,7 +837,7 @@ static int uhci_handle_td(UHCIState *s, UHCIQueue *q, uint32_t qh_addr, }if (!async->done) {UHCI_TD last_td; -UHCIAsync *last =QTAILQ_LAST (&async->queue->asyncs, asyncs_head); +UHCIAsync *last =QTAILQ_LAST (&async->queue->asyncs);/* * While we are waiting for the current td to complete, the guest * may have added more tds to the queue. Note we re-read the td
include/exec/memory.h +1 -1
@@ -445,7 +445,7 @@ struct AddressSpace {int ioeventfd_nb;struct MemoryRegionIoeventfd *ioeventfds; - QTAILQ_HEAD(memory_listeners_as, MemoryListener) listeners; + QTAILQ_HEAD(, MemoryListener) listeners;QTAILQ_ENTRY (AddressSpace) address_spaces_link; };
include/hw/qdev-core.h +1 -1
@@ -206,7 +206,7 @@ struct BusState {HotplugHandler *hotplug_handler;int max_index;bool realized; - QTAILQ_HEAD(ChildrenHead, BusChild) children; + QTAILQ_HEAD(, BusChild) children;QLIST_ENTRY (BusState) sibling; };
include/hw/usb.h +1 -1
@@ -408,7 +408,7 @@ struct USBPacket {struct USBCombinedPacket {USBPacket *first; - QTAILQ_HEAD(packets_head, USBPacket) packets; + QTAILQ_HEAD(, USBPacket) packets;QEMUIOVector iov; };
include/net/net.h +1 -1
@@ -97,7 +97,7 @@ struct NetClientState { unsigned rxfilter_notify_enabled:1;int vring_enable;int vnet_hdr_len; - QTAILQ_HEAD(NetFilterHead, NetFilterState) filters; + QTAILQ_HEAD(, NetFilterState) filters; }; typedef struct NICState {
include/qemu/option_int.h +1 -1
@@ -47,7 +47,7 @@ struct QemuOpts {char *id;QemuOptsList *list;Location loc; - QTAILQ_HEAD(QemuOptHead, QemuOpt) head; + QTAILQ_HEAD(, QemuOpt) head;QTAILQ_ENTRY (QemuOpts) next; };
include/qemu/queue.h +8 -8
@@ -432,14 +432,14 @@ union { \ (var) && ((next_var) = ((var)->field.tqe_next),1 ); \ (var) = (next_var)) -#define QTAILQ_FOREACH_REVERSE (var, head, headname, field) \ - for ((var) = QTAILQ_LAST(head, headname); \ +#define QTAILQ_FOREACH_REVERSE (var, head, field) \ + for ((var) = QTAILQ_LAST(head); \ (var); \ - (var) = QTAILQ_PREV(var, headname, field)) + (var) = QTAILQ_PREV(var, field)) -#define QTAILQ_FOREACH_REVERSE_SAFE (var, head, headname, field, prev_var) \ - for ((var) = QTAILQ_LAST(head, headname); \ - (var) && ((prev_var) = QTAILQ_PREV(var, headname, field)); \ +#define QTAILQ_FOREACH_REVERSE_SAFE (var, head, field, prev_var) \ + for ((var) = QTAILQ_LAST(head); \ + (var) && ((prev_var) = QTAILQ_PREV(var, field)); \ (var) = (prev_var))/*
@@ -452,9 +452,9 @@ union { \#define QTAILQ_LINK_PREV (link) \ ((link).tql_prev->tql_prev->tql_next) -#define QTAILQ_LAST (head, headname) \ +#define QTAILQ_LAST (head) \ ((typeof((head)->tqh_first)) QTAILQ_LINK_PREV((head)->tqh_circ)) -#define QTAILQ_PREV (elm, headname, field) \ +#define QTAILQ_PREV (elm, field) \ ((typeof((elm)->field.tqe_next)) QTAILQ_LINK_PREV((elm)->field.tqe_circ))#define field_at_offset (base, offset, type) \
include/sysemu/memory_mapping.h +1 -1
@@ -36,7 +36,7 @@ typedef struct GuestPhysBlock {/* point-in-time snapshot of guest-visible physical mappings */ typedef struct GuestPhysBlockList {unsigned num; - QTAILQ_HEAD(GuestPhysBlockHead, GuestPhysBlock) head; + QTAILQ_HEAD(, GuestPhysBlock) head; }GuestPhysBlockList ;/* The physical and virtual address in the memory mapping are contiguous. */
memory.c +6 -11
@@ -39,7 +39,7 @@ static bool memory_region_update_pending;static bool ioeventfd_update_pending;static bool global_dirty_log = false; -static QTAILQ_HEAD(memory_listeners, MemoryListener) memory_listeners +static QTAILQ_HEAD(, MemoryListener) memory_listeners =QTAILQ_HEAD_INITIALIZER (memory_listeners); static QTAILQ_HEAD(, AddressSpace) address_spaces
@@ -113,8 +113,7 @@ enum ListenerDirection { Forward, Reverse }; } \break ; \case Reverse: \ -QTAILQ_FOREACH_REVERSE (_listener, &memory_listeners, \ - memory_listeners, link) { \ + QTAILQ_FOREACH_REVERSE(_listener, &memory_listeners, link) { \if (_listener->_callback) { \ _listener->_callback(_listener, ##_args); \ } \
@@ -128,19 +127,17 @@ enum ListenerDirection { Forward, Reverse }; #define MEMORY_LISTENER_CALL(_as, _callback, _direction, _section, _args...) \ do { \ MemoryListener *_listener; \ - struct memory_listeners_as *list = &(_as)->listeners; \ \ switch (_direction) { \ case Forward: \ - QTAILQ_FOREACH(_listener, list, link_as) { \ + QTAILQ_FOREACH(_listener, &(_as)->listeners, link_as) { \ if (_listener->_callback) { \ _listener->_callback(_listener, _section, ##_args); \ } \ } \ break; \ case Reverse: \ - QTAILQ_FOREACH_REVERSE(_listener, list, memory_listeners_as, \ - link_as) { \ + QTAILQ_FOREACH_REVERSE(_listener, &(_as)->listeners, link_as) { \ if (_listener->_callback) { \ _listener->_callback(_listener, _section, ##_args); \ } \
@@ -2691,8 +2688,7 @@ void memory_listener_register(MemoryListener *listener, AddressSpace *as) listener->address_space = as;if (QTAILQ_EMPTY (&memory_listeners) - || listener->priority >=QTAILQ_LAST (&memory_listeners, - memory_listeners)->priority) { + || listener->priority >=QTAILQ_LAST (&memory_listeners)->priority) {QTAILQ_INSERT_TAIL (&memory_listeners, listener, link); }else { QTAILQ_FOREACH(other, &memory_listeners, link) {
@@ -2704,8 +2700,7 @@ void memory_listener_register(MemoryListener *listener, AddressSpace *as) }if (QTAILQ_EMPTY (&as->listeners) - || listener->priority >=QTAILQ_LAST (&as->listeners, - memory_listeners)->priority) { + || listener->priority >=QTAILQ_LAST (&as->listeners)->priority) {QTAILQ_INSERT_TAIL (&as->listeners, listener, link_as); }else { QTAILQ_FOREACH(other, &as->listeners, link_as) {
memory_mapping.c +1 -1
@@ -223,7 +223,7 @@ static void guest_phys_blocks_region_add(MemoryListener *listener,if (!QTAILQ_EMPTY (&g->list->head)) {hwaddr predecessor_size; - predecessor =QTAILQ_LAST (&g->list->head, GuestPhysBlockHead); + predecessor =QTAILQ_LAST (&g->list->head); predecessor_size = predecessor->target_end - predecessor->target_start;/* the memory API guarantees monotonically increasing traversal */
net/filter.c +1 -1
@@ -55,7 +55,7 @@ static NetFilterState *netfilter_next(NetFilterState *nf, next =QTAILQ_NEXT (nf, next); }else {/* reverse order */ - next =QTAILQ_PREV (nf, NetFilterHead, next); + next =QTAILQ_PREV (nf, next); }return next;
net/net.c +1 -1
@@ -563,7 +563,7 @@ static ssize_t filter_receive_iov(NetClientState *nc, } } }else { - QTAILQ_FOREACH_REVERSE(nf, &nc->filters, NetFilterHead, next) { + QTAILQ_FOREACH_REVERSE(nf, &nc->filters, next) { ret =qemu_netfilter_receive (nf, direction, sender, flags, iov, iovcnt, sent_cb);if (ret) {
qga/commands-posix.c +1 -1
@@ -1291,7 +1291,7 @@ int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints,/* cannot risk guest agent blocking itself on a write in this state */ ga_set_frozen (ga_state); - QTAILQ_FOREACH_REVERSE(mount, &mounts, FsMountList, next) { + QTAILQ_FOREACH_REVERSE(mount, &mounts, next) {/* To issue fsfreeze in the reverse order of mounts, check if the * mount is listed in the list here */ if (has_mountpoints) {
tcg/tcg.c +1 -1
@@ -2269,7 +2269,7 @@ static void liveness_pass_1(TCGContext *s)tcg_la_func_end (s); - QTAILQ_FOREACH_REVERSE_SAFE(op, &s->ops, TCGOpHead, link, op_prev) { + QTAILQ_FOREACH_REVERSE_SAFE(op, &s->ops, link, op_prev) {int i, nb_iargs, nb_oargs;TCGOpcode opc_new, opc_new2;bool have_opc_new2;
tcg/tcg.h +2 -2
@@ -715,7 +715,7 @@ struct TCGContext {TCGTempSet free_temps[TCG_TYPE_COUNT *2 ];TCGTemp temps[TCG_MAX_TEMPS ];/* globals first, temps after */ - QTAILQ_HEAD(TCGOpHead, TCGOp) ops, free_ops; + QTAILQ_HEAD(, TCGOp) ops, free_ops;/* Tells which temporary holds a given register. It does not take into account fixed registers */
@@ -843,7 +843,7 @@ static inline void tcg_set_insn_start_param(TCGOp *op, int arg, target_ulong v)/* The last op that was emitted. */ static inline TCGOp *tcg_last_op (void ) { -return QTAILQ_LAST (&tcg_ctx->ops, TCGOpHead); +return QTAILQ_LAST (&tcg_ctx->ops); }/* Test for whether to terminate the TB for using too many opcodes. */
tests/libqos/malloc.c +1 -1
@@ -104,7 +104,7 @@ static void mlist_coalesce(MemList *head, MemBlock *node) do { merge = 0; - left = QTAILQ_PREV(node, MemList, MLIST_ENTNAME); + left = QTAILQ_PREV(node, MLIST_ENTNAME); right = QTAILQ_NEXT(node, MLIST_ENTNAME); /* clowns to the left of me */
tests/test-vmstate.c +4 -4
@@ -630,7 +630,7 @@ struct TestQtailqElement {typedef struct TestQtailq {int16_t i16; - QTAILQ_HEAD(TestQtailqHead, TestQtailqElement) q; + QTAILQ_HEAD(, TestQtailqElement) q;int32_t i32; }TestQtailq ;
@@ -735,9 +735,9 @@ static void test_load_q(void) g_assert_cmpint(eof, ==, QEMU_VM_EOF);TestQtailqElement *qele_from =QTAILQ_FIRST (&obj_q.q); -TestQtailqElement *qlast_from =QTAILQ_LAST (&obj_q.q, TestQtailqHead); +TestQtailqElement *qlast_from =QTAILQ_LAST (&obj_q.q);TestQtailqElement *qele_to =QTAILQ_FIRST (&tgt.q); -TestQtailqElement *qlast_to =QTAILQ_LAST (&tgt.q, TestQtailqHead); +TestQtailqElement *qlast_to =QTAILQ_LAST (&tgt.q);while (1 ) { g_assert_cmpint(qele_to->b, ==, qele_from->b);
@@ -755,7 +755,7 @@ static void test_load_q(void)/* clean up */ TestQtailqElement *qele;while (!QTAILQ_EMPTY (&tgt.q)) { - qele =QTAILQ_LAST (&tgt.q, TestQtailqHead); + qele =QTAILQ_LAST (&tgt.q);QTAILQ_REMOVE (&tgt.q, qele, next);free (qele); qele =NULL ;
ui/console.c +2 -2
@@ -182,7 +182,7 @@ struct DisplayState {static DisplayState *display_state;static QemuConsole *active_console; -static QTAILQ_HEAD(consoles_head, QemuConsole) consoles = +static QTAILQ_HEAD(, QemuConsole) consoles =QTAILQ_HEAD_INITIALIZER (consoles);static bool cursor_visible_phase;static QEMUTimer *cursor_timer;
@@ -1303,7 +1303,7 @@ static QemuConsole *new_console(DisplayState *ds, console_type_t console_type, s->index =0 ;QTAILQ_INSERT_TAIL (&consoles, s, next); }else if (console_type !=GRAPHIC_CONSOLE || qdev_hotplug) { -QemuConsole *last =QTAILQ_LAST (&consoles, consoles_head); +QemuConsole *last =QTAILQ_LAST (&consoles); s->index = last->index +1 ;QTAILQ_INSERT_TAIL (&consoles, s, next); }else {
util/qemu-option.c +2 -2
@@ -280,7 +280,7 @@ QemuOpt *qemu_opt_find(QemuOpts *opts, const char *name) {QemuOpt *opt; - QTAILQ_FOREACH_REVERSE(opt, &opts->head, QemuOptHead, next) { + QTAILQ_FOREACH_REVERSE(opt, &opts->head, next) {if (strcmp (opt->name, name) !=0 )continue ;return opt;
@@ -379,7 +379,7 @@ bool qemu_opt_has_help_opt(QemuOpts *opts) {QemuOpt *opt; - QTAILQ_FOREACH_REVERSE(opt, &opts->head, QemuOptHead, next) { + QTAILQ_FOREACH_REVERSE(opt, &opts->head, next) {if (is_help_option (opt->name)) {return true; }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 37/54] audio/alsaaudio: Remove compiler check around pragma
In reply to Paolo BonziniFrom: Thomas Huth <[email protected]>
Both GCC v4.8 and Clang v3.4 support the -Waddress option, so we do not need the compiler version check here anymore.
Message-Id: <[email protected]>
--- audio/alsaaudio.c | 2 -- 1 file changed, 2 deletions(-)
audio/alsaaudio.c +0 -2
@@ -28,9 +28,7 @@#include "audio.h" #include "trace.h" -#if QEMU_GNUC_PREREQ (4 ,3 )#pragma GCC diagnostic ignored "-Waddress" -#endif #define AUDIO_CAP "alsa"#include "audio_int.h"
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 38/54] includes: Replace QEMU_GNUC_PREREQ with "__has_builtin || !defined(__clang__)"
In reply to Paolo BonziniFrom: Thomas Huth <[email protected]>
Since we require GCC version 4.8 or newer now, we can be sure that the builtin functions are always available on GCC. And for Clang, we can check the availablility with __has_builtin instead.
Message-Id: <[email protected]>
--- include/qemu/compiler.h | 2 +- include/qemu/host-utils.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
include/qemu/compiler.h +1 -1
@@ -135,7 +135,7 @@#define __has_builtin (x) 0/* compatibility with non-clang compilers */ #endif -#if __has_builtin (__builtin_assume_aligned) ||QEMU_GNUC_PREREQ (4 ,7 ) +#if __has_builtin (__builtin_assume_aligned) || !defined(__clang__)#define HAS_ASSUME_ALIGNED #endif
include/qemu/host-utils.h +2 -2
@@ -207,7 +207,7 @@ static inline int cto64(uint64_t val)*/ static inline int clrsb32 (uint32_t val) { -#if QEMU_GNUC_PREREQ (4 ,7 ) +#if __has_builtin (__builtin_clrsb) || !defined(__clang__)return __builtin_clrsb (val);#else return clz32 (val ^ ((int32_t )val >>1 )) -1 ;
@@ -223,7 +223,7 @@ static inline int clrsb32(uint32_t val)*/ static inline int clrsb64 (uint64_t val) { -#if QEMU_GNUC_PREREQ (4 ,7 ) +#if __has_builtin (__builtin_clrsbll) || !defined(__clang__)return __builtin_clrsbll (val);#else return clz64 (val ^ ((int64_t )val >>1 )) -1 ;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 40/54] hw/watchdog/wdt_i6300esb : remove a unnecessary comment
In reply to Paolo BonziniFrom: Peng Hao <[email protected]>
The registered memory region of i6300esb is not suitable for coalesced mmio, because a write for the region may trigger an immediate action and can't be delayed.
Message-Id: <[email protected]>
--- hw/watchdog/wdt_i6300esb.c | 1 - 1 file changed, 1 deletion(-)
hw/watchdog/wdt_i6300esb.c +0 -1
@@ -449,7 +449,6 @@ static void i6300esb_realize(PCIDevice *dev, Error **errp)memory_region_init_io (&d->io_mem,OBJECT (d), &i6300esb_ops, d,"i6300esb" ,0x10 );pci_register_bar (&d->dev,0 ,0 , &d->io_mem); -/* qemu_register_coalesced_mmio (addr, 0x10); ? */ }static void i6300esb_exit (PCIDevice *dev)
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 46/54] vhost-user-test: use g_cond_broadcast
In reply to Paolo Bonzinig_cond_signal is rarely the right thing to do, it works now because vhost-user-test only has two threads but it is not correct in general. Fix it before adding more calls.
Message-Id: <[email protected]>
--- tests/vhost-user-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/vhost-user-test.c +2 -2
@@ -393,7 +393,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) G_N_ELEMENTS(s->fds));/* signal the test that it can continue */ -g_cond_signal (&s->data_cond); +g_cond_broadcast (&s->data_cond);break ;case VHOST_USER_SET_VRING_KICK :
@@ -419,7 +419,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) p = (uint8_t *) &msg;qemu_chr_fe_write_all (chr, p,VHOST_USER_HDR_SIZE ); -g_cond_signal (&s->data_cond); +g_cond_broadcast (&s->data_cond);break ;case VHOST_USER_SET_VRING_BASE :
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 39/54] Remove QEMU_ARTIFICIAL macro
In reply to Paolo BonziniFrom: Thomas Huth <[email protected]>
The code that used it has already been removed a while ago with commit dc41aa7d34989b552ef ("tcg: Remove GET_TCGV_* and MAKE_TCGV_*").
Message-Id: <[email protected]>
--- include/qemu/compiler.h | 6 ------ scripts/checkpatch.pl | 1 - scripts/cocci-macro-file.h | 1 - 3 files changed, 8 deletions(-)
include/qemu/compiler.h +0 -6
@@ -36,12 +36,6 @@#define QEMU_SENTINEL __attribute__((sentinel)) -#if QEMU_GNUC_PREREQ (4 ,3 ) -#define QEMU_ARTIFICIAL __attribute__((always_inline, artificial)) -#else -#define QEMU_ARTIFICIAL -#endif -#if defined(_WIN32)# define QEMU_PACKED __attribute__((gcc_struct, packed))#else
scripts/checkpatch.pl +0 -1
@@ -226,7 +226,6 @@ our $Attribute = qr{ QEMU_NORETURN| QEMU_WARN_UNUSED_RESULT| QEMU_SENTINEL| - QEMU_ARTIFICIAL| QEMU_PACKED| GCC_FMT_ATTR }x;
scripts/cocci-macro-file.h +0 -1
@@ -23,7 +23,6 @@#define QEMU_NORETURN __attribute__ ((__noreturn__))#define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result))#define QEMU_SENTINEL __attribute__((sentinel)) -#define QEMU_ARTIFICIAL __attribute__((always_inline, artificial))#define QEMU_PACKED __attribute__((gcc_struct, packed))#define cat (x,y) x ## y
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 41/54] vhost-net: move stubs to a separate file
In reply to Paolo BonziniThere is no reason for CONFIG_VHOST_NET to be specific to a single target; it is a host feature that can be add to all targets, as long as they support the virtio-net device. Currently CONFIG_VHOST_NET depends on CONFIG_KVM, but ioeventfd support is present in the core memory API and works with other accelerators as well.
As a first step, move the vhost-net stubs to a separate file. Later, they will become conditional on CONFIG_VIRTIO_NET, which is not available in .c files.
Message-Id: <[email protected]>
--- hw/net/Makefile.objs | 4 ++- hw/net/vhost_net-stub.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/net/vhost_net.c | 74 --------------------------------------- 3 files changed, 95 insertions(+), 75 deletions(-) create mode 100644 hw/net/vhost_net-stub.c
hw/net/Makefile.objs +3 -1
@@ -37,7 +37,9 @@ obj-$(CONFIG_PSERIES) += spapr_llan.o obj-$(CONFIG_XILINX_ETHLITE) += xilinx_ethlite.o obj-$(CONFIG_VIRTIO_NET) += virtio-net.o -obj-y += vhost_net.o +obj-$(CONFIG_VHOST_NET) += vhost_net.o +common-obj-$(call lnot,$(CONFIG_VHOST_NET)) += vhost_net-stub.o +common-obj-$(CONFIG_ALL) += vhost_net-stub.o obj-$(CONFIG_ETSEC) += fsl_etsec/etsec.o fsl_etsec/registers.o \ fsl_etsec/rings.o fsl_etsec/miim.o
hw/net/vhost_net-stub.c new file +92 -0
92 lines not on this page · raw message
hw/net/vhost_net.c +0 -74
83 lines not on this page · raw message
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 42/54] vhost-net-user: add stubs for when no virtio-net device is present
In reply to Paolo Bonzinihw/net/vhost_net.c needs functions that are declared in net/vhost-user.c: the vhost-user code is always compiled into QEMU, only the constructor net_init_vhost_user is unreachable. Also, net/vhost-user.c needs functions declared in hw/virtio/vhost-stub.c even if no virtio device exists.
Break this dependency. First, add a minimal version of net/vhost-user.c, with no functionality and no dependency on vhost code. Second, #ifdef out the calls back to net/vhost-user.c from hw/net/vhost_net.c.
While at it, this patch fixes the CONFIG_VHOST_NET_USE*D* typo.
Message-Id: <[email protected]>
--- configure | 2 +- hw/net/vhost_net.c | 4 ++++ net/Makefile.objs | 4 +++- net/net.c | 2 +- net/vhost-user-stub.c | 23 +++++++++++++++++++++++ 5 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 net/vhost-user-stub.c
configure +1 -1
@@ -6515,7 +6515,7 @@ if test "$vhost_scsi" = "yes" ; then echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak fi if test "$vhost_net" = "yes" -a "$vhost_user" = "yes"; then - echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak + echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak fi if test "$vhost_crypto" = "yes" ; then echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak
hw/net/vhost_net.c +4 -0
@@ -193,6 +193,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) }/* Set sane init value. Override when guest acks. */ +#ifdef CONFIG_VHOST_NET_USER if (net->nc->info->type ==NET_CLIENT_DRIVER_VHOST_USER ) { features =vhost_user_get_acked_features (net->nc);if (~net->dev.features & features) {
@@ -202,6 +203,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) goto fail; } } +#endif vhost_net_ack_features (net, features);
@@ -413,10 +415,12 @@ VHostNetState *get_vhost_net(NetClientState *nc)case NET_CLIENT_DRIVER_TAP : vhost_net =tap_get_vhost_net (nc);break ; +#ifdef CONFIG_VHOST_NET_USER case NET_CLIENT_DRIVER_VHOST_USER : vhost_net =vhost_user_get_vhost_net (nc);assert (vhost_net);break ; +#endif default :break ; }
net/Makefile.objs +3 -1
@@ -3,7 +3,9 @@ common-obj-y += socket.o common-obj-y += dump.o common-obj-y += eth.o common-obj-$(CONFIG_L2TPV3) += l2tpv3.o -common-obj-$(CONFIG_POSIX) += vhost-user.o +common-obj-$(call land,$(CONFIG_VIRTIO_NET),$(CONFIG_VHOST_NET_USER)) += vhost-user.o +common-obj-$(call land,$(call lnot,$(CONFIG_VIRTIO_NET)),$(CONFIG_VHOST_NET_USER)) += vhost-user-stub.o +common-obj-$(CONFIG_ALL) += vhost-user-stub.o common-obj-$(CONFIG_SLIRP) += slirp.o common-obj-$(CONFIG_VDE) += vde.o common-obj-$(CONFIG_NETMAP) += netmap.o
net/net.c +1 -1
@@ -961,7 +961,7 @@ static int (* const net_client_init_fun[NET_CLIENT_DRIVER__MAX])( [NET_CLIENT_DRIVER_BRIDGE] = net_init_bridge, #endif [NET_CLIENT_DRIVER_HUBPORT ] = net_init_hubport, -#ifdef CONFIG_VHOST_NET_USED +#ifdef CONFIG_VHOST_NET_USER [NET_CLIENT_DRIVER_VHOST_USER ] = net_init_vhost_user, #endif #ifdef CONFIG_L2TPV3
net/vhost-user-stub.c new file +23 -0
@@ -0,0 +1,23 @@ +/* +* vhost-user-stub.c +* +* Copyright (c) 2018 Red Hat, Inc. +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +* +*/ + +#include "qemu/osdep.h" +#include "clients.h" +#include "net/vhost_net.h" +#include "net/vhost-user.h" +#include "qemu/error-report.h" +#include "qapi/error.h" + +int net_init_vhost_user (const Netdev *netdev,const char *name, +NetClientState *peer,Error **errp) +{ +error_setg (errp,"vhost-user requires frontend driver virtio-net-*" ); +return -1 ; +}
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 43/54] vhost: restrict Linux dependency to kernel vhost
In reply to Paolo Bonzinivhost-user does not depend on Linux; it can run on any POSIX system. Restrict vhost-kernel to Linux in hw/virtio/vhost-backend.c, everything else can be compiled on all POSIX systems.
Message-Id: <[email protected]>
--- backends/Makefile.objs | 5 ++--- default-configs/virtio.mak | 4 ++-- hw/virtio/Makefile.objs | 5 +++-- hw/virtio/vhost-backend.c | 11 +++++++++-- 4 files changed, 16 insertions(+), 9 deletions(-)
backends/Makefile.objs +2 -3
@@ -9,10 +9,9 @@ common-obj-$(CONFIG_POSIX) += hostmem-file.o common-obj-y += cryptodev.o common-obj-y += cryptodev-builtin.o -ifeq ($(CONFIG_VIRTIO),y) +ifeq ($(CONFIG_VIRTIO_CRYPTO),y) common-obj-y += cryptodev-vhost.o -common-obj-$(call land,$(CONFIG_VHOST_USER),$(CONFIG_LINUX)) += \ - cryptodev-vhost-user.o +common-obj-$(CONFIG_VHOST_CRYPTO) += cryptodev-vhost-user.o endif common-obj-$(CONFIG_LINUX) += hostmem-memfd.o
default-configs/virtio.mak +2 -2
@@ -1,5 +1,5 @@ -CONFIG_VHOST_USER_SCSI=$(call land,$(CONFIG_VHOST_USER),$(CONFIG_LINUX)) -CONFIG_VHOST_USER_BLK=$(call land,$(CONFIG_VHOST_USER),$(CONFIG_LINUX)) +CONFIG_VHOST_USER_SCSI=$(CONFIG_VHOST_USER) +CONFIG_VHOST_USER_BLK=$(CONFIG_VHOST_USER) CONFIG_VIRTIO=y CONFIG_VIRTIO_9P=y CONFIG_VIRTIO_BALLOON=y
hw/virtio/Makefile.objs +3 -2
@@ -9,9 +9,10 @@ obj-$(CONFIG_VIRTIO_BALLOON) += virtio-balloon.o obj-$(CONFIG_VIRTIO_CRYPTO) += virtio-crypto.o obj-$(call land,$(CONFIG_VIRTIO_CRYPTO),$(CONFIG_VIRTIO_PCI)) += virtio-crypto-pci.o -obj-$(CONFIG_LINUX) += vhost.o vhost-backend.o vhost-user.o +obj-$(CONFIG_VHOST_USER) += vhost-user.o obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o +obj-$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_LINUX)) += vhost.o vhost-backend.o +common-obj-$(call lnot,$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_LINUX))) += vhost-stub.o endif -common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO),$(CONFIG_LINUX))) += vhost-stub.o common-obj-$(CONFIG_ALL) += vhost-stub.o
hw/virtio/vhost-backend.c +9 -2
@@ -9,12 +9,14 @@*/ #include "qemu/osdep.h" -#include <linux/vhost.h> -#include <sys/ioctl.h> #include "hw/virtio/vhost.h" #include "hw/virtio/vhost-backend.h" #include "qemu/error-report.h" +#ifdef CONFIG_LINUX +#include <linux/vhost.h> +#include <sys/ioctl.h> +static int vhost_kernel_call (struct vhost_dev *dev,unsigned long int request,void *arg) {
@@ -265,18 +267,23 @@ static const VhostOps kernel_ops = { .vhost_set_iotlb_callback = vhost_kernel_set_iotlb_callback, .vhost_send_device_iotlb_msg = vhost_kernel_send_device_iotlb_msg, }; +#endif int vhost_set_backend_type (struct vhost_dev *dev,VhostBackendType backend_type) {int r =0 ;switch (backend_type) { +#ifdef CONFIG_LINUX case VHOST_BACKEND_TYPE_KERNEL : dev->vhost_ops = &kernel_ops;break ; +#endif +#ifdef CONFIG_VHOST_USER case VHOST_BACKEND_TYPE_USER : dev->vhost_ops = &user_ops;break ; +#endif default :error_report ("Unknown vhost backend type" ); r =-1 ;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 47/54] vhost-user-test: signal data_cond when s->rings changes
In reply to Paolo BonziniThis speeds up wait_for_rings_started, which currently is just waiting for the timeout before checking s->rings.
Message-Id: <[email protected]>
--- tests/vhost-user-test.c | 2 ++ 1 file changed, 2 insertions(+)
tests/vhost-user-test.c +2 -0
@@ -384,6 +384,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)assert (msg.payload.state.index < s->queues *2 ); s->rings &= ~(0x1ULL << msg.payload.state.index); +g_cond_broadcast (&s->data_cond);break ;case VHOST_USER_SET_MEM_TABLE :
@@ -425,6 +426,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)case VHOST_USER_SET_VRING_BASE :assert (msg.payload.state.index < s->queues *2 ); s->rings |=0x1ULL << msg.payload.state.index; +g_cond_broadcast (&s->data_cond);break ;case VHOST_USER_GET_QUEUE_NUM :
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 50/54] vhost-user-test: skip if there is no memory at address 0
In reply to Paolo BonziniThe virt machine cannot run the vhost-user qtests because they hardcode the presence of memory at address 0. Report the tests as a skip so that they can be converted to use qgraph.
Message-Id: <[email protected]>
--- tests/vhost-user-test.c | 58 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 13 deletions(-)
tests/vhost-user-test.c +45 -13
@@ -228,9 +228,11 @@ static void uninit_virtio_dev(TestServer *s)qvirtio_pci_device_free (s->dev); } -static void wait_for_fds (TestServer *s) +static bool wait_for_fds (TestServer *s) {gint64 end_time; +bool got_region; +int i;g_mutex_lock (&s->data_mutex);
@@ -248,6 +250,19 @@ static void wait_for_fds(TestServer *s) g_assert_cmpint(s->fds_num, ==, s->memory.nregions);g_mutex_unlock (&s->data_mutex); + + got_region = false; +for (i =0 ; i < s->memory.nregions; ++i) { +VhostUserMemoryRegion *reg = &s->memory.regions[i]; +if (reg->guest_phys_addr ==0 ) { + got_region = true; +break ; + } + } +if (!got_region) { +g_test_skip ("No memory at address 0x0" ); + } +return got_region; }static void read_guest_mem_server (TestServer *s)
@@ -256,8 +271,6 @@ static void read_guest_mem_server(TestServer *s)int i, j;size_t size; -wait_for_fds (s); -g_mutex_lock (&s->data_mutex);/* iterate all regions */
@@ -577,8 +590,6 @@ static void write_guest_mem(TestServer *s, uint32_t seed)int i, j;size_t size; -wait_for_fds (s); -/* iterate all regions */ for (i =0 ; i < s->fds_num; i++) {
@@ -661,8 +672,13 @@ static void test_read_guest_mem(const void *arg)init_virtio_dev (server,1u <<VIRTIO_NET_F_MAC ); +if (!wait_for_fds (server)) { + goto exit; + } +read_guest_mem_server (server); +exit:uninit_virtio_dev (server);qtest_quit (s);
@@ -689,8 +705,10 @@ static void test_migrate(void)g_free (cmd);init_virtio_dev (s,1u <<VIRTIO_NET_F_MAC ); -init_virtio_dev (dest,1u <<VIRTIO_NET_F_MAC ); -wait_for_fds (s); +if (!wait_for_fds (s)) { + goto exit; + } + size =get_log_size (s); g_assert_cmpint(size, ==, (2 * 1024 * 1024) / (VHOST_LOG_PAGE * 8));
@@ -699,6 +717,7 @@ static void test_migrate(void)g_free (tmp); to =qtest_init (cmd);g_free (cmd); +init_virtio_dev (dest,1u <<VIRTIO_NET_F_MAC ); source =g_source_new (&test_migrate_source_funcs,sizeof (TestMigrateSource));
@@ -738,15 +757,18 @@ static void test_migrate(void) global_qtest = to;qmp_eventwait ("RESUME" ); +g_assert (wait_for_fds (s));read_guest_mem_server (dest); -uninit_virtio_dev (s);uninit_virtio_dev (dest); +qtest_quit (to);g_source_destroy (source);g_source_unref (source); -qtest_quit (to); +exit: +uninit_virtio_dev (s); +test_server_free (dest);qtest_quit (from);test_server_free (s);
@@ -810,16 +832,20 @@ static void test_reconnect_subprocess(void)g_free (cmd);init_virtio_dev (s,1u <<VIRTIO_NET_F_MAC ); -wait_for_fds (s); +if (!wait_for_fds (s)) { + goto exit; + } +wait_for_rings_started (s,2 );/* reconnect */ s->fds_num =0 ; s->rings =0 ;g_idle_add (reconnect_cb, s); -wait_for_fds (s); +g_assert (wait_for_fds (s));wait_for_rings_started (s,2 ); +exit:uninit_virtio_dev (s);qtest_end ();
@@ -848,9 +874,12 @@ static void test_connect_fail_subprocess(void)g_free (cmd);init_virtio_dev (s,1u <<VIRTIO_NET_F_MAC ); -wait_for_fds (s); +if (!wait_for_fds (s)) { + goto exit; + }wait_for_rings_started (s,2 ); +exit:uninit_virtio_dev (s);qtest_end ();
@@ -878,9 +907,12 @@ static void test_flags_mismatch_subprocess(void)g_free (cmd);init_virtio_dev (s,1u <<VIRTIO_NET_F_MAC ); -wait_for_fds (s); +if (!wait_for_fds (s)) { + goto exit; + }wait_for_rings_started (s,2 ); +exit:uninit_virtio_dev (s);qtest_end ();
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 52/54] vhost-user-test: create a main loop per TestServer
In reply to Paolo BonziniThis makes the tests more independent and removes the need to defer test_server_free via an idle event source.
Message-Id: <[email protected]>
--- tests/vhost-user-test.c | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-)
tests/vhost-user-test.c +16 -22
@@ -143,6 +143,8 @@ typedef struct TestServer {int fds_num;int fds[VHOST_MEMORY_MAX_NREGIONS ];VhostUserMemory memory; +GMainLoop *loop; +GThread *thread;GMutex data_mutex;GCond data_cond;int log_fd;
@@ -490,6 +492,10 @@ static TestServer *test_server_new(const gchar *name) {TestServer *server =g_new0 (TestServer,1 ); + server->loop =g_main_loop_new (NULL , FALSE); +/* run the main loop thread so the chardev may operate */ + server->thread =g_thread_new (NULL , thread_function, server->loop); + server->socket_path =g_strdup_printf ("%s/%s.sock" , tmpfs, name); server->mig_path =g_strdup_printf ("%s/%s.mig" , tmpfs, name); server->chr_name =g_strdup_printf ("chr-%s" , name);
@@ -533,9 +539,18 @@ static void test_server_listen(TestServer *server)test_server_create_chr (server,",server,nowait" ); } -static gboolean _test_server_free (TestServer *server) +static void test_server_free (TestServer *server) {int i; +int ret; + +/* finish the helper thread and dispatch pending sources */ +g_main_loop_quit (server->loop); +g_thread_join (server->thread); +while (g_main_context_pending (NULL )) { +g_main_context_iteration (NULL , TRUE); + } +g_main_loop_unref (server->loop);qemu_chr_fe_deinit (&server->chr, true);
@@ -558,13 +573,6 @@ static gboolean _test_server_free(TestServer *server)qpci_free_pc (server->bus);g_free (server); - -return FALSE; -} - -static void test_server_free (TestServer *server) -{ -g_idle_add ((GSourceFunc )_test_server_free, server); }static void wait_for_log_fd (TestServer *s)
@@ -969,8 +977,6 @@ int main(int argc, char **argv)const char *hugefs;int ret;char template[] ="/tmp/vhost-test-XXXXXX" ; -GMainLoop *loop; -GThread *thread;g_test_init (&argc, &argv,NULL );
@@ -991,10 +997,6 @@ int main(int argc, char **argv) root = tmpfs; } - loop =g_main_loop_new (NULL , FALSE); -/* run the main loop thread so the chardev may operate */ - thread =g_thread_new (NULL , thread_function, loop); -if (qemu_memfd_check (0 )) { qtest_add_data_func("/vhost-user/read-guest-mem/memfd", GINT_TO_POINTER(TEST_MEMFD_YES),
@@ -1022,14 +1024,6 @@ int main(int argc, char **argv)/* cleanup */ -/* finish the helper thread and dispatch pending sources */ -g_main_loop_quit (loop); -g_thread_join (thread); -while (g_main_context_pending (NULL )) { -g_main_context_iteration (NULL , TRUE); - } -g_main_loop_unref (loop); - ret =rmdir (tmpfs);if (ret !=0 ) { g_test_message("unable to rmdir: path (%s): %s\n",
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 44/54] vhost-net: compile it on all targets that have virtio-net.
In reply to Paolo BonziniThis shows a preexisting bug: if a KVM target did not have virtio-net enabled, it would fail with undefined symbols when vhost was enabled. This must now be fixed, lest targets that have no virtio-net fail to compile.
Message-Id: <[email protected]>
--- configure | 11 ++++------- hw/net/Makefile.objs | 4 ++-- include/exec/poison.h | 1 - tests/Makefile.include | 5 +---- 4 files changed, 7 insertions(+), 14 deletions(-)
configure +4 -7
@@ -6514,7 +6514,10 @@ fi if test "$vhost_scsi" = "yes" ; then echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak fi -if test "$vhost_net" = "yes" -a "$vhost_user" = "yes"; then +if test "$vhost_net" = "yes" ; then + echo "CONFIG_VHOST_NET=y" >> $config_host_mak +fi +if test "$vhost_net_user" = "yes" ; then echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak fi if test "$vhost_crypto" = "yes" ; then
@@ -7276,12 +7279,6 @@ if supported_xen_target $target; then fi if supported_kvm_target $target; then echo "CONFIG_KVM=y" >> $config_target_mak - if test "$vhost_net" = "yes" ; then - echo "CONFIG_VHOST_NET=y" >> $config_target_mak - if test "$vhost_user" = "yes" ; then - echo "CONFIG_VHOST_USER_NET_TEST_$target_name=y" >> $config_host_mak - fi - fi fi if supported_hax_target $target; then echo "CONFIG_HAX=y" >> $config_target_mak
hw/net/Makefile.objs +2 -2
@@ -37,8 +37,8 @@ obj-$(CONFIG_PSERIES) += spapr_llan.o obj-$(CONFIG_XILINX_ETHLITE) += xilinx_ethlite.o obj-$(CONFIG_VIRTIO_NET) += virtio-net.o -obj-$(CONFIG_VHOST_NET) += vhost_net.o -common-obj-$(call lnot,$(CONFIG_VHOST_NET)) += vhost_net-stub.o +common-obj-$(call land,$(CONFIG_VIRTIO_NET),$(CONFIG_VHOST_NET)) += vhost_net.o +common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO_NET),$(CONFIG_VHOST_NET))) += vhost_net-stub.o common-obj-$(CONFIG_ALL) += vhost_net-stub.o obj-$(CONFIG_ETSEC) += fsl_etsec/etsec.o fsl_etsec/registers.o \
include/exec/poison.h +0 -1
@@ -85,7 +85,6 @@#pragma GCC poison CONFIG_XTENSA_DIS#pragma GCC poison CONFIG_LINUX_USER -#pragma GCC poison CONFIG_VHOST_NET#pragma GCC poison CONFIG_KVM#pragma GCC poison CONFIG_SOFTMMU
tests/Makefile.include +1 -4
@@ -204,10 +204,7 @@ check-qtest-i386-$(CONFIG_USB_XHCI_NEC) += tests/usb-hcd-xhci-test$(EXESUF) check-qtest-i386-y += tests/cpu-plug-test$(EXESUF) check-qtest-i386-y += tests/q35-test$(EXESUF) check-qtest-i386-y += tests/vmgenid-test$(EXESUF) -check-qtest-i386-$(CONFIG_VHOST_USER_NET_TEST_i386) += tests/vhost-user-test$(EXESUF) -ifeq ($(CONFIG_VHOST_USER_NET_TEST_i386),) -check-qtest-x86_64-$(CONFIG_VHOST_USER_NET_TEST_x86_64) += tests/vhost-user-test$(EXESUF) -endif +check-qtest-i386-$(CONFIG_VHOST_NET_USER) += tests/vhost-user-test$(EXESUF) check-qtest-i386-$(CONFIG_TPM_CRB) += tests/tpm-crb-swtpm-test$(EXESUF) check-qtest-i386-$(CONFIG_TPM_CRB) += tests/tpm-crb-test$(EXESUF) check-qtest-i386-$(CONFIG_TPM_TIS) += tests/tpm-tis-swtpm-test$(EXESUF)
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 48/54] vhost-user: support cross-endian vnet headers
In reply to Paolo Bonzinivhost-user already has a way to communicate the endianness of the guest via the vring endianness messages. The vring endianness always matches the vnet header endianness so there is no need to do anything else in the backend.
Message-Id: <[email protected]>
--- net/vhost-user.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
net/vhost-user.c +13 -0
@@ -172,6 +172,17 @@ static void net_vhost_user_cleanup(NetClientState *nc)qemu_purge_queued_packets (nc); } +static int vhost_user_set_vnet_endianness (NetClientState *nc, +bool enable) +{ +/* Nothing to do. If the server supports +* VHOST_USER_PROTOCOL_F_CROSS_ENDIAN, it will get the +* vnet header endianness from there. If it doesn't, negotiation +* fails. +*/ +return 0 ; +} +static bool vhost_user_has_vnet_hdr (NetClientState *nc) {assert (nc->info->type ==NET_CLIENT_DRIVER_VHOST_USER );
@@ -193,6 +204,8 @@ static NetClientInfo net_vhost_user_info = { .cleanup = net_vhost_user_cleanup, .has_vnet_hdr = vhost_user_has_vnet_hdr, .has_ufo = vhost_user_has_ufo, + .set_vnet_be = vhost_user_set_vnet_endianness, + .set_vnet_le = vhost_user_set_vnet_endianness, }; static gboolean net_vhost_user_watch(GIOChannel *chan, GIOCondition cond,
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 49/54] vhost-user-test: support VHOST_USER_PROTOCOL_F_CROSS_ENDIAN
In reply to Paolo BonziniThis will be useful to run the qtest for ppc64 targets on (for example) x86_64 hosts.
Message-Id: <[email protected]>
--- tests/vhost-user-test.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
tests/vhost-user-test.c +5 -3
@@ -51,6 +51,7 @@#define VHOST_USER_F_PROTOCOL_FEATURES 30#define VHOST_USER_PROTOCOL_F_MQ 0#define VHOST_USER_PROTOCOL_F_LOG_SHMFD 1 +#define VHOST_USER_PROTOCOL_F_CROSS_ENDIAN 6#define VHOST_LOG_PAGE 0x1000
@@ -251,7 +252,7 @@ static void wait_for_fds(TestServer *s)static void read_guest_mem_server (TestServer *s) { -uint32_t *guest_mem; +uint8_t *guest_mem;int i, j;size_t size;
@@ -278,8 +279,8 @@ static void read_guest_mem_server(TestServer *s)g_assert (guest_mem !=MAP_FAILED ); guest_mem += (s->memory.regions[i].mmap_offset /sizeof (*guest_mem)); -for (j =0 ; j <256 ; j++) { -uint32_t a =readl (s->memory.regions[i].guest_phys_addr + j*4 ); +for (j =0 ; j <1024 ; j++) { +uint32_t a =readb (s->memory.regions[i].guest_phys_addr + j);uint32_t b = guest_mem[j]; g_assert_cmpint(a, ==, b);
@@ -367,6 +368,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) msg.flags |=VHOST_USER_REPLY_MASK ; msg.size =sizeof (m.payload.u64); msg.payload.u64 =1 <<VHOST_USER_PROTOCOL_F_LOG_SHMFD ; + msg.payload.u64 |=1 <<VHOST_USER_PROTOCOL_F_CROSS_ENDIAN ;if (s->queues >1 ) { msg.payload.u64 |=1 <<VHOST_USER_PROTOCOL_F_MQ ; }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 51/54] vhost-user-test: reduce usage of global_qtest
In reply to Paolo BonziniWhenever the code can run on multiple QTestStates, use them explicitly instead of global_qtest.
Message-Id: <[email protected]>
--- tests/vhost-user-test.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-)
tests/vhost-user-test.c +17 -21
@@ -187,12 +187,12 @@ static char *get_qemu_cmd(TestServer *s, } } -static void init_virtio_dev (TestServer *s,uint32_t features_mask) +static void init_virtio_dev (QTestState *qts,TestServer *s,uint32_t features_mask) {uint32_t features;int i; - s->bus =qpci_init_pc (global_qtest,NULL ); + s->bus =qpci_init_pc (qts,NULL );g_assert_nonnull (s->bus); s->dev =qvirtio_pci_device_find (s->bus,VIRTIO_ID_NET );
@@ -203,7 +203,7 @@ static void init_virtio_dev(TestServer *s, uint32_t features_mask)qvirtio_set_acknowledge (&s->dev->vdev);qvirtio_set_driver (&s->dev->vdev); - s->alloc =pc_alloc_init (global_qtest); + s->alloc =pc_alloc_init (qts);for (i =0 ; i < s->queues *2 ; i++) { s->vq[i] =qvirtqueue_setup (&s->dev->vdev, s->alloc, i);
@@ -265,7 +265,7 @@ static bool wait_for_fds(TestServer *s)return got_region; } -static void read_guest_mem_server (TestServer *s) +static void read_guest_mem_server (QTestState *qts,TestServer *s) {uint8_t *guest_mem;int i, j;
@@ -293,7 +293,7 @@ static void read_guest_mem_server(TestServer *s) guest_mem += (s->memory.regions[i].mmap_offset /sizeof (*guest_mem));for (j =0 ; j <1024 ; j++) { -uint32_t a =readb (s->memory.regions[i].guest_phys_addr + j); +uint32_t a =qtest_readb (qts, s->memory.regions[i].guest_phys_addr + j);uint32_t b = guest_mem[j]; g_assert_cmpint(a, ==, b);
@@ -670,13 +670,13 @@ static void test_read_guest_mem(const void *arg) s =qtest_start (qemu_cmd);g_free (qemu_cmd); -init_virtio_dev (server,1u <<VIRTIO_NET_F_MAC ); +init_virtio_dev (global_qtest, server,1u <<VIRTIO_NET_F_MAC );if (!wait_for_fds (server)) { goto exit; } -read_guest_mem_server (server); +read_guest_mem_server (global_qtest, server); exit:uninit_virtio_dev (server);
@@ -690,7 +690,7 @@ static void test_migrate(void)TestServer *s =test_server_new ("src" );TestServer *dest =test_server_new ("dest" );char *uri =g_strdup_printf ("%s%s" ,"unix:" , dest->mig_path); -QTestState *global = global_qtest, *from, *to; +QTestState *from, *to;GSource *source;gchar *cmd, *tmp;QDict *rsp;
@@ -704,7 +704,7 @@ static void test_migrate(void) from =qtest_start (cmd);g_free (cmd); -init_virtio_dev (s,1u <<VIRTIO_NET_F_MAC ); +init_virtio_dev (from, s,1u <<VIRTIO_NET_F_MAC );if (!wait_for_fds (s)) { goto exit; }
@@ -717,7 +717,7 @@ static void test_migrate(void)g_free (tmp); to =qtest_init (cmd);g_free (cmd); -init_virtio_dev (dest,1u <<VIRTIO_NET_F_MAC ); +init_virtio_dev (to, dest,1u <<VIRTIO_NET_F_MAC ); source =g_source_new (&test_migrate_source_funcs,sizeof (TestMigrateSource));
@@ -753,12 +753,10 @@ static void test_migrate(void)qobject_unref (rsp);qmp_eventwait ("STOP" ); +qtest_qmp_eventwait (to,"RESUME" ); - global_qtest = to; -qmp_eventwait ("RESUME" ); - -g_assert (wait_for_fds (s)); -read_guest_mem_server (dest); +g_assert (wait_for_fds (dest)); +read_guest_mem_server (to, dest);uninit_virtio_dev (dest);qtest_quit (to);
@@ -773,8 +771,6 @@ exit:qtest_quit (from);test_server_free (s);g_free (uri); - - global_qtest = global; }static void wait_for_rings_started (TestServer *s,size_t count)
@@ -831,7 +827,7 @@ static void test_reconnect_subprocess(void)qtest_start (cmd);g_free (cmd); -init_virtio_dev (s,1u <<VIRTIO_NET_F_MAC ); +init_virtio_dev (global_qtest, s,1u <<VIRTIO_NET_F_MAC );if (!wait_for_fds (s)) { goto exit; }
@@ -873,7 +869,7 @@ static void test_connect_fail_subprocess(void)qtest_start (cmd);g_free (cmd); -init_virtio_dev (s,1u <<VIRTIO_NET_F_MAC ); +init_virtio_dev (global_qtest, s,1u <<VIRTIO_NET_F_MAC );if (!wait_for_fds (s)) { goto exit; }
@@ -906,7 +902,7 @@ static void test_flags_mismatch_subprocess(void)qtest_start (cmd);g_free (cmd); -init_virtio_dev (s,1u <<VIRTIO_NET_F_MAC ); +init_virtio_dev (global_qtest, s,1u <<VIRTIO_NET_F_MAC );if (!wait_for_fds (s)) { goto exit; }
@@ -957,7 +953,7 @@ static void test_multiqueue(void)qtest_start (cmd);g_free (cmd); -init_virtio_dev (s, features_mask); +init_virtio_dev (global_qtest, s, features_mask);wait_for_rings_started (s, s->queues *2 );
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 53/54] vhost-user-test: small changes to init_hugepagefs
In reply to Paolo BonziniAfter the conversion to qgraph, the equivalent of "main" will be in a constructor and will run even if the tests are not being requested. Therefore, it should not assert that init_hugepagefs succeeds and will be called when creating the TestServer. This patch changes the prototype of init_hugepagefs, this way the next patch looks nicer.
Message-Id: <[email protected]>
--- tests/vhost-user-test.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
tests/vhost-user-test.c +10 -9
@@ -461,13 +461,19 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)g_mutex_unlock (&s->data_mutex); } -static const char *init_hugepagefs (const char *path) +static const char *init_hugepagefs (void ) { +const char *path =getenv ("QTEST_HUGETLBFS_PATH" );struct statfs fs;int ret; +if (!path) { +return NULL ; + } +if (access (path,R_OK |W_OK |X_OK )) {g_test_message ("access on path (%s): %s\n" , path,strerror (errno)); +abort ();return NULL ; }
@@ -477,11 +483,13 @@ static const char *init_hugepagefs(const char *path)if (ret !=0 ) {g_test_message ("statfs on path (%s): %s\n" , path,strerror (errno)); +abort ();return NULL ; }if (fs.f_type !=HUGETLBFS_MAGIC ) {g_test_message ("Warning: path not on HugeTLBFS: %s\n" , path); +abort ();return NULL ; }
@@ -974,7 +982,6 @@ static void test_multiqueue(void)int main (int argc,char **argv) { -const char *hugefs;int ret;char template[] ="/tmp/vhost-test-XXXXXX" ;
@@ -989,13 +996,7 @@ int main(int argc, char **argv) }g_assert (tmpfs); - hugefs =getenv ("QTEST_HUGETLBFS_PATH" ); -if (hugefs) { - root =init_hugepagefs (hugefs); -g_assert (root); - }else { - root = tmpfs; - } + root =init_hugepagefs () ? : tmpfs;if (qemu_memfd_check (0 )) { qtest_add_data_func("/vhost-user/read-guest-mem/memfd",
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 54/54] vhost-user-test: create a temporary directory per TestServer
In reply to Paolo BonziniThis makes the tests more independent, and also the source and destination TestServers in the migration test.
Message-Id: <[email protected]>
--- tests/vhost-user-test.c | 75 ++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 41 deletions(-)
tests/vhost-user-test.c +34 -41
@@ -139,6 +139,8 @@ typedef struct TestServer {gchar *socket_path;gchar *mig_path;gchar *chr_name; +const gchar *mem_path; +gchar *tmpfs;CharBackend chr;int fds_num;int fds[VHOST_MEMORY_MAX_NREGIONS ];
@@ -159,9 +161,6 @@ static TestServer *test_server_new(const gchar *name);static void test_server_free (TestServer *server);static void test_server_listen (TestServer *server); -static const char *tmpfs; -static const char *root; -enum test_memfd {TEST_MEMFD_AUTO ,TEST_MEMFD_YES ,
@@ -169,7 +168,7 @@ enum test_memfd { };static char *get_qemu_cmd (TestServer *s, -int mem,enum test_memfd memfd,const char *mem_path, +int mem,enum test_memfd memfd,const char *chr_opts,const char *extra) {if (memfd ==TEST_MEMFD_AUTO &&qemu_memfd_check (0 )) {
@@ -184,7 +183,7 @@ static char *get_qemu_cmd(TestServer *s, }else { return g_strdup_printf(QEMU_CMD_MEM QEMU_CMD_CHR QEMU_CMD_NETDEV QEMU_CMD_NET "%s", mem, mem, - mem_path, s->chr_name, s->socket_path, + s->mem_path, s->chr_name, s->socket_path, chr_opts, s->chr_name, extra); } }
@@ -499,11 +498,21 @@ static const char *init_hugepagefs(void)static TestServer *test_server_new (const gchar *name) {TestServer *server =g_new0 (TestServer,1 ); +char template[] ="/tmp/vhost-test-XXXXXX" ; +const char *tmpfs; server->loop =g_main_loop_new (NULL , FALSE);/* run the main loop thread so the chardev may operate */ server->thread =g_thread_new (NULL , thread_function, server->loop); + tmpfs =mkdtemp (template); +if (!tmpfs) { +g_test_message ("mkdtemp on path (%s): %s" , template,strerror (errno)); + } +g_assert (tmpfs); + + server->tmpfs =g_strdup (tmpfs); + server->mem_path =init_hugepagefs () ? : server->tmpfs; server->socket_path =g_strdup_printf ("%s/%s.sock" , tmpfs, name); server->mig_path =g_strdup_printf ("%s/%s.mig" , tmpfs, name); server->chr_name =g_strdup_printf ("chr-%s" , name);
@@ -560,6 +569,18 @@ static void test_server_free(TestServer *server) }g_main_loop_unref (server->loop); +unlink (server->socket_path); +g_free (server->socket_path); + +unlink (server->mig_path); +g_free (server->mig_path); + + ret =rmdir (server->tmpfs); +if (ret !=0 ) { +g_test_message ("unable to rmdir: path (%s): %s" , + server->tmpfs,strerror (errno)); + } +qemu_chr_fe_deinit (&server->chr, true);for (i =0 ; i < server->fds_num; i++) {
@@ -570,12 +591,6 @@ static void test_server_free(TestServer *server)close (server->log_fd); } -unlink (server->socket_path); -g_free (server->socket_path); - -unlink (server->mig_path); -g_free (server->mig_path); -g_free (server->chr_name);g_assert (server->bus);qpci_free_pc (server->bus);
@@ -681,7 +696,7 @@ static void test_read_guest_mem(const void *arg) "read-guest-memfd" : "read-guest-mem"); test_server_listen(server); - qemu_cmd =get_qemu_cmd (server,512 , memfd, root,"" ,"" ); + qemu_cmd =get_qemu_cmd (server,512 , memfd,"" ,"" ); s =qtest_start (qemu_cmd);g_free (qemu_cmd);
@@ -716,7 +731,7 @@ static void test_migrate(void)test_server_listen (s);test_server_listen (dest); - cmd =get_qemu_cmd (s,2 ,TEST_MEMFD_AUTO , root,"" ,"" ); + cmd =get_qemu_cmd (s,2 ,TEST_MEMFD_AUTO ,"" ,"" ); from =qtest_start (cmd);g_free (cmd);
@@ -729,7 +744,7 @@ static void test_migrate(void) g_assert_cmpint(size, ==, (2 * 1024 * 1024) / (VHOST_LOG_PAGE * 8)); tmp =g_strdup_printf (" -incoming %s" , uri); - cmd =get_qemu_cmd (dest,2 ,TEST_MEMFD_AUTO , root,"" , tmp); + cmd =get_qemu_cmd (dest,2 ,TEST_MEMFD_AUTO ,"" , tmp);g_free (tmp); to =qtest_init (cmd);g_free (cmd);
@@ -839,7 +854,7 @@ static void test_reconnect_subprocess(void)char *cmd;g_thread_new ("connect" , connect_thread, s); - cmd =get_qemu_cmd (s,2 ,TEST_MEMFD_AUTO , root,",server" ,"" ); + cmd =get_qemu_cmd (s,2 ,TEST_MEMFD_AUTO ,",server" ,"" );qtest_start (cmd);g_free (cmd);
@@ -881,7 +896,7 @@ static void test_connect_fail_subprocess(void) s->test_fail = true;g_thread_new ("connect" , connect_thread, s); - cmd =get_qemu_cmd (s,2 ,TEST_MEMFD_AUTO , root,",server" ,"" ); + cmd =get_qemu_cmd (s,2 ,TEST_MEMFD_AUTO ,",server" ,"" );qtest_start (cmd);g_free (cmd);
@@ -914,7 +929,7 @@ static void test_flags_mismatch_subprocess(void) s->test_flags =TEST_FLAGS_DISCONNECT ;g_thread_new ("connect" , connect_thread, s); - cmd =get_qemu_cmd (s,2 ,TEST_MEMFD_AUTO , root,",server" ,"" ); + cmd =get_qemu_cmd (s,2 ,TEST_MEMFD_AUTO ,",server" ,"" );qtest_start (cmd);g_free (cmd);
@@ -962,7 +977,7 @@ static void test_multiqueue(void) cmd =g_strdup_printf ( QEMU_CMD_MEM QEMU_CMD_CHR QEMU_CMD_NETDEV ",queues=%d ""-device virtio-net-pci,netdev=net0,mq=on,vectors=%d" , -512 ,512 , root, s->chr_name, +512 ,512 , s->mem_path, s->chr_name, s->socket_path,"" , s->chr_name, s->queues, s->queues *2 +2 ); }
@@ -982,22 +997,11 @@ static void test_multiqueue(void)int main (int argc,char **argv) { -int ret; -char template[] ="/tmp/vhost-test-XXXXXX" ; -g_test_init (&argc, &argv,NULL );module_call_init (MODULE_INIT_QOM );qemu_add_opts (&qemu_chardev_opts); - tmpfs =mkdtemp (template); -if (!tmpfs) { -g_test_message ("mkdtemp on path (%s): %s\n" , template,strerror (errno)); - } -g_assert (tmpfs); - - root =init_hugepagefs () ? : tmpfs; -if (qemu_memfd_check (0 )) { qtest_add_data_func("/vhost-user/read-guest-mem/memfd", GINT_TO_POINTER(TEST_MEMFD_YES),
@@ -1021,16 +1025,5 @@ int main(int argc, char **argv)qtest_add_func ("/vhost-user/flags-mismatch" , test_flags_mismatch); } - ret =g_test_run (); - -/* cleanup */ - - ret =rmdir (tmpfs); -if (ret !=0 ) { -g_test_message ("unable to rmdir: path (%s): %s\n" , - tmpfs,strerror (errno)); - } - g_assert_cmpint(ret, ==, 0); - -return ret; +return g_test_run (); }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 45/54] vhost-net: revamp configure logic
In reply to Paolo BonziniDetect all invalid configurations (e.g. mingw32 with vhost-user, non-Linux with vhost-kernel). As a collateral benefit, all vhost-kernel backends can be now disabled if one wants to reduce the attack surface.
Message-Id: <[email protected]>
--- configure | 89 +++++++++++++++++++++++++++++++---------------- hw/virtio/Makefile.objs | 4 +-- hw/virtio/vhost-backend.c | 4 +-- 3 files changed, 63 insertions(+), 34 deletions(-)
configure +59 -30
@@ -366,10 +366,10 @@ libattr="" xfs="" tcg="yes" membarrier="" -vhost_net="no" -vhost_crypto="no" -vhost_scsi="no" -vhost_vsock="no" +vhost_net="" +vhost_crypto="" +vhost_scsi="" +vhost_vsock="" vhost_user="" kvm="no" hax="no"
@@ -774,6 +774,7 @@ case $targetos in MINGW32*) mingw32="yes" hax="yes" + vhost_user="no" audio_possible_drivers="dsound sdl" if check_include dsound.h; then audio_drv_list="dsound"
@@ -874,10 +875,6 @@ Linux) linux="yes" linux_user="yes" kvm="yes" - vhost_net="yes" - vhost_crypto="yes" - vhost_scsi="yes" - vhost_vsock="yes" QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$PWD/linux-headers $QEMU_INCLUDES" supported_os="yes" libudev="yes"
@@ -1255,11 +1252,7 @@ for opt do ;; --disable-vhost-crypto) vhost_crypto="no" ;; - --enable-vhost-crypto) - vhost_crypto="yes" - if test "$mingw32" = "yes"; then - error_exit "vhost-crypto isn't available on win32" - fi + --enable-vhost-crypto) vhost_crypto="yes" ;; --disable-vhost-scsi) vhost_scsi="no" ;;
@@ -1460,11 +1453,11 @@ for opt do ;; --disable-vhost-user) vhost_user="no" ;; - --enable-vhost-user) - vhost_user="yes" - if test "$mingw32" = "yes"; then - error_exit "vhost-user isn't available on win32" - fi + --enable-vhost-user) vhost_user="yes" + ;; + --disable-vhost-kernel) vhost_kernel="no" + ;; + --enable-vhost-kernel) vhost_kernel="yes" ;; --disable-capstone) capstone="no" ;;
@@ -1496,14 +1489,6 @@ for opt do esac done -if test "$vhost_user" = ""; then - if test "$mingw32" = "yes"; then - vhost_user="no" - else - vhost_user="yes" - fi -fi - case "$cpu" in ppc) CPU_CFLAGS="-m32"
@@ -1728,8 +1713,12 @@ disabled with --disable-FEATURE, default is enabled if available: linux-aio Linux AIO support cap-ng libcap-ng support attr attr and xattr support - vhost-net vhost-net acceleration support - vhost-crypto vhost-crypto acceleration support + vhost-net vhost-net kernel acceleration support + vhost-vsock virtio sockets device support + vhost-scsi vhost-scsi kernel target support + vhost-crypto vhost-user-crypto backend support + vhost-kernel vhost kernel backend support + vhost-user vhost-user backend support spice spice rbd rados block device (rbd) libiscsi iscsi support
@@ -1753,7 +1742,6 @@ disabled with --disable-FEATURE, default is enabled if available: jemalloc jemalloc support avx2 AVX2 optimization support replication replication support - vhost-vsock virtio sockets device support opengl opengl support virglrenderer virgl rendering support xfsctl xfsctl support
@@ -1770,7 +1758,6 @@ disabled with --disable-FEATURE, default is enabled if available: parallels parallels image format support sheepdog sheepdog block driver support crypto-afalg Linux AF_ALG crypto backend driver - vhost-user vhost-user support capstone capstone disassembler support debug-mutex mutex debugging support libpmem libpmem support
@@ -2157,6 +2144,45 @@ else l2tpv3=no fi +######################################### +# vhost interdependencies and host support + +# vhost backends +test "$vhost_user" = "" && vhost_user=yes +if test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then + error_exit "vhost-user isn't available on win32" +fi +test "$vhost_kernel" = "" && vhost_kernel=$linux +if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then + error_exit "vhost-kernel is only available on Linux" +fi + +# vhost-kernel devices +test "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel +if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then + error_exit "--enable-vhost-scsi requires --enable-vhost-kernel" +fi +test "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel +if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then + error_exit "--enable-vhost-vsock requires --enable-vhost-kernel" +fi + +# vhost-user backends +test "$vhost_net_user" = "" && vhost_net_user=$vhost_user +if test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then + error_exit "--enable-vhost-net-user requires --enable-vhost-user" +fi +test "$vhost_crypto" = "" && vhost_crypto=$vhost_user +if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then + error_exit "--enable-vhost-crypto requires --enable-vhost-user" +fi + +# OR the vhost-kernel and vhost-user values for simplicity +if test "$vhost_net" = ""; then + test "$vhost_net_user" = "yes" && vhost_net=yes + test "$vhost_kernel" = "yes" && vhost_net=yes +fi + ########################################## # MinGW / Mingw-w64 localtime_r/gmtime_r check
@@ -6526,6 +6552,9 @@ fi if test "$vhost_vsock" = "yes" ; then echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak fi +if test "$vhost_kernel" = "yes" ; then + echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak +fi if test "$vhost_user" = "yes" ; then echo "CONFIG_VHOST_USER=y" >> $config_host_mak fi
hw/virtio/Makefile.objs +2 -2
@@ -11,8 +11,8 @@ obj-$(call land,$(CONFIG_VIRTIO_CRYPTO),$(CONFIG_VIRTIO_PCI)) += virtio-crypto-p obj-$(CONFIG_VHOST_USER) += vhost-user.o obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o -obj-$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_LINUX)) += vhost.o vhost-backend.o -common-obj-$(call lnot,$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_LINUX))) += vhost-stub.o +obj-$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_VHOST_KERNEL)) += vhost.o vhost-backend.o +common-obj-$(call lnot,$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_VHOST_KERNEL))) += vhost-stub.o endif common-obj-$(CONFIG_ALL) += vhost-stub.o
hw/virtio/vhost-backend.c +2 -2
@@ -13,7 +13,7 @@#include "hw/virtio/vhost-backend.h" #include "qemu/error-report.h" -#ifdef CONFIG_LINUX +#ifdef CONFIG_VHOST_KERNEL #include <linux/vhost.h> #include <sys/ioctl.h>
@@ -274,7 +274,7 @@ int vhost_set_backend_type(struct vhost_dev *dev, VhostBackendType backend_type)int r =0 ;switch (backend_type) { -#ifdef CONFIG_LINUX +#ifdef CONFIG_VHOST_KERNEL case VHOST_BACKEND_TYPE_KERNEL : dev->vhost_ops = &kernel_ops;break ;
Signature · 1 line
1.8.3.1
Quoted 11 lines · Paolo Bonzini
The following changes since commit
bb9bf94b3e8926553290bc9a7cb84315af422086:Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging (2018-12-11 19:18:58 +0000)are available in the git repository at:
git://github.com/bonzini/qemu.gittags/for-upstreamfor you to fetch changes up to
e2a9129b491fdb3be3661baf08a9fa4c2e19a028:
Quoted 8 lines
vhost-user-test: create a temporary directory per TestServer (2018-12-12 13:49:31 +0100)
This introduces a new dependency on perl's
Test::Harnesspackage. This is distributed in package perl-Test-Harness for Fedora, and libtest-harness-perl for Debian. I couldn't find anything for BSD or macOS, but at least the Patchew BSD images already have it so it is probably bundled with Perl.* add explicit checks for the compiler version and cleanup (Thomas)
Thomas sent a separate pull request for these. Git will probably do the right thing if the two pull requests have identical commits, but I didn't check if there were any minor variations in patch contents that would cause a conflict.
Quoted 6 lines
Marc-André Lureau (5):
vhost-user-bridge: fix "unknown type name" compilation error
build-sys: don't includewindows.h,osdep.hdoes it
build-sys: move windows defines inosdep.hheader
build-sys: build with Vista API by default
RFC: qga: drop < Vista compatibility
As Dan pointed out, removing the RFC from the commit title would require a v2 spin of the pull request - if you send a v2, then you can also sort out whether to include the minimum compiler version patches.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Quoted 25 lines · Eric Blake
Quoted 23 lines · Paolo Bonzini
The following changes since commit
bb9bf94b3e8926553290bc9a7cb84315af422086:Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging (2018-12-11 19:18:58 +0000)
are available in the git repository at:
git://github.com/bonzini/qemu.gittags/for-upstreamfor you to fetch changes up to
e2a9129b491fdb3be3661baf08a9fa4c2e19a028:vhost-user-test: create a temporary directory per TestServer (2018-12-12 13:49:31 +0100)
This introduces a new dependency on perl's
Test::Harnesspackage. This is
distributed in package perl-Test-Harness for Fedora, and libtest-harness-perl
for Debian. I couldn't find anything for BSD or macOS, but at least the Patchew BSD images already have it so it is probably bundled with Perl.
Quoted 6 lines
Quoted 1 line
* add explicit checks for the compiler version and cleanup (Thomas)
Thomas sent a separate pull request for these. Git will probably do the right thing if the two pull requests have identical commits, but I didn't check if there were any minor variations in patch contents that would cause a conflict.
There's likely a conflict in the "-fno-gcse" patch since this has minor edits ... Sorry for that.
So Peter, you've got two options now:
1) Apply Paolo's series. I'll then send a revert for patch 24/54 later.
2) Apply my series first. In that case, I think Paolo should send a v2 of his PULL request with patch 24 and 33-39 dropped.
Thomas
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PULL 00/54] Misc patches for 2018-12-12
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
- [tag update] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
16b9e64 vhost-user-test: create a temporary directory per TestServer dc7e694 vhost-user-test: small changes to init_hugepagefs
b4414a7 vhost-user-test: create a main loop per TestServer
493f5e3 vhost-user-test: reduce usage of global_qtest
80f65ff vhost-user-test: skip if there is no memory at address 0
053b648 vhost-user-test: support VHOST_USER_PROTOCOL_F_CROSS_ENDIAN 9e1714a vhost-user: support cross-endian vnet headers
6771502 vhost-user-test: signal data_cond when s->rings changes
1f30d35 vhost-user-test: use g_cond_broadcast
c9779b6 vhost-net: revamp configure logic
65060cb vhost-net: compile it on all targets that have virtio-net. 02052a8 vhost: restrict Linux dependency to kernel vhost
2e9125d vhost-net-user: add stubs for when no virtio-net device is present 334c822 vhost-net: move stubs to a separate file
23a88fb hw/watchdog/wdt_i6300esb : remove a unnecessary comment
213a7dc Remove QEMU_ARTIFICIAL macro
2fa6936 includes: Replace QEMU_GNUC_PREREQ with "__has_builtin || !defined(__clang__)" 5dc8dfa audio/alsaaudio: Remove compiler check around pragma
9ded950 tcg/tcg.h: Remove GCC check for tcg_debug_assert() macro
5b4272c configure: Remove old -fno-gcse workaround for GCC 4.6.x and 4.7.[012] f1f6aa3 configure: Remove obsolete check for Clang < 3.2
d7f23f1 configure: Add a test for the minimum compiler version
bb04958 checkpatch: warn about qemu/queue.h head structs that are not typedef-ed 3b17309 qemu/queue.h: simplify reverse access to QTAILQ
e7ca6bd qemu/queue.h: reimplement QTAILQ without pointer-to-pointers 276fe5a qemu/queue.h: remove Q_TAILQ_{HEAD, ENTRY}
94d7074 qemu/queue.h: typedef QTAILQ heads
33c8d7f qemu/queue.h: leave head structs anonymous unless necessary 515e852 vfio: make vfio_address_spaces static
f0eff3f qemu/queue.h: do not access tqe_prev directly
279b05a compiler.h: Add an explicit check for the compiler version 17afb2c test: replace gtester with a TAP driver
5ac5663 test: execute g_test_run when tests are skipped
4aa44d3 RFC: qga: drop < Vista compatibility
ce507e2 build-sys: build with Vista API by default
4553cbc build-sys: move windows defines in osdep.h header
75ae603 build-sys: don't include windows.h, osdep.h does it
e759092 scsi: esp: Defer command completion until previous interrupts have been handled eda6b74 esp-pci: Fix status register write erase control
565b3aa block/iscsi: cancel libiscsi task when ABORT TASK TMF completes 363ab7c block/iscsi: fix ioctl cancel use-after-free
e5c91c8 block/iscsi: take iscsilun->mutex in iscsi_timed_check_events() 5213399 block/iscsi: drop unused IscsiAIOCB->buf field
f5729b9 hax: Support for Linux hosts
a050a4d memory: update coalesced_range on transaction_commit
e6bb3cf memory: avoid unnecessary coalesced_io_del operations
dc372b7 memory: extract flat_range_coalesced_io_{del, add}
24905f8 pam: wrap MemoryRegion initialization in a transaction
f03ab76 checkpatch: colorize output to terminal
81e9bae checkpatch: improve handling of multiple patches or files
7bf3d1c checkpatch: check Signed-off-by in --mailback mode
c91e369 checkpatch: fix premature exit when no input or --mailback 15ea796 vhost-user-bridge: fix "unknown type name" compilation error c837fd5 accel: Improve selection of the default accelerator
=== OUTPUT BEGIN ===
Checking PATCH 1/54: accel: Improve selection of the default accelerator... Checking PATCH 2/54: vhost-user-bridge: fix "unknown type name" compilation error... Checking PATCH 3/54: checkpatch: fix premature exit when no input or --mailback... Checking PATCH 4/54: checkpatch: check Signed-off-by in --mailback mode... Checking PATCH 5/54: checkpatch: improve handling of multiple patches or files...
ERROR: line over 90 characters
#33: FILE: scripts/checkpatch.pl:345:
+ open($HASH, "-|", "git", "log", "--reverse", "--no-merges", "--format=%H %s", $ARGV[0]) ||
ERROR: line over 90 characters
#34: FILE: scripts/checkpatch.pl:346:
+ die "$P: git log --reverse --no-merges --format='%H %s' $ARGV[0] failed - $!\n";
WARNING: line over 80 characters
#65: FILE: scripts/checkpatch.pl:373:
+ $vname = substr($hash, 0, 12) . ' (' . $git_commits{$hash} . ')';
total: 2 errors, 1 warnings, 62 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 6/54: checkpatch: colorize output to terminal... Checking PATCH 7/54: pam: wrap MemoryRegion initialization in a transaction... Checking PATCH 8/54: memory: extract flat_range_coalesced_io_{del, add}... Checking PATCH 9/54: memory: avoid unnecessary coalesced_io_del operations... Checking PATCH 10/54: memory: update coalesced_range on transaction_commit... Checking PATCH 11/54: hax: Support for Linux hosts...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #62:
rename from target/i386/hax-darwin.c
total: 0 errors, 1 warnings, 31 lines checked
Your patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 12/54: block/iscsi: drop unused IscsiAIOCB->buf field...
Checking PATCH 13/54: block/iscsi: take iscsilun->mutex in iscsi_timed_check_events()... Checking PATCH 14/54: block/iscsi: fix ioctl cancel use-after-free...
Checking PATCH 15/54: block/iscsi: cancel libiscsi task when ABORT TASK TMF completes... Checking PATCH 16/54: esp-pci: Fix status register write erase control...
Checking PATCH 17/54: scsi: esp: Defer command completion until previous interrupts have been handled... Checking PATCH 18/54: build-sys: don't include windows.h, osdep.h does it...
Checking PATCH 19/54: build-sys: move windows defines in osdep.h header...
WARNING: architecture specific defines should be avoided
#61: FILE: include/qemu/osdep.h:96:
+#ifdef __MINGW32__
total: 0 errors, 1 warnings, 39 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 20/54: build-sys: build with Vista API by default... Checking PATCH 21/54: RFC: qga: drop < Vista compatibility... Checking PATCH 22/54: test: execute g_test_run when tests are skipped... Checking PATCH 23/54: test: replace gtester with a TAP driver...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #25:
deleted file mode 100755
total: 0 errors, 1 warnings, 618 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 24/54: compiler.h: Add an explicit check for the compiler version... Checking PATCH 25/54: qemu/queue.h: do not access tqe_prev directly... Checking PATCH 26/54: vfio: make vfio_address_spaces static...
Checking PATCH 27/54: qemu/queue.h: leave head structs anonymous unless necessary... Checking PATCH 28/54: qemu/queue.h: typedef QTAILQ heads...
Checking PATCH 29/54: qemu/queue.h: remove Q_TAILQ_{HEAD, ENTRY}... Checking PATCH 30/54: qemu/queue.h: reimplement QTAILQ without pointer-to-pointers...
WARNING: line over 80 characters
#176: FILE: include/qemu/queue.h:451:
+#define QTAILQ_IN_USE(elm, field) ((elm)->field.tqe_circ.tql_prev != NULL)
WARNING: line over 80 characters
#185: FILE: include/qemu/queue.h:458:
+ ((typeof((elm)->field.tqe_next)) QTAILQ_LINK_PREV((elm)->field.tqe_circ))
WARNING: line over 80 characters
#257: FILE: include/qemu/queue.h:489:
+#define QTAILQ_RAW_INSERT_TAIL(head, elm, entry) do { \
WARNING: line over 80 characters
#258: FILE: include/qemu/queue.h:490:
+ *QTAILQ_RAW_NEXT(elm, entry) = NULL; \
WARNING: line over 80 characters
#259: FILE: include/qemu/queue.h:491:
+ QTAILQ_RAW_TQE_CIRC(elm, entry)->tql_prev = QTAILQ_RAW_TQH_CIRC(head)->tql_prev; \
WARNING: line over 80 characters
#260: FILE: include/qemu/queue.h:492:
+ QTAILQ_RAW_TQH_CIRC(head)->tql_prev->tql_next = (elm); \
WARNING: line over 80 characters
#261: FILE: include/qemu/queue.h:493:
+ QTAILQ_RAW_TQH_CIRC(head)->tql_prev = QTAILQ_RAW_TQE_CIRC(elm, entry); \
WARNING: line over 80 characters
#336: FILE: include/qemu/rcu_queue.h:251:
+ atomic_set(&(elm)->field.tqe_circ.tql_prev->tql_next, (elm)->field.tqe_next); \
total: 0 errors, 8 warnings, 315 lines checked
Your patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 31/54: qemu/queue.h: simplify reverse access to QTAILQ...
Checking PATCH 32/54: checkpatch: warn about qemu/queue.h head structs that are not typedef-ed...
WARNING: line over 80 characters
#21: FILE: scripts/checkpatch.pl:2266:
+ if ($line =~ /^.\s*(Q(?:S?LIST|SIMPLEQ|TAILQ)_HEAD)\s*\(\s*[^,]/ &&
WARNING: line over 80 characters
#23: FILE: scripts/checkpatch.pl:2268:
+ ERROR("named $1 should be typedefed separately\n" . $herecurr);
total: 0 errors, 2 warnings, 11 lines checked
Your patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 33/54: configure: Add a test for the minimum compiler version... Checking PATCH 34/54: configure: Remove obsolete check for Clang < 3.2...
Checking PATCH 35/54: configure: Remove old -fno-gcse workaround for GCC 4.6.x and 4.7.[012]... Checking PATCH 36/54: tcg/tcg.h: Remove GCC check for tcg_debug_assert() macro... Checking PATCH 37/54: audio/alsaaudio: Remove compiler check around pragma...
Checking PATCH 38/54: includes: Replace QEMU_GNUC_PREREQ with "__has_builtin || !defined(__clang__)"...
WARNING: architecture specific defines should be avoided
#25: FILE: include/qemu/compiler.h:138:
+#if __has_builtin(__builtin_assume_aligned) || !defined(__clang__)
WARNING: architecture specific defines should be avoided #38: FILE: include/qemu/host-utils.h:210:
+#if __has_builtin(__builtin_clrsb) || !defined(__clang__)
WARNING: architecture specific defines should be avoided #47: FILE: include/qemu/host-utils.h:226:
+#if __has_builtin(__builtin_clrsbll) || !defined(__clang__)
total: 0 errors, 3 warnings, 24 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 39/54: Remove QEMU_ARTIFICIAL macro...
Checking PATCH 40/54: hw/watchdog/wdt_i6300esb : remove a unnecessary comment... Checking PATCH 41/54: vhost-net: move stubs to a separate file...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #41:
new file mode 100644
total: 0 errors, 1 warnings, 112 lines checked
Your patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 42/54: vhost-net-user: add stubs for when no virtio-net device is present...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #102:
new file mode 100644
total: 0 errors, 1 warnings, 75 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 43/54: vhost: restrict Linux dependency to kernel vhost... Checking PATCH 44/54: vhost-net: compile it on all targets that have virtio-net.... Checking PATCH 45/54: vhost-net: revamp configure logic...
Checking PATCH 46/54: vhost-user-test: use g_cond_broadcast... Checking PATCH 47/54: vhost-user-test: signal data_cond when s->rings changes... Checking PATCH 48/54: vhost-user: support cross-endian vnet headers... Checking PATCH 49/54: vhost-user-test: support VHOST_USER_PROTOCOL_F_CROSS_ENDIAN... Checking PATCH 50/54: vhost-user-test: skip if there is no memory at address 0... Checking PATCH 51/54: vhost-user-test: reduce usage of global_qtest...
WARNING: line over 80 characters
#27: FILE: tests/vhost-user-test.c:190:
+static void init_virtio_dev(QTestState *qts, TestServer *s, uint32_t features_mask)
WARNING: line over 80 characters
#60: FILE: tests/vhost-user-test.c:296:
+ uint32_t a = qtest_readb(qts, s->memory.regions[i].guest_phys_addr + j);
total: 0 errors, 2 warnings, 132 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 52/54: vhost-user-test: create a main loop per TestServer... Checking PATCH 53/54: vhost-user-test: small changes to init_hugepagefs... Checking PATCH 54/54: vhost-user-test: create a temporary directory per TestServer... === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]