Skip to contentSkip to conversation

qtest and misc patches

GIT PULL Applied Thomas Huth 2 participants 10 messages May 2, 2019 – May 3, 2019 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

Hi Peter,

the following changes since commit 8482ff2eb3bb95020eb2f370a9b3ea26511e41df:

Merge remote-tracking branch 'remotes/jnsnow/tags/bitmaps-pull-request' into staging (2019-05-02 12:04:51 +0100)

are available in the Git repository at:

https://gitlab.com/huth/qemu.git tags/pull-request-2019-05-02

for you to fetch changes up to aff39be0ed9753c9c323f64a14f5533dd5c43525:

hw/pci-host: Use object_initialize_child for correct reference counting (2019-05-02 16:56:33 +0200)

----------------------------------------------------------------
- Move qtest accel code to accel/qtest.c, get rid of AccelClass->available
- Test TCG interpreter in gitlab-ci
- Small improvements to the configure script
- Use object_initialize_child in hw/pci-host
----------------------------------------------------------------

Eduardo Habkost (3):
qtest: Move accel code to accel/qtest.c
qtest: Don't compile qtest accel on non-POSIX systems
accel: Remove unused AccelClass::available field

Helge Deller (1):
configure: Relax check for libseccomp

Thomas Huth (4):
gitlab-ci.yml: Test the TCG interpreter in a CI pipeline
configure: Add -Wno-typedef-redefinition to CFLAGS (for Clang)
configure: Remove old *-config-devices.mak.d files when running configure hw/pci-host: Use object_initialize_child for correct reference counting

 .gitlab-ci.yml            | 15 +++++++++++++
 MAINTAINERS               |  1 +
 accel/Makefile.objs       |  1 +
 accel/accel.c             |  5 -----
 accel/qtest.c             | 54 +++++++++++++++++++++++++++++++++++++++++++++++
 configure                 | 33 +++++++----------------------
 hw/pci-host/designware.c  |  4 ++--
 hw/pci-host/gpex.c        |  5 +++--
 hw/pci-host/q35.c         |  4 ++--
 hw/pci-host/xilinx-pcie.c |  4 ++--
 include/sysemu/accel.h    |  1 -
 include/sysemu/qtest.h    |  9 --------
 qtest.c                   | 34 -----------------------------
 13 files changed, 88 insertions(+), 82 deletions(-)
 create mode 100644 accel/qtest.c
#1 lore raw

[Qemu-devel] [PULL 1/8] gitlab-ci.yml: Test the TCG interpreter in a CI pipeline

So far we do not have any test coverage for TCI (the TCG interpreter) yet. Thus let's add a CI pipeline that runs at least some basic TCG tests with a TCI build, to make sure that there are no further regressions.

Message-Id: <[email protected]>

---
 .gitlab-ci.yml | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
.gitlab-ci.yml +15 -0
index 79d02cf740..c63bf2f822 100644
@@ -71,3 +71,18 @@ build-clang:
                      ppc-softmmu s390x-softmmu x86_64-softmmu arm-linux-user"
  - make -j2
  - make -j2 check
+
+build-tci:
+ script:
+ - TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
+ - ./configure --enable-tcg-interpreter
+      --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)"
+ - make -j2
+ - make tests/boot-serial-test tests/cdrom-test tests/pxe-test
+ - for tg in $TARGETS ; do
+     export QTEST_QEMU_BINARY="${tg}-softmmu/qemu-system-${tg}" ;
+     ./tests/boot-serial-test || exit 1 ;
+     ./tests/cdrom-test || exit 1 ;
+   done
+ - QTEST_QEMU_BINARY="x86_64-softmmu/qemu-system-x86_64" ./tests/pxe-test
+ - QTEST_QEMU_BINARY="s390x-softmmu/qemu-system-s390x" ./tests/pxe-test -m slow
Signature · 1 line
2.21.0
#2 lore raw

[Qemu-devel] [PULL 2/8] qtest: Move accel code to accel/qtest.c

In reply to Thomas Huth

From: Eduardo Habkost <[email protected]>

QTest has two parts: the server (-qtest) and the accelerator (-machine accel=qtest). The accelerator depends on CONFIG_POSIX due to its usage of sigwait(), but the server doesn't.

Move the accel code to accel/qtest.c. Later we will disable compilation of accel/qtest.c on non-POSIX systems.

Message-Id: <[email protected]>

---
 MAINTAINERS         |  1 +
 accel/Makefile.objs |  1 +
 accel/qtest.c       | 55 +++++++++++++++++++++++++++++++++++++++++++++
 qtest.c             | 34 ----------------------------
 4 files changed, 57 insertions(+), 34 deletions(-)
 create mode 100644 accel/qtest.c
MAINTAINERS +1 -0
index 7dd71e0a2d..66ddbda9c9 100644
@@ -2035,6 +2035,7 @@ M: Laurent Vivier <[email protected]>
 R: Paolo Bonzini <[email protected]>
 S: Maintained
 F: qtest.c
+F: accel/qtest.c
 F: tests/libqtest.*
 F: tests/libqos/
 F: tests/*-test.c
accel/Makefile.objs +1 -0
index c3718a10c5..2a5ed46940 100644
@@ -1,4 +1,5 @@
 obj-$(CONFIG_SOFTMMU) += accel.o
+obj-$(CONFIG_SOFTMMU) += qtest.o
 obj-$(CONFIG_KVM) += kvm/
 obj-$(CONFIG_TCG) += tcg/
 obj-y += stubs/
accel/qtest.c new file +55 -0

55 lines not on this page · raw message

qtest.c +0 -34
index 527141785f..f2e2f27778 100644
@@ -749,16 +749,6 @@ static void qtest_event(void *opaque, int event)
     }
 }
 
-static int qtest_init_accel(MachineState *ms)
-{
-    QemuOpts *opts = qemu_opts_create(qemu_find_opts("icount"), NULL, 0,
-                                      &error_abort);
-    qemu_opt_set(opts, "shift", "0", &error_abort);
-    configure_icount(opts, &error_abort);
-    qemu_opts_del(opts);
-    return 0;
-}
-
 void qtest_init(const char *qtest_chrdev, const char *qtest_log, Error **errp)
 {
     Chardev *chr;
@@ -791,27 +781,3 @@ bool qtest_driver(void)
 {
     return qtest_chr.chr != NULL;
 }
-
-static void qtest_accel_class_init(ObjectClass *oc, void *data)
-{
-    AccelClass *ac = ACCEL_CLASS(oc);
-    ac->name = "QTest";
-    ac->available = qtest_available;
-    ac->init_machine = qtest_init_accel;
-    ac->allowed = &qtest_allowed;
-}
-
-#define TYPE_QTEST_ACCEL ACCEL_CLASS_NAME("qtest")
-
-static const TypeInfo qtest_accel_type = {
-    .name = TYPE_QTEST_ACCEL,
-    .parent = TYPE_ACCEL,
-    .class_init = qtest_accel_class_init,
-};
-
-static void qtest_type_init(void)
-{
-    type_register_static(&qtest_accel_type);
-}
-
-type_init(qtest_type_init);
Signature · 1 line
2.21.0
#3 lore raw

[Qemu-devel] [PULL 3/8] qtest: Don't compile qtest accel on non-POSIX systems

In reply to Thomas Huth

From: Eduardo Habkost <[email protected]>

qtest_available() will always return 0 on non-POSIX systems. It's simpler to just not compile the accelerator code on those systems instead of relying on the AccelClass::available function.

Message-Id: <[email protected]>

---
 accel/Makefile.objs    | 2 +-
 accel/qtest.c          | 1 -
 include/sysemu/qtest.h | 9 ---------
 3 files changed, 1 insertion(+), 11 deletions(-)
accel/Makefile.objs +1 -1
index 2a5ed46940..8b498d39d8 100644
@@ -1,5 +1,5 @@
 obj-$(CONFIG_SOFTMMU) += accel.o
-obj-$(CONFIG_SOFTMMU) += qtest.o
+obj-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_POSIX)) += qtest.o
 obj-$(CONFIG_KVM) += kvm/
 obj-$(CONFIG_TCG) += tcg/
 obj-y += stubs/
accel/qtest.c +0 -1
index a02b3c26c7..5b88f55921 100644
@@ -34,7 +34,6 @@ static void qtest_accel_class_init(ObjectClass *oc, void *data)
 {
     AccelClass *ac = ACCEL_CLASS(oc);
     ac->name = "QTest";
-    ac->available = qtest_available;
     ac->init_machine = qtest_init_accel;
     ac->allowed = &qtest_allowed;
 }
include/sysemu/qtest.h +0 -9
index 70aa40aa72..096ddfc20c 100644
@@ -27,13 +27,4 @@ bool qtest_driver(void);
 
 void qtest_init(const char *qtest_chrdev, const char *qtest_log, Error **errp);
 
-static inline int qtest_available(void)
-{
-#ifdef CONFIG_POSIX
-    return 1;
-#else
-    return 0;
-#endif
-}
-
 #endif
Signature · 1 line
2.21.0
#4 lore raw

[Qemu-devel] [PULL 4/8] accel: Remove unused AccelClass::available field

In reply to Thomas Huth

From: Eduardo Habkost <[email protected]>

The field is not used anymore, we can remove it.

Message-Id: <[email protected]>

---
 accel/accel.c          | 5 -----
 include/sysemu/accel.h | 1 -
 2 files changed, 6 deletions(-)
accel/accel.c +0 -5
index 454fef9d92..5fa31717b4 100644
@@ -107,11 +107,6 @@ void configure_accelerator(MachineState *ms, const char *progname)
         if (!acc) {
             continue;
         }
-        if (acc->available && !acc->available()) {
-            printf("%s not supported for this target\n",
-                   acc->name);
-            continue;
-        }
         ret = accel_init_machine(acc, ms);
         if (ret < 0) {
             init_failed = true;
include/sysemu/accel.h +0 -1
index 5565e00a96..70e9e2f2a1 100644
@@ -38,7 +38,6 @@ typedef struct AccelClass {
 
     const char *opt_name;
     const char *name;
-    int (*available)(void);
     int (*init_machine)(MachineState *ms);
     void (*setup_post)(MachineState *ms, AccelState *accel);
     bool *allowed;
Signature · 1 line
2.21.0
#5 lore raw

[Qemu-devel] [PULL 5/8] configure: Add -Wno-typedef-redefinition to CFLAGS (for Clang)

In reply to Thomas Huth

Without the -Wno-typedef-redefinition option, clang complains if a typedef gets redefined in gnu99 mode (since this is officially a C11 feature). This used to also happen with older versions of GCC, but since we've bumped our minimum GCC version to 4.8, all versions of GCC that we support do not seem to issue this warning in gnu99 mode anymore. So this has become a common problem for people who only test their code with GCC - they do not notice the issue until they submit their patches and suddenly patchew or a maintainer complains.

Now that we do not urgently need to keep the code clean from typedef redefintions anymore with recent versions of GCC, we can ease the situation with clang, too, and simply shut these warnings off for good.

Message-Id: <[email protected]>

---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
index 60719ddcc5..362bfef637 100755
@@ -1908,7 +1908,7 @@ gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_
 gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
 gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags"
 gcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags"
-gcc_flags="-Wno-string-plus-int $gcc_flags"
+gcc_flags="-Wno-string-plus-int -Wno-typedef-redefinition $gcc_flags"
 # Note that we do not add -Werror to gcc_flags here, because that would
 # enable it for all configure tests. If a configure test failed due
 # to -Werror this would just silently disable some features,
Signature · 1 line
2.21.0
#6 lore raw

[Qemu-devel] [PULL 6/8] configure: Remove old *-config-devices.mak.d files when running configure

In reply to Thomas Huth

When running "make" in a build directory from the pre-Kconfig merge time, the build process currently fails with:

make: *** No rule to make target `.../default-configs/pci.mak',
needed by `aarch64-softmmu/config-devices.mak'. Stop.

To make sure that this problem at least goes away when the user runs "configure" (or "sh config.status") again, we have to make sure that we re-generate the .mak.d files. Thus remove the old stale files while running the configure script.

Message-Id: <[email protected]>

---
 configure | 3 +++
 1 file changed, 3 insertions(+)
configure +3 -0
index 362bfef637..f14b25c49c 100755
@@ -1818,6 +1818,9 @@ EOF
 exit 0
 fi
 
+# Remove old dependency files to make sure that they get properly regenerated
+rm -f *-config-devices.mak.d
+
 if ! has $python; then
   error_exit "Python not found. Use --python=/path/to/python"
 fi
Signature · 1 line
2.21.0
#7 lore raw

[Qemu-devel] [PULL 7/8] configure: Relax check for libseccomp

In reply to Thomas Huth

From: Helge Deller <[email protected]>

All major distributions do support libseccomp version >= 2.3.0, so there is no need to special-case on various architectures any longer.

Message-Id: <[email protected]>

---
 configure | 28 ++++------------------------
 1 file changed, 4 insertions(+), 24 deletions(-)
configure +4 -24
index f14b25c49c..3a9bee2621 100755
@@ -2374,36 +2374,16 @@ fi
 ##########################################
 # libseccomp check
 
-libseccomp_minver="2.2.0"
 if test "$seccomp" != "no" ; then
-    case "$cpu" in
-    i386|x86_64|mips)
-        ;;
-    arm|aarch64)
-        libseccomp_minver="2.2.3"
-        ;;
-    ppc|ppc64|s390x)
-        libseccomp_minver="2.3.0"
-        ;;
-    *)
-        libseccomp_minver=""
-        ;;
-    esac
-
-    if test "$libseccomp_minver" != "" &&
-       $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
+    libseccomp_minver="2.3.0"
+    if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
         seccomp_cflags="$($pkg_config --cflags libseccomp)"
         seccomp_libs="$($pkg_config --libs libseccomp)"
         seccomp="yes"
     else
         if test "$seccomp" = "yes" ; then
-            if test "$libseccomp_minver" != "" ; then
-                feature_not_found "libseccomp" \
-                    "Install libseccomp devel >= $libseccomp_minver"
-            else
-                feature_not_found "libseccomp" \
-                    "libseccomp is not supported for host cpu $cpu"
-            fi
+            feature_not_found "libseccomp" \
+                 "Install libseccomp devel >= $libseccomp_minver"
         fi
         seccomp="no"
     fi
Signature · 1 line
2.21.0
#8 lore raw

[Qemu-devel] [PULL 8/8] hw/pci-host: Use object_initialize_child for correct reference counting

In reply to Thomas Huth

Both functions, object_initialize() and object_property_add_child() increase the reference counter of the new object, so one of the references has to be dropped afterwards to get the reference counting right. Otherwise the child object might not be properly cleaned up when the parent gets destroyed. Some functions of the pci-host devices miss to drop one of the references. Fix it by using object_initialize_child() instead, which takes care of calling object_initialize(), object_property_add_child() and object_unref() in the right order.

Message-Id: <[email protected]>

---
 hw/pci-host/designware.c  | 4 ++--
 hw/pci-host/gpex.c        | 5 +++--
 hw/pci-host/q35.c         | 4 ++--
 hw/pci-host/xilinx-pcie.c | 4 ++--
 4 files changed, 9 insertions(+), 8 deletions(-)
hw/pci-host/designware.c +2 -2
index 29ea313798..64ad21d295 100644
@@ -721,8 +721,8 @@ static void designware_pcie_host_init(Object *obj)
     DesignwarePCIEHost *s = DESIGNWARE_PCIE_HOST(obj);
     DesignwarePCIERoot *root = &s->root;
 
-    object_initialize(root, sizeof(*root), TYPE_DESIGNWARE_PCIE_ROOT);
-    object_property_add_child(obj, "root", OBJECT(root), NULL);
+    object_initialize_child(obj, "root",  root, sizeof(*root),
+                            TYPE_DESIGNWARE_PCIE_ROOT, &error_abort, NULL);
     qdev_prop_set_int32(DEVICE(root), "addr", PCI_DEVFN(0, 0));
     qdev_prop_set_bit(DEVICE(root), "multifunction", false);
 }
hw/pci-host/gpex.c +3 -2
index 2583b151a4..1bafffcc34 100644
@@ -29,6 +29,7 @@
  * http://www.firmware.org/1275/practice/imap/imap0_9d.pdf
  */
 #include "qemu/osdep.h"
+#include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/pci-host/gpex.h"
 
@@ -120,8 +121,8 @@ static void gpex_host_initfn(Object *obj)
     GPEXHost *s = GPEX_HOST(obj);
     GPEXRootState *root = &s->gpex_root;
 
-    object_initialize(root, sizeof(*root), TYPE_GPEX_ROOT_DEVICE);
-    object_property_add_child(obj, "gpex_root", OBJECT(root), NULL);
+    object_initialize_child(obj, "gpex_root",  root, sizeof(*root),
+                            TYPE_GPEX_ROOT_DEVICE, &error_abort, NULL);
     qdev_prop_set_int32(DEVICE(root), "addr", PCI_DEVFN(0, 0));
     qdev_prop_set_bit(DEVICE(root), "multifunction", false);
 }
hw/pci-host/q35.c +2 -2
index 7b871b5734..960939f5ed 100644
@@ -216,8 +216,8 @@ static void q35_host_initfn(Object *obj)
     memory_region_init_io(&phb->data_mem, obj, &pci_host_data_le_ops, phb,
                           "pci-conf-data", 4);
 
-    object_initialize(&s->mch, sizeof(s->mch), TYPE_MCH_PCI_DEVICE);
-    object_property_add_child(OBJECT(s), "mch", OBJECT(&s->mch), NULL);
+    object_initialize_child(OBJECT(s), "mch",  &s->mch, sizeof(s->mch),
+                            TYPE_MCH_PCI_DEVICE, &error_abort, NULL);
     qdev_prop_set_int32(DEVICE(&s->mch), "addr", PCI_DEVFN(0, 0));
     qdev_prop_set_bit(DEVICE(&s->mch), "multifunction", false);
     /* mch's object_initialize resets the default value, set it again */
hw/pci-host/xilinx-pcie.c +2 -2
index 60309afe9e..ceb00e23e6 100644
@@ -149,8 +149,8 @@ static void xilinx_pcie_host_init(Object *obj)
     XilinxPCIEHost *s = XILINX_PCIE_HOST(obj);
     XilinxPCIERoot *root = &s->root;
 
-    object_initialize(root, sizeof(*root), TYPE_XILINX_PCIE_ROOT);
-    object_property_add_child(obj, "root", OBJECT(root), NULL);
+    object_initialize_child(obj, "root",  root, sizeof(*root),
+                            TYPE_XILINX_PCIE_ROOT, &error_abort, NULL);
     qdev_prop_set_int32(DEVICE(root), "addr", PCI_DEVFN(0, 0));
     qdev_prop_set_bit(DEVICE(root), "multifunction", false);
 }
Signature · 1 line
2.21.0
#9 lore raw
In reply to Thomas Huth
Quoted 27 lines · Thomas Huth

Hi Peter,

the following changes since commit 8482ff2eb3bb95020eb2f370a9b3ea26511e41df:

Merge remote-tracking branch 'remotes/jnsnow/tags/bitmaps-pull-request' into staging (2019-05-02 12:04:51 +0100)

are available in the Git repository at:

https://gitlab.com/huth/qemu.git tags/pull-request-2019-05-02

for you to fetch changes up to aff39be0ed9753c9c323f64a14f5533dd5c43525:

hw/pci-host: Use object_initialize_child for correct reference counting (2019-05-02 16:56:33 +0200)

----------------------------------------------------------------
- Move qtest accel code to accel/qtest.c, get rid of AccelClass->available
- Test TCG interpreter in gitlab-ci
- Small improvements to the configure script
- Use object_initialize_child in hw/pci-host
----------------------------------------------------------------

Eduardo Habkost (3):
qtest: Move accel code to accel/qtest.c
qtest: Don't compile qtest accel on non-POSIX systems
accel: Remove unused AccelClass::available field

Quoted 8 lines

Helge Deller (1):
configure: Relax check for libseccomp

Thomas Huth (4):
gitlab-ci.yml: Test the TCG interpreter in a CI pipeline
configure: Add -Wno-typedef-redefinition to CFLAGS (for Clang)
configure: Remove old *-config-devices.mak.d files when running configure hw/pci-host: Use object_initialize_child for correct reference counting

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.1
for any user-visible changes.

-- PMM