Skip to content

Commit f0b6a6a

Browse files
committed
Merge remote-tracking branch 'remotes/stsquad/tags/pull-6.0-rc0-fixed-240321-1' into staging
Various fixes for 6.0: - include kernel-doc API reference for plugins - fix semihosting SYS_HEAPINFO - various tweaks to improve CI runtime - more stroz fixes - fix iotest CI regressions # gpg: Signature made Wed 24 Mar 2021 14:28:24 GMT # gpg: using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full] # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * remotes/stsquad/tags/pull-6.0-rc0-fixed-240321-1: (22 commits) gitlab: default to not building the documentation iotests: iothreads need ioeventfd iotests: test m68k with the virt machine iotests: Revert "iotests: use -ccw on s390x for 040, 139, and 182" blockdev: with -drive if=virtio, use generic virtio-blk m68k: add the virtio devices aliases qdev: define list of archs with virtio-pci or virtio-ccw gitlab: extend timeouts for CFI builds utils: Work around mingw strto*l bug with 0x utils: Tighter tests for qemu_strtosz cirrus.yml: Update the FreeBSD task to version 12.2 configure: Don't use the __atomic_*_16 functions for testing 128-bit support gitlab-ci.yml: Merge the trace-backend testing into other jobs tests/tcg: add HeapInfo checking to semihosting test linux-user/riscv: initialise the TaskState heap/stack info semihosting/arm-compat-semi: don't use SET_ARG to report SYS_HEAPINFO semihosting/arm-compat-semi: unify GET/SET_ARG helpers semihosting: move semihosting tests to multiarch tools/virtiofsd: include --socket-group in help docs/devel: expand style section of memory management ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 parents 01874b1 + a9eb2df commit f0b6a6a

File tree

43 files changed

+548
-271
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+548
-271
lines changed

.cirrus.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ env:
33

44
freebsd_12_task:
55
freebsd_instance:
6-
image_family: freebsd-12-1
6+
image_family: freebsd-12-2
77
cpu: 8
88
memory: 8G
99
install_script:
@@ -13,7 +13,10 @@ freebsd_12_task:
1313
script:
1414
- mkdir build
1515
- cd build
16-
- ../configure --enable-werror || { cat config.log meson-logs/meson-log.txt; exit 1; }
16+
# TODO: Enable gnutls again once FreeBSD's libtasn1 got fixed
17+
# See: https://gitlab.com/gnutls/libtasn1/-/merge_requests/71
18+
- ../configure --enable-werror --disable-gnutls
19+
|| { cat config.log meson-logs/meson-log.txt; exit 1; }
1720
- gmake -j$(sysctl -n hw.ncpu)
1821
- gmake -j$(sysctl -n hw.ncpu) check V=1
1922

.gitlab-ci.d/crossbuilds.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
- mkdir build
77
- cd build
88
- PKG_CONFIG_PATH=$PKG_CONFIG_PATH
9-
../configure --enable-werror $QEMU_CONFIGURE_OPTS --disable-user
10-
--target-list-exclude="arm-softmmu cris-softmmu i386-softmmu
11-
microblaze-softmmu mips-softmmu mipsel-softmmu mips64-softmmu
12-
ppc-softmmu sh4-softmmu xtensa-softmmu"
9+
../configure --enable-werror --disable-docs $QEMU_CONFIGURE_OPTS
10+
--disable-user --target-list-exclude="arm-softmmu cris-softmmu
11+
i386-softmmu microblaze-softmmu mips-softmmu mipsel-softmmu
12+
mips64-softmmu ppc-softmmu sh4-softmmu xtensa-softmmu"
1313
- make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
1414

1515
# Job to cross-build specific accelerators.
@@ -25,8 +25,8 @@
2525
- mkdir build
2626
- cd build
2727
- PKG_CONFIG_PATH=$PKG_CONFIG_PATH
28-
../configure --enable-werror $QEMU_CONFIGURE_OPTS --disable-tools
29-
--enable-${ACCEL:-kvm} $ACCEL_CONFIGURE_OPTS
28+
../configure --enable-werror --disable-docs $QEMU_CONFIGURE_OPTS
29+
--disable-tools --enable-${ACCEL:-kvm} $ACCEL_CONFIGURE_OPTS
3030
- make -j$(expr $(nproc) + 1) all check-build
3131

3232
.cross_user_build_job:
@@ -36,7 +36,8 @@
3636
- mkdir build
3737
- cd build
3838
- PKG_CONFIG_PATH=$PKG_CONFIG_PATH
39-
../configure --enable-werror $QEMU_CONFIGURE_OPTS --disable-system
39+
../configure --enable-werror --disable-docs $QEMU_CONFIGURE_OPTS
40+
--disable-system
4041
- make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
4142

4243
cross-armel-system:

.gitlab-ci.yml

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ include:
2323
- cd build
2424
- if test -n "$TARGETS";
2525
then
26-
../configure --enable-werror $CONFIGURE_ARGS --target-list="$TARGETS" ;
26+
../configure --enable-werror --disable-docs $CONFIGURE_ARGS --target-list="$TARGETS" ;
2727
else
28-
../configure --enable-werror $CONFIGURE_ARGS ;
28+
../configure --enable-werror --disable-docs $CONFIGURE_ARGS ;
2929
fi || { cat config.log meson-logs/meson-log.txt && exit 1; }
3030
- if test -n "$LD_JOBS";
3131
then
@@ -87,7 +87,7 @@ build-system-alpine:
8787
TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu
8888
moxie-softmmu microblazeel-softmmu mips64el-softmmu
8989
MAKE_CHECK_ARGS: check-build
90-
CONFIGURE_ARGS: --enable-docs
90+
CONFIGURE_ARGS: --enable-docs --enable-trace-backends=log,simple,syslog
9191
artifacts:
9292
expire_in: 2 days
9393
paths:
@@ -119,7 +119,7 @@ build-system-ubuntu:
119119
job: amd64-ubuntu2004-container
120120
variables:
121121
IMAGE: ubuntu2004
122-
CONFIGURE_ARGS: --enable-fdt=system --enable-slirp=system
122+
CONFIGURE_ARGS: --enable-docs --enable-fdt=system --enable-slirp=system
123123
TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu
124124
moxie-softmmu microblazeel-softmmu mips64el-softmmu
125125
MAKE_CHECK_ARGS: check-build
@@ -502,6 +502,7 @@ build-cfi-aarch64:
502502
--enable-safe-stack --enable-slirp=git
503503
TARGETS: aarch64-softmmu
504504
MAKE_CHECK_ARGS: check-build
505+
timeout: 70m
505506
artifacts:
506507
expire_in: 2 days
507508
paths:
@@ -538,6 +539,7 @@ build-cfi-ppc64-s390x:
538539
--enable-safe-stack --enable-slirp=git
539540
TARGETS: ppc64-softmmu s390x-softmmu
540541
MAKE_CHECK_ARGS: check-build
542+
timeout: 70m
541543
artifacts:
542544
expire_in: 2 days
543545
paths:
@@ -574,6 +576,7 @@ build-cfi-x86_64:
574576
--enable-safe-stack --enable-slirp=git
575577
TARGETS: x86_64-softmmu
576578
MAKE_CHECK_ARGS: check-build
579+
timeout: 70m
577580
artifacts:
578581
expire_in: 2 days
579582
paths:
@@ -604,8 +607,8 @@ tsan-build:
604607
job: amd64-ubuntu2004-container
605608
variables:
606609
IMAGE: ubuntu2004
607-
CONFIGURE_ARGS: --enable-tsan --cc=clang-10 --cxx=clang++-10 --disable-docs
608-
--enable-fdt=system --enable-slirp=system
610+
CONFIGURE_ARGS: --enable-tsan --cc=clang-10 --cxx=clang++-10
611+
--enable-trace-backends=ust --enable-fdt=system --enable-slirp=system
609612
TARGETS: x86_64-softmmu ppc64-softmmu riscv64-softmmu x86_64-linux-user
610613
MAKE_CHECK_ARGS: bench V=1
611614

@@ -616,7 +619,7 @@ build-deprecated:
616619
job: amd64-debian-user-cross-container
617620
variables:
618621
IMAGE: debian-all-test-cross
619-
CONFIGURE_ARGS: --disable-docs --disable-tools
622+
CONFIGURE_ARGS: --disable-tools
620623
MAKE_CHECK_ARGS: build-tcg
621624
TARGETS: ppc64abi32-linux-user lm32-softmmu unicore32-softmmu
622625
artifacts:
@@ -702,6 +705,7 @@ build-coroutine-sigaltstack:
702705
variables:
703706
IMAGE: ubuntu2004
704707
CONFIGURE_ARGS: --with-coroutine=sigaltstack --disable-tcg
708+
--enable-trace-backends=ftrace
705709
MAKE_CHECK_ARGS: check-unit
706710

707711
# Most jobs test latest gcrypt or nettle builds
@@ -739,31 +743,6 @@ crypto-only-gnutls:
739743
MAKE_CHECK_ARGS: check
740744

741745

742-
# We don't need to exercise every backend with every front-end
743-
build-trace-multi-user:
744-
<<: *native_build_job_definition
745-
needs:
746-
job: amd64-ubuntu2004-container
747-
variables:
748-
IMAGE: ubuntu2004
749-
CONFIGURE_ARGS: --enable-trace-backends=log,simple,syslog --disable-system
750-
751-
build-trace-ftrace-system:
752-
<<: *native_build_job_definition
753-
needs:
754-
job: amd64-ubuntu2004-container
755-
variables:
756-
IMAGE: ubuntu2004
757-
CONFIGURE_ARGS: --enable-trace-backends=ftrace --target-list=x86_64-softmmu
758-
759-
build-trace-ust-system:
760-
<<: *native_build_job_definition
761-
needs:
762-
job: amd64-ubuntu2004-container
763-
variables:
764-
IMAGE: ubuntu2004
765-
CONFIGURE_ARGS: --enable-trace-backends=ust --target-list=x86_64-softmmu
766-
767746
# Check our reduced build configurations
768747
build-without-default-devices:
769748
<<: *native_build_job_definition

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3286,6 +3286,7 @@ M: Alex Bennée <alex.bennee@linaro.org>
32863286
S: Maintained
32873287
F: semihosting/
32883288
F: include/semihosting/
3289+
F: tests/tcg/multiarch/arm-compat-semi/
32893290

32903291
Multi-process QEMU
32913292
M: Elena Ufimtseva <elena.ufimtseva@oracle.com>

blockdev.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -962,11 +962,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type,
962962
QemuOpts *devopts;
963963
devopts = qemu_opts_create(qemu_find_opts("device"), NULL, 0,
964964
&error_abort);
965-
if (arch_type == QEMU_ARCH_S390X) {
966-
qemu_opt_set(devopts, "driver", "virtio-blk-ccw", &error_abort);
967-
} else {
968-
qemu_opt_set(devopts, "driver", "virtio-blk-pci", &error_abort);
969-
}
965+
qemu_opt_set(devopts, "driver", "virtio-blk", &error_abort);
970966
qemu_opt_set(devopts, "drive", qdict_get_str(bs_opts, "id"),
971967
&error_abort);
972968
}

configure

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4779,9 +4779,9 @@ if test "$int128" = "yes"; then
47794779
int main(void)
47804780
{
47814781
unsigned __int128 x = 0, y = 0;
4782-
y = __atomic_load_16(&x, 0);
4783-
__atomic_store_16(&x, y, 0);
4784-
__atomic_compare_exchange_16(&x, &y, x, 0, 0, 0);
4782+
y = __atomic_load(&x, 0);
4783+
__atomic_store(&x, y, 0);
4784+
__atomic_compare_exchange(&x, &y, x, 0, 0, 0);
47854785
return 0;
47864786
}
47874787
EOF

docs/devel/style.rst

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -385,17 +385,37 @@ avoided.
385385
Low level memory management
386386
===========================
387387

388-
Use of the malloc/free/realloc/calloc/valloc/memalign/posix_memalign
388+
Use of the ``malloc/free/realloc/calloc/valloc/memalign/posix_memalign``
389389
APIs is not allowed in the QEMU codebase. Instead of these routines,
390-
use the GLib memory allocation routines g_malloc/g_malloc0/g_new/
391-
g_new0/g_realloc/g_free or QEMU's qemu_memalign/qemu_blockalign/qemu_vfree
392-
APIs.
393-
394-
Please note that g_malloc will exit on allocation failure, so there
395-
is no need to test for failure (as you would have to with malloc).
396-
Calling g_malloc with a zero size is valid and will return NULL.
397-
398-
Prefer g_new(T, n) instead of g_malloc(sizeof(T) ``*`` n) for the following
390+
use the GLib memory allocation routines
391+
``g_malloc/g_malloc0/g_new/g_new0/g_realloc/g_free``
392+
or QEMU's ``qemu_memalign/qemu_blockalign/qemu_vfree`` APIs.
393+
394+
Please note that ``g_malloc`` will exit on allocation failure, so
395+
there is no need to test for failure (as you would have to with
396+
``malloc``). Generally using ``g_malloc`` on start-up is fine as the
397+
result of a failure to allocate memory is going to be a fatal exit
398+
anyway. There may be some start-up cases where failing is unreasonable
399+
(for example speculatively loading a large debug symbol table).
400+
401+
Care should be taken to avoid introducing places where the guest could
402+
trigger an exit by causing a large allocation. For small allocations,
403+
of the order of 4k, a failure to allocate is likely indicative of an
404+
overloaded host and allowing ``g_malloc`` to ``exit`` is a reasonable
405+
approach. However for larger allocations where we could realistically
406+
fall-back to a smaller one if need be we should use functions like
407+
``g_try_new`` and check the result. For example this is valid approach
408+
for a time/space trade-off like ``tlb_mmu_resize_locked`` in the
409+
SoftMMU TLB code.
410+
411+
If the lifetime of the allocation is within the function and there are
412+
multiple exist paths you can also improve the readability of the code
413+
by using ``g_autofree`` and related annotations. See :ref:`autofree-ref`
414+
for more details.
415+
416+
Calling ``g_malloc`` with a zero size is valid and will return NULL.
417+
418+
Prefer ``g_new(T, n)`` instead of ``g_malloc(sizeof(T) * n)`` for the following
399419
reasons:
400420

401421
* It catches multiplication overflowing size_t;
@@ -409,8 +429,8 @@ Declarations like
409429
410430
are acceptable, though.
411431

412-
Memory allocated by qemu_memalign or qemu_blockalign must be freed with
413-
qemu_vfree, since breaking this will cause problems on Win32.
432+
Memory allocated by ``qemu_memalign`` or ``qemu_blockalign`` must be freed with
433+
``qemu_vfree``, since breaking this will cause problems on Win32.
414434

415435
String manipulation
416436
===================
@@ -485,6 +505,8 @@ In addition, QEMU assumes that the compiler does not use the latitude
485505
given in C99 and C11 to treat aspects of signed '<<' as undefined, as
486506
documented in the GNU Compiler Collection manual starting at version 4.0.
487507

508+
.. _autofree-ref:
509+
488510
Automatic memory deallocation
489511
=============================
490512

docs/devel/tcg-plugins.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ valid during the lifetime of the callback so it is important that any
6363
information that is needed is extracted during the callback and saved
6464
by the plugin.
6565

66+
API
67+
===
68+
69+
.. kernel-doc:: include/qemu/qemu-plugin.h
70+
6671
Usage
6772
=====
6873

include/sysemu/arch_init.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,13 @@ extern const uint32_t arch_type;
3535
int kvm_available(void);
3636
int xen_available(void);
3737

38+
/* default virtio transport per architecture */
39+
#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \
40+
QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \
41+
QEMU_ARCH_MIPS | QEMU_ARCH_PPC | \
42+
QEMU_ARCH_RISCV | QEMU_ARCH_SH4 | \
43+
QEMU_ARCH_SPARC | QEMU_ARCH_XTENSA)
44+
#define QEMU_ARCH_VIRTIO_CCW (QEMU_ARCH_S390X)
45+
#define QEMU_ARCH_VIRTIO_MMIO (QEMU_ARCH_M68K)
46+
3847
#endif

linux-user/riscv/cpu_loop.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,9 @@ void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs)
135135
error_report("Incompatible ELF: RVE cpu requires RVE ABI binary");
136136
exit(EXIT_FAILURE);
137137
}
138+
139+
ts->stack_base = info->start_stack;
140+
ts->heap_base = info->brk;
141+
/* This will be filled in on the first SYS_HEAPINFO call. */
142+
ts->heap_limit = 0;
138143
}

0 commit comments

Comments
 (0)