Skip to contentSkip to conversation

Block and testing patches

GIT PULL Applied Fam Zheng 2 participants 21 messages Aug 15, 2018 – Aug 16, 2018 Block layer

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

The following changes since commit 38441756b70eec5807b5f60dad11a93a91199866:

Update version for v3.0.0 release (2018-08-14 16:38:43 +0100)

are available in the Git repository at:

git://github.com/famz/qemu.git tags/block-and-testing-pull-request

for you to fetch changes up to 37a81812f7b8367422a039eb09d915df543983ee:

aio-posix: Improve comment around marking node deleted (2018-08-15 10:12:35 +0800)

----------------------------------------------------------------
Block and testing patches for 3.1

- aio fixes by me
- nvme fixes by Paolo and me
- test improvements by Peter, Phil and me

----------------------------------------------------------------

Fam Zheng (10):
nvme: Fix nvme_init error handling
aio-posix: Don't count ctx->notifier as progress when polling
aio: Do aio_notify_accept only during blocking aio_poll
docker: Install more packages in centos7
tests: Add an option for snapshot (default: off)
tests: Allow overriding archive path with SRC_ARCHIVE
tests: Add centos VM testing
tests: vm: Add vm-clean-all
tests/vm: Add vm-build-all/vm-clean-all in help text
aio-posix: Improve comment around marking node deleted

Paolo Bonzini (1):
nvme: simplify plug/unplug

Peter Maydell (4):
tests/vm: Pass the jobs parallelism setting to 'make check' tests/vm: Propagate V=1 down into the make inside the VM tests/vm: Bump guest RAM up from 2G to 4G tests/vm: Use make's --output-sync option

Philippe Mathieu-Daudé (2):
tests/vm: Only use -cpu 'host' if KVM is available tests/vm: Add flex and bison to the vm image

 block/nvme.c                            | 57 +++++++----------
 docs/devel/testing.rst                  |  1 +
 tests/docker/Makefile.include           |  7 ++-
 tests/docker/dockerfiles/centos7.docker |  3 +
 tests/vm/Makefile.include               | 12 +++-
 tests/vm/basevm.py                      | 17 +++--
 tests/vm/centos                         | 84 +++++++++++++++++++++++++
 tests/vm/freebsd                        |  4 +-
 tests/vm/netbsd                         |  4 +-
 tests/vm/openbsd                        |  4 +-
 tests/vm/ubuntu.i386                    |  6 +-
 util/aio-posix.c                        |  9 +--
 util/aio-win32.c                        |  3 +-
 13 files changed, 154 insertions(+), 57 deletions(-)
 create mode 100755 tests/vm/centos
Signature · 1 line
2.17.1
author
#1 lore raw

[Qemu-devel] [PULL 01/17] tests/vm: Only use -cpu 'host' if KVM is available

From: Philippe Mathieu-Daudé <[email protected]>

If KVM is not available, then use the 'max' cpu.

This fixes:

ERROR:root:Log:
ERROR:root:qemu-system-x86_64: CPU model 'host' requires KVM
Failed to prepare guest environment
error: [Errno 104] Connection reset by peer source/qemu/tests/vm/Makefile.include:25: recipe for target 'tests/vm/ubuntu.i386.img' failed
make: *** [tests/vm/ubuntu.i386.img] Error 2

Message-Id: <[email protected]>

---
 tests/vm/basevm.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/vm/basevm.py +2 -1
index 3643117816..d80cc8ab85 100755
@@ -65,7 +65,6 @@ class BaseVM(object):
             self._stdout = self._devnull
         self._args = [ \
             "-nodefaults", "-m", "2G",
-            "-cpu", "host",
             "-netdev", "user,id=vnet,hostfwd=:127.0.0.1:0-:22",
             "-device", "virtio-net-pci,netdev=vnet",
             "-vnc", "127.0.0.1:0,to=20",
@@ -73,9 +72,11 @@ class BaseVM(object):
         if vcpus:
             self._args += ["-smp", str(vcpus)]
         if os.access("/dev/kvm", os.R_OK | os.W_OK):
+            self._args += ["-cpu", "host"]
             self._args += ["-enable-kvm"]
         else:
             logging.info("KVM not available, not using -enable-kvm")
+            self._args += ["-cpu", "max"]
         self._data_args = []
 
     def _download_with_cache(self, url, sha256sum=None):
Signature · 1 line
2.17.1
author
#2 lore raw

[Qemu-devel] [PULL 02/17] tests/vm: Add flex and bison to the vm image

In reply to Fam Zheng

From: Philippe Mathieu-Daudé <[email protected]>

Similar to 79f24568e5e70, this fixes the following warnings:

CHK version_gen.h
LEX convert-dtsv0-lexer.lex.c
make[1]: flex: Command not found
BISON dtc-parser.tab.c
make[1]: bison: Command not found
LEX dtc-lexer.lex.c
make[1]: flex: Command not found

Message-Id: <[email protected]>

---
 tests/vm/ubuntu.i386 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/vm/ubuntu.i386 +1 -1
index fc319e0e6e..fc27b6935e 100755
@@ -77,7 +77,7 @@ class UbuntuX86VM(basevm.BaseVM):
         # The previous update sometimes doesn't survive a reboot, so do it again
         self.ssh_root_check("apt-get update")
         self.ssh_root_check("apt-get build-dep -y qemu")
-        self.ssh_root_check("apt-get install -y libfdt-dev")
+        self.ssh_root_check("apt-get install -y libfdt-dev flex bison")
         self.ssh_root("poweroff")
         self.wait()
         if os.path.exists(img):
Signature · 1 line
2.17.1
author
#3 lore raw

[Qemu-devel] [PULL 03/17] nvme: Fix nvme_init error handling

In reply to Fam Zheng

It is wrong to leave this field as 1, as nvme_close() called in the error handling code in nvme_file_open() will use it and try to free s->queues again.

Another problem is the cleaning ups are duplicated between the fail* labels of nvme_init() and nvme_file_open(), which calls nvme_close().

A third problem is nvme_close() misses g_free() and event_notifier_cleanup().

Fix all of them.

Message-Id: <[email protected]>

---
 block/nvme.c | 37 ++++++++++++-------------------------
 1 file changed, 12 insertions(+), 25 deletions(-)
block/nvme.c +12 -25
index 6f71122bf5..37805e8890 100644
@@ -569,13 +569,13 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
     s->vfio = qemu_vfio_open_pci(device, errp);
     if (!s->vfio) {
         ret = -EINVAL;
-        goto fail;
+        goto out;
     }
 
     s->regs = qemu_vfio_pci_map_bar(s->vfio, 0, 0, NVME_BAR_SIZE, errp);
     if (!s->regs) {
         ret = -EINVAL;
-        goto fail;
+        goto out;
     }
 
     /* Perform initialize sequence as described in NVMe spec "7.6.1
@@ -585,7 +585,7 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
     if (!(cap & (1ULL << 37))) {
         error_setg(errp, "Device doesn't support NVMe command set");
         ret = -EINVAL;
-        goto fail;
+        goto out;
     }
 
     s->page_size = MAX(4096, 1 << (12 + ((cap >> 48) & 0xF)));
@@ -603,7 +603,7 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
                              PRId64 " ms)",
                        timeout_ms);
             ret = -ETIMEDOUT;
-            goto fail;
+            goto out;
         }
     }
 
@@ -613,7 +613,7 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
     s->queues[0] = nvme_create_queue_pair(bs, 0, NVME_QUEUE_SIZE, errp);
     if (!s->queues[0]) {
         ret = -EINVAL;
-        goto fail;
+        goto out;
     }
     QEMU_BUILD_BUG_ON(NVME_QUEUE_SIZE & 0xF000);
     s->regs->aqa = cpu_to_le32((NVME_QUEUE_SIZE << 16) | NVME_QUEUE_SIZE);
@@ -633,14 +633,14 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
                              PRId64 " ms)",
                        timeout_ms);
             ret = -ETIMEDOUT;
-            goto fail_queue;
+            goto out;
         }
     }
 
     ret = qemu_vfio_pci_init_irq(s->vfio, &s->irq_notifier,
                                  VFIO_PCI_MSIX_IRQ_INDEX, errp);
     if (ret) {
-        goto fail_queue;
+        goto out;
     }
     aio_set_event_notifier(bdrv_get_aio_context(bs), &s->irq_notifier,
                            false, nvme_handle_event, nvme_poll_cb);
@@ -649,30 +649,15 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
     if (local_err) {
         error_propagate(errp, local_err);
         ret = -EIO;
-        goto fail_handler;
+        goto out;
     }
 
     /* Set up command queues. */
     if (!nvme_add_io_queue(bs, errp)) {
         ret = -EIO;
-        goto fail_handler;
     }
-    return 0;
-
-fail_handler:
-    aio_set_event_notifier(bdrv_get_aio_context(bs), &s->irq_notifier,
-                           false, NULL, NULL);
-fail_queue:
-    nvme_free_queue_pair(bs, s->queues[0]);
-fail:
-    g_free(s->queues);
-    if (s->regs) {
-        qemu_vfio_pci_unmap_bar(s->vfio, 0, (void *)s->regs, 0, NVME_BAR_SIZE);
-    }
-    if (s->vfio) {
-        qemu_vfio_close(s->vfio);
-    }
-    event_notifier_cleanup(&s->irq_notifier);
+out:
+    /* Cleaning up is done in nvme_file_open() upon error. */
     return ret;
 }
 
@@ -739,8 +724,10 @@ static void nvme_close(BlockDriverState *bs)
     for (i = 0; i < s->nr_queues; ++i) {
         nvme_free_queue_pair(bs, s->queues[i]);
     }
+    g_free(s->queues);
     aio_set_event_notifier(bdrv_get_aio_context(bs), &s->irq_notifier,
                            false, NULL, NULL);
+    event_notifier_cleanup(&s->irq_notifier);
     qemu_vfio_pci_unmap_bar(s->vfio, 0, (void *)s->regs, 0, NVME_BAR_SIZE);
     qemu_vfio_close(s->vfio);
 }
Signature · 1 line
2.17.1
author
#4 lore raw

[Qemu-devel] [PULL 04/17] nvme: simplify plug/unplug

In reply to Fam Zheng

From: Paolo Bonzini <[email protected]>

bdrv_io_plug/bdrv_io_unplug take care of keeping a nesting count, so change s->plugged to just a bool.

Message-Id: <[email protected]>

---
 block/nvme.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
block/nvme.c +10 -10
index 37805e8890..781d77d6d2 100644
@@ -104,7 +104,7 @@ typedef struct {
     uint64_t nsze; /* Namespace size reported by identify command */
     int nsid;      /* The namespace id to read/write data. */
     uint64_t max_transfer;
-    int plugged;
+    bool plugged;
 
     CoMutex dma_map_lock;
     CoQueue dma_flush_queue;
@@ -1101,7 +1101,8 @@ static void nvme_attach_aio_context(BlockDriverState *bs,
 static void nvme_aio_plug(BlockDriverState *bs)
 {
     BDRVNVMeState *s = bs->opaque;
-    s->plugged++;
+    assert(!s->plugged);
+    s->plugged = true;
 }
 
 static void nvme_aio_unplug(BlockDriverState *bs)
@@ -1109,14 +1110,13 @@ static void nvme_aio_unplug(BlockDriverState *bs)
     int i;
     BDRVNVMeState *s = bs->opaque;
     assert(s->plugged);
-    if (!--s->plugged) {
-        for (i = 1; i < s->nr_queues; i++) {
-            NVMeQueuePair *q = s->queues[i];
-            qemu_mutex_lock(&q->lock);
-            nvme_kick(s, q);
-            nvme_process_completion(s, q);
-            qemu_mutex_unlock(&q->lock);
-        }
+    s->plugged = false;
+    for (i = 1; i < s->nr_queues; i++) {
+        NVMeQueuePair *q = s->queues[i];
+        qemu_mutex_lock(&q->lock);
+        nvme_kick(s, q);
+        nvme_process_completion(s, q);
+        qemu_mutex_unlock(&q->lock);
     }
 }
 
Signature · 1 line
2.17.1
author
#5 lore raw

[Qemu-devel] [PULL 05/17] aio-posix: Don't count ctx->notifier as progress when polling

In reply to Fam Zheng

The same logic exists in fd polling. This change is especially important to avoid busy loop once we limit aio_notify_accept() to blocking aio_poll().

Message-Id: <[email protected]>

---
 util/aio-posix.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
util/aio-posix.c +2 -1
index 118bf5784b..b5c7f463aa 100644
@@ -494,7 +494,8 @@ static bool run_poll_handlers_once(AioContext *ctx)
     QLIST_FOREACH_RCU(node, &ctx->aio_handlers, node) {
         if (!node->deleted && node->io_poll &&
             aio_node_check(ctx, node->is_external) &&
-            node->io_poll(node->opaque)) {
+            node->io_poll(node->opaque) &&
+            node->opaque != &ctx->notifier) {
             progress = true;
         }
 
Signature · 1 line
2.17.1
author
#6 lore raw

[Qemu-devel] [PULL 06/17] aio: Do aio_notify_accept only during blocking aio_poll

In reply to Fam Zheng

An aio_notify() pairs with an aio_notify_accept(). The former should happen in the main thread or a vCPU thread, and the latter should be done in the IOThread.

There is one rare case that the main thread or vCPU thread may "steal" the aio_notify() event just raised by itself, in bdrv_set_aio_context() [1]. The sequence is like this:

    main thread                     IO Thread
    ===============================================================
    bdrv_drained_begin()
      aio_disable_external(ctx)
                                    aio_poll(ctx, true)
                                      ctx->notify_me += 2
    ...
    bdrv_drained_end()
      ...
        aio_notify()
    ...
    bdrv_set_aio_context()
      aio_poll(ctx, false)
[1]     aio_notify_accept(ctx)
                                      ppoll() /* Hang! */

[1] is problematic. It will clear the ctx->notifier event so that the blocked ppoll() will not return.

(For the curious, this bug was noticed when booting a number of VMs simultaneously in RHV. One or two of the VMs will hit this race condition, making the VIRTIO device unresponsive to I/O commands. When it hangs, Seabios is busy waiting for a read request to complete (read MBR), right after initializing the virtio-blk-pci device, using 100% guest CPU. See also https://bugzilla.redhat.com/show_bug.cgi?id=1562750
for the original bug analysis.)

aio_notify() only injects an event when ctx->notify_me is set, correspondingly aio_notify_accept() is only useful when ctx->notify_me _was_ set. Move the call to it into the "blocking" branch. This will effectively skip [1] and fix the hang.

Furthermore, blocking aio_poll is only allowed on home thread (in_aio_context_home_thread), because otherwise two blocking aio_poll()'s can steal each other's ctx->notifier event and cause hanging just like described above.

Message-Id: <[email protected]>

---
 util/aio-posix.c | 4 ++--
 util/aio-win32.c | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
util/aio-posix.c +2 -2
index b5c7f463aa..b5c609b68b 100644
@@ -591,6 +591,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
      * so disable the optimization now.
      */
     if (blocking) {
+        assert(in_aio_context_home_thread(ctx));
         atomic_add(&ctx->notify_me, 2);
     }
 
@@ -633,6 +634,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
 
     if (blocking) {
         atomic_sub(&ctx->notify_me, 2);
+        aio_notify_accept(ctx);
     }
 
     /* Adjust polling time */
@@ -676,8 +678,6 @@ bool aio_poll(AioContext *ctx, bool blocking)
         }
     }
 
-    aio_notify_accept(ctx);
-
     /* if we have any readable fds, dispatch event */
     if (ret > 0) {
         for (i = 0; i < npfd; i++) {
util/aio-win32.c +2 -1
index e676a8d9b2..c58957cc4b 100644
@@ -373,11 +373,12 @@ bool aio_poll(AioContext *ctx, bool blocking)
         ret = WaitForMultipleObjects(count, events, FALSE, timeout);
         if (blocking) {
             assert(first);
+            assert(in_aio_context_home_thread(ctx));
             atomic_sub(&ctx->notify_me, 2);
+            aio_notify_accept(ctx);
         }
 
         if (first) {
-            aio_notify_accept(ctx);
             progress |= aio_bh_poll(ctx);
             first = false;
         }
Signature · 1 line
2.17.1
author
#7 lore raw

[Qemu-devel] [PULL 07/17] docker: Install more packages in centos7

In reply to Fam Zheng

This makes test-block work.

Message-Id: <[email protected]>

---
 tests/docker/dockerfiles/centos7.docker | 3 +++
 1 file changed, 3 insertions(+)
tests/docker/dockerfiles/centos7.docker +3 -0
index 575de29a0a..83462b7205 100644
@@ -3,6 +3,7 @@ RUN yum install -y epel-release centos-release-xen
 RUN yum -y update
 ENV PACKAGES \
     bison \
+    bzip2 \
     bzip2-devel \
     ccache \
     csnappy-devel \
@@ -12,10 +13,12 @@ ENV PACKAGES \
     gettext \
     git \
     glib2-devel \
+    libaio-devel \
     libepoxy-devel \
     libfdt-devel \
     librdmacm-devel \
     lzo-devel \
+    nettle-devel \
     make \
     mesa-libEGL-devel \
     mesa-libgbm-devel \
Signature · 1 line
2.17.1
author
#8 lore raw

[Qemu-devel] [PULL 08/17] tests: Add an option for snapshot (default: off)

In reply to Fam Zheng

Not using snapshot has the benefit of automatically persisting useful test harnesses, such as docker images and ccache database. Although it will lose some cleanness, it is imaginably useful for patchew.

Message-Id: <[email protected]>

---
 tests/vm/basevm.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tests/vm/basevm.py +6 -1
index d80cc8ab85..1f1579dc9a 100755
@@ -217,6 +217,8 @@ def parse_args(vm_name):
                       help="build QEMU from source in guest")
     parser.add_option("--interactive", "-I", action="store_true",
                       help="Interactively run command")
+    parser.add_option("--snapshot", "-s", action="store_true",
+                      help="run tests with a snapshot")
     parser.disable_interspersed_args()
     return parser.parse_args()
 
@@ -242,7 +244,10 @@ def main(vmcls):
                    jobs=args.jobs)]
         else:
             cmd = argv
-        vm.boot(args.image + ",snapshot=on")
+        img = args.image
+        if args.snapshot:
+            img += ",snapshot=on"
+        vm.boot(img)
         vm.wait_ssh()
     except Exception as e:
         if isinstance(e, SystemExit) and e.code == 0:
Signature · 1 line
2.17.1
author
#9 lore raw

[Qemu-devel] [PULL 09/17] tests: Allow overriding archive path with SRC_ARCHIVE

In reply to Fam Zheng

In VM based tests, the source archive is created in host, we don't have to run archive-source.sh again, as it complicates the Makefile and scripts.

Message-Id: <[email protected]>

---
 tests/docker/Makefile.include | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tests/docker/Makefile.include +5 -2
index 1aaa795743..d3101afecd 100644
@@ -27,8 +27,11 @@ DOCKER_SRC_COPY := $(BUILD_DIR)/docker-src.$(CUR_TIME)
 
 $(DOCKER_SRC_COPY):
 	@mkdir $@
-	$(call quiet-command, cd $(SRC_PATH) && scripts/archive-source.sh $@/qemu.tar, \
-		"GEN", "$@/qemu.tar")
+	$(if $(SRC_ARCHIVE), \
+		$(call quiet-command, cp "$(SRC_ARCHIVE)" $@/qemu.tar, \
+			"CP", "$@/qemu.tar"), \
+		$(call quiet-command, cd $(SRC_PATH) && scripts/archive-source.sh $@/qemu.tar, \
+			"GEN", "$@/qemu.tar"))
 	$(call quiet-command, cp $(SRC_PATH)/tests/docker/run $@/run, \
 		"COPY","RUNNER")
 
Signature · 1 line
2.17.1
author
#10 lore raw

[Qemu-devel] [PULL 10/17] tests: Add centos VM testing

In reply to Fam Zheng

This one does docker testing in the VM. It is intended to replace the native docker testing on patchew testers.

Message-Id: <[email protected]>

---
 tests/vm/Makefile.include |  3 +-
 tests/vm/centos           | 84 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 86 insertions(+), 1 deletion(-)
 create mode 100755 tests/vm/centos
tests/vm/Makefile.include +2 -1
index 5daa2a3b73..af19b7a4e6 100644
@@ -2,7 +2,7 @@
 
 .PHONY: vm-build-all
 
-IMAGES := ubuntu.i386 freebsd netbsd openbsd
+IMAGES := ubuntu.i386 freebsd netbsd openbsd centos
 IMAGE_FILES := $(patsubst %, tests/vm/%.img, $(IMAGES))
 
 .PRECIOUS: $(IMAGE_FILES)
@@ -14,6 +14,7 @@ vm-test:
 	@echo "  vm-build-freebsd                - Build QEMU in FreeBSD VM"
 	@echo "  vm-build-netbsd                 - Build QEMU in NetBSD VM"
 	@echo "  vm-build-openbsd                - Build QEMU in OpenBSD VM"
+	@echo "  vm-build-centos                 - Build QEMU in CentOS VM, with Docker"
 
 vm-build-all: $(addprefix vm-build-, $(IMAGES))
 
tests/vm/centos new file +84 -0

84 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#11 lore raw

[Qemu-devel] [PULL 11/17] tests: vm: Add vm-clean-all

In reply to Fam Zheng

The images are big. Add a rule to clean up easily.

Message-Id: <[email protected]>

---
 tests/vm/Makefile.include | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tests/vm/Makefile.include +4 -1
index af19b7a4e6..a5abb569c5 100644
@@ -1,6 +1,6 @@
 # Makefile for VM tests
 
-.PHONY: vm-build-all
+.PHONY: vm-build-all vm-clean-all
 
 IMAGES := ubuntu.i386 freebsd netbsd openbsd centos
 IMAGE_FILES := $(patsubst %, tests/vm/%.img, $(IMAGES))
@@ -18,6 +18,9 @@ vm-test:
 
 vm-build-all: $(addprefix vm-build-, $(IMAGES))
 
+vm-clean-all:
+	rm -f $(IMAGE_FILES)
+
 tests/vm/%.img: $(SRC_PATH)/tests/vm/% \
 		$(SRC_PATH)/tests/vm/basevm.py \
 		$(SRC_PATH)/tests/vm/Makefile.include
Signature · 1 line
2.17.1
author
#12 lore raw

[Qemu-devel] [PULL 12/17] tests/vm: Pass the jobs parallelism setting to 'make check'

In reply to Fam Zheng

From: Peter Maydell <[email protected]>

Our test suite works for parallel execution too, and this can noticeably speed up a test run; pass the 'jobs' setting to it as well as to the build proper.

Message-Id: <[email protected]>

---
 tests/vm/freebsd     | 2 +-
 tests/vm/netbsd      | 2 +-
 tests/vm/openbsd     | 2 +-
 tests/vm/ubuntu.i386 | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
tests/vm/freebsd +1 -1
index 039dad8f69..2187a17327 100755
@@ -24,7 +24,7 @@ class FreeBSDVM(basevm.BaseVM):
         tar -xf /dev/vtbd1;
         ./configure {configure_opts};
         gmake -j{jobs};
-        gmake check;
+        gmake -j{jobs} check;
     """
 
     def build_image(self, img):
tests/vm/netbsd +1 -1
index 3972d8b45c..2cc4798f0c 100755
@@ -24,7 +24,7 @@ class NetBSDVM(basevm.BaseVM):
         tar -xf /dev/rld1a;
         ./configure --python=python2.7 {configure_opts};
         gmake -j{jobs};
-        gmake check;
+        gmake -j{jobs} check;
     """
 
     def build_image(self, img):
tests/vm/openbsd +1 -1
index 6ae16d97fd..df6b79fe7d 100755
@@ -25,7 +25,7 @@ class OpenBSDVM(basevm.BaseVM):
         ./configure --cc=x86_64-unknown-openbsd6.1-gcc-4.9.4 --python=python2.7 {configure_opts};
         gmake -j{jobs};
         # XXX: "gmake check" seems to always hang or fail
-        #gmake check;
+        #gmake -j{jobs} check;
     """
 
     def build_image(self, img):
tests/vm/ubuntu.i386 +1 -1
index fc27b6935e..2498fc7570 100755
@@ -26,7 +26,7 @@ class UbuntuX86VM(basevm.BaseVM):
         tar -xf /dev/vdb;
         ./configure {configure_opts};
         make -j{jobs};
-        make check;
+        make -j{jobs} check;
     """
 
     def _gen_cloud_init_iso(self):
Signature · 1 line
2.17.1
author
#13 lore raw

[Qemu-devel] [PULL 13/17] tests/vm: Propagate V=1 down into the make inside the VM

In reply to Fam Zheng

From: Peter Maydell <[email protected]>

Invoking 'make vm-build-freebsd' and friends with V=1 should propagate that verbosity setting down into the build run inside the VM. Make sure we do that. This brings it into line with how the container tests handle V=1.

Message-Id: <[email protected]>

---
 docs/devel/testing.rst    | 1 +
 tests/vm/Makefile.include | 1 +
 tests/vm/basevm.py        | 5 ++++-
 tests/vm/freebsd          | 4 ++--
 tests/vm/netbsd           | 4 ++--
 tests/vm/openbsd          | 4 ++--
 tests/vm/ubuntu.i386      | 2 +-
 7 files changed, 13 insertions(+), 8 deletions(-)
docs/devel/testing.rst +1 -0
index 8e1fa3a66e..727c4019b5 100644
@@ -434,6 +434,7 @@ Debugging
 
 Add ``DEBUG=1`` and/or ``V=1`` to the make command to allow interactive
 debugging and verbose output. If this is not enough, see the next section.
+``V=1`` will be propagated down into the make jobs in the guest.
 
 Manual invocation
 -----------------
tests/vm/Makefile.include +1 -0
index a5abb569c5..76f416286e 100644
@@ -40,6 +40,7 @@ vm-build-%: tests/vm/%.img
 		$(if $(V)$(DEBUG), --debug) \
 		$(if $(DEBUG), --interactive) \
 		$(if $(J),--jobs $(J)) \
+		$(if $(V),--verbose) \
 		--image "$<" \
 		--build-qemu $(SRC_PATH), \
 		"  VM-BUILD $*")
tests/vm/basevm.py +4 -1
index 1f1579dc9a..d73cba9edb 100755
@@ -211,6 +211,8 @@ def parse_args(vm_name):
                       help="force build image even if image exists")
     parser.add_option("--jobs", type=int, default=multiprocessing.cpu_count() / 2,
                       help="number of virtual CPUs")
+    parser.add_option("--verbose", "-V", action="store_true",
+                      help="Pass V=1 to builds within the guest")
     parser.add_option("--build-image", "-b", action="store_true",
                       help="build image")
     parser.add_option("--build-qemu",
@@ -241,7 +243,8 @@ def main(vmcls):
             vm.add_source_dir(args.build_qemu)
             cmd = [vm.BUILD_SCRIPT.format(
                    configure_opts = " ".join(argv),
-                   jobs=args.jobs)]
+                   jobs=args.jobs,
+                   verbose = "V=1" if args.verbose else "")]
         else:
             cmd = argv
         img = args.image
tests/vm/freebsd +2 -2
index 2187a17327..795f739c7b 100755
@@ -23,8 +23,8 @@ class FreeBSDVM(basevm.BaseVM):
         cd $(mktemp -d /var/tmp/qemu-test.XXXXXX);
         tar -xf /dev/vtbd1;
         ./configure {configure_opts};
-        gmake -j{jobs};
-        gmake -j{jobs} check;
+        gmake -j{jobs} {verbose};
+        gmake -j{jobs} check {verbose};
     """
 
     def build_image(self, img):
tests/vm/netbsd +2 -2
index 2cc4798f0c..c211672bcb 100755
@@ -23,8 +23,8 @@ class NetBSDVM(basevm.BaseVM):
         cd $(mktemp -d /var/tmp/qemu-test.XXXXXX);
         tar -xf /dev/rld1a;
         ./configure --python=python2.7 {configure_opts};
-        gmake -j{jobs};
-        gmake -j{jobs} check;
+        gmake -j{jobs} {verbose};
+        gmake -j{jobs} check {verbose};
     """
 
     def build_image(self, img):
tests/vm/openbsd +2 -2
index df6b79fe7d..1e0c2500ad 100755
@@ -23,9 +23,9 @@ class OpenBSDVM(basevm.BaseVM):
         cd $(mktemp -d /var/tmp/qemu-test.XXXXXX);
         tar -xf /dev/rsd1c;
         ./configure --cc=x86_64-unknown-openbsd6.1-gcc-4.9.4 --python=python2.7 {configure_opts};
-        gmake -j{jobs};
+        gmake -j{jobs} {verbose};
         # XXX: "gmake check" seems to always hang or fail
-        #gmake -j{jobs} check;
+        #gmake -j{jobs} check {verbose};
     """
 
     def build_image(self, img):
tests/vm/ubuntu.i386 +1 -1
index 2498fc7570..160b9be034 100755
@@ -26,7 +26,7 @@ class UbuntuX86VM(basevm.BaseVM):
         tar -xf /dev/vdb;
         ./configure {configure_opts};
         make -j{jobs};
-        make -j{jobs} check;
+        make check -j{jobs} {verbose};
     """
 
     def _gen_cloud_init_iso(self):
Signature · 1 line
2.17.1
author
#14 lore raw

[Qemu-devel] [PULL 14/17] tests/vm: Bump guest RAM up from 2G to 4G

In reply to Fam Zheng

From: Peter Maydell <[email protected]>

Currently we run the guests in a VM which is given only 2G of RAM. Since the guests are configured without any swap space, builds can fail because the system runs out of memory and kills the compiler, especially if the job count is set for a lot of parallelism. Bump the setting up from 2G to 4G to give us some more headroom.

Message-Id: <[email protected]>

---
 tests/vm/basevm.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/vm/basevm.py +1 -1
index d73cba9edb..d7149dea7d 100755
@@ -64,7 +64,7 @@ class BaseVM(object):
         else:
             self._stdout = self._devnull
         self._args = [ \
-            "-nodefaults", "-m", "2G",
+            "-nodefaults", "-m", "4G",
             "-netdev", "user,id=vnet,hostfwd=:127.0.0.1:0-:22",
             "-device", "virtio-net-pci,netdev=vnet",
             "-vnc", "127.0.0.1:0,to=20",
Signature · 1 line
2.17.1
author
#15 lore raw

[Qemu-devel] [PULL 15/17] tests/vm: Use make's --output-sync option

In reply to Fam Zheng

From: Peter Maydell <[email protected]>

Use make's --output-sync option when running tests inside VMs, so that if we're building with parallelization the output doesn't get scrambled.

Message-Id: <[email protected]>

---
 tests/vm/freebsd     | 4 ++--
 tests/vm/netbsd      | 4 ++--
 tests/vm/openbsd     | 4 ++--
 tests/vm/ubuntu.i386 | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)
tests/vm/freebsd +2 -2
index 795f739c7b..0a6ec4614a 100755
@@ -23,8 +23,8 @@ class FreeBSDVM(basevm.BaseVM):
         cd $(mktemp -d /var/tmp/qemu-test.XXXXXX);
         tar -xf /dev/vtbd1;
         ./configure {configure_opts};
-        gmake -j{jobs} {verbose};
-        gmake -j{jobs} check {verbose};
+        gmake --output-sync -j{jobs} {verbose};
+        gmake --output-sync -j{jobs} check {verbose};
     """
 
     def build_image(self, img):
tests/vm/netbsd +2 -2
index c211672bcb..45c9260dc0 100755
@@ -23,8 +23,8 @@ class NetBSDVM(basevm.BaseVM):
         cd $(mktemp -d /var/tmp/qemu-test.XXXXXX);
         tar -xf /dev/rld1a;
         ./configure --python=python2.7 {configure_opts};
-        gmake -j{jobs} {verbose};
-        gmake -j{jobs} check {verbose};
+        gmake --output-sync -j{jobs} {verbose};
+        gmake --output-sync -j{jobs} check {verbose};
     """
 
     def build_image(self, img):
tests/vm/openbsd +2 -2
index 1e0c2500ad..98edfbca4b 100755
@@ -23,9 +23,9 @@ class OpenBSDVM(basevm.BaseVM):
         cd $(mktemp -d /var/tmp/qemu-test.XXXXXX);
         tar -xf /dev/rsd1c;
         ./configure --cc=x86_64-unknown-openbsd6.1-gcc-4.9.4 --python=python2.7 {configure_opts};
-        gmake -j{jobs} {verbose};
+        gmake --output-sync -j{jobs} {verbose};
         # XXX: "gmake check" seems to always hang or fail
-        #gmake -j{jobs} check {verbose};
+        #gmake --output-sync -j{jobs} check {verbose};
     """
 
     def build_image(self, img):
tests/vm/ubuntu.i386 +2 -2
index 160b9be034..3f6ed48b74 100755
@@ -25,8 +25,8 @@ class UbuntuX86VM(basevm.BaseVM):
         sudo chmod a+r /dev/vdb;
         tar -xf /dev/vdb;
         ./configure {configure_opts};
-        make -j{jobs};
-        make check -j{jobs} {verbose};
+        make --output-sync -j{jobs};
+        make --output-sync check -j{jobs} {verbose};
     """
 
     def _gen_cloud_init_iso(self):
Signature · 1 line
2.17.1
author
#16 lore raw

[Qemu-devel] [PULL 16/17] tests/vm: Add vm-build-all/vm-clean-all in help text

In reply to Fam Zheng

Message-Id: <[email protected]>

---
 tests/vm/Makefile.include | 3 +++
 1 file changed, 3 insertions(+)
tests/vm/Makefile.include +3 -0
index 76f416286e..a98fb3027f 100644
@@ -15,6 +15,9 @@ vm-test:
 	@echo "  vm-build-netbsd                 - Build QEMU in NetBSD VM"
 	@echo "  vm-build-openbsd                - Build QEMU in OpenBSD VM"
 	@echo "  vm-build-centos                 - Build QEMU in CentOS VM, with Docker"
+	@echo ""
+	@echo "  vm-build-all                    - Build QEMU in all VMs"
+	@echo "  vm-clean-all                    - Clean up VM images"
 
 vm-build-all: $(addprefix vm-build-, $(IMAGES))
 
Signature · 1 line
2.17.1
author
#17 lore raw

[Qemu-devel] [PULL 17/17] aio-posix: Improve comment around marking node deleted

In reply to Fam Zheng

The counter is for qemu_lockcnt_inc/dec sections (read side), qemu_lockcnt_lock/unlock is for the write side.

Message-Id: <[email protected]>

---
 util/aio-posix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
util/aio-posix.c +1 -1
index b5c609b68b..131ba6b4a8 100644
@@ -232,7 +232,7 @@ void aio_set_fd_handler(AioContext *ctx,
             g_source_remove_poll(&ctx->source, &node->pfd);
         }
 
-        /* If the lock is held, just mark the node as deleted */
+        /* If a read is in progress, just mark the node as deleted */
         if (qemu_lockcnt_count(&ctx->list_lock)) {
             node->deleted = 1;
             node->pfd.revents = 0;
Signature · 1 line
2.17.1
#18 lore raw
In reply to Fam Zheng
Quoted 12 lines · Fam Zheng

The following changes since commit 38441756b70eec5807b5f60dad11a93a91199866:

Update version for v3.0.0 release (2018-08-14 16:38:43 +0100)

are available in the Git repository at:

git://github.com/famz/qemu.git tags/block-and-testing-pull-request

for you to fetch changes up to 37a81812f7b8367422a039eb09d915df543983ee:

aio-posix: Improve comment around marking node deleted (2018-08-15 10:12:35 +0800)

Quoted 8 lines

----------------------------------------------------------------
Block and testing patches for 3.1

- aio fixes by me
- nvme fixes by Paolo and me
- test improvements by Peter, Phil and me

----------------------------------------------------------------

Applied, thanks.

-- PMM

#19 lore raw
In reply to Fam Zheng
Quoted 6 lines · Fam Zheng

The following changes since commit 38441756b70eec5807b5f60dad11a93a91199866:

Update version for v3.0.0 release (2018-08-14 16:38:43 +0100)

tests/vm: Only use -cpu 'host' if KVM is available

Incidentally, why did you go with this one rather than just using -cpu max all the time? The point of -cpu max is to work everywhere, so you don't need to have special casing to decide whether to use it or something else...

thanks
-- PMM

author
#20 lore raw
Quoted 6 lines · Peter Maydell
Quoted 3 lines · Fam Zheng

The following changes since commit 38441756b70eec5807b5f60dad11a93a91199866:

Update version for v3.0.0 release (2018-08-14 16:38:43 +0100)

Quoted 6 lines
Quoted 1 line

tests/vm: Only use -cpu 'host' if KVM is available

Incidentally, why did you go with this one rather than just using -cpu max all the time? The point of -cpu max is to work everywhere, so you don't need to have special casing to decide whether to use it or something else...

My apology for dropping the patch but forgot to send a note.

The only reason is this was queued first, and yours couldn't be applied without rebasing (which effectively drops the former). But I agree with your point, and am open for a further clean up.

Fam