From b3ec5c5cc8ed777c5c2cd1bd27f6684a99317953 Mon Sep 17 00:00:00 2001 From: Miroslav Rezanina Date: Fri, 12 Oct 2018 07:31:11 +0200 Subject: Initial redhat build This patch introduces redhat build structure in redhat subdirectory. In addition, several issues are fixed in QEMU tree: - Change of app name for sasl_server_init in VNC code from qemu to qemu-kvm - As we use qemu-kvm as name in all places, this is updated to be consistent - Man page renamed from qemu to qemu-kvm - man page is installed using make install so we have to fix it in qemu tree This rebase includes changes up to qemu-kvm-5.1.0-15.el8 Rebase notes (3.1.0): - added new configure options Rebase notes (4.0.0): - Added dependency to perl-Test-Harness (upstream) - Added dependency to python3-sphinx (upstream) - Change location of icons (upstream) - Remove .desktop file (added upstream) - Added qemu-trace-stap (added upstream) - Removed elf2dmp (added upstream) - Remove .buildinfo - Added pvh.bin rom (added upstream) - Added interop documentation files - Use python module instead of qemu.py (upstream) Rebase notes (4.1.0): - Remove edk2 files generated by build - Switch to rhel-8.1-candidate build target - Remove specs documentation - Switched from libssh2 to libssh - Add rc0 tarball usage hacks - Added BuildRequires for wget, rpm-build and python3-sphinx - Removed new unpacked files - Update configure line to use new options Rebase notes (4.2.0): - Disable iotest run during make check - README renamed to README.rst (upstream) - Removed ui-spice-app.so - Added relevant changes from "505f7f4 redhat: Adding slirp to the exploded tree" - Removed qemu-ga.8 install from spec file - installed by make - Removed spapr-rtas.bin (upstream) - Require newer SLOF (20191022) Rebase notes (5.1.0): - Use python3 for virtio_seg_max_adjust.py test - Removed qemu-trace-stap shebang from spec file - Added virtiofsd.1 (upstream) - Use out-of-tree build - New documentation structure (upstream) - Update local build - Removing installed qemu-storage-daemon (added upstream) - Removing opensbi-riscv32-sifive_u-fw_jump.bin (added upstream) - Disable iotests (moved from Enable make check commit) - Added missing configure options - Reorder configure options - qemu-pr-helper moved to /usr/libexec/ (upstream) - Added submodules for usb-redir, smartcard-reader and qxl display (upstream) - Added setting rc version in Makefile for build - removed --disable-vxhs configure option (removed upstream) - bumped required libusbx-devel version to 1.0.23 - bumped libfdt version to 1.6.0 Rebase notes (5.2.0 rc0): - Move libfdt dependency to qemu-kvm-core - Move manpage rename from Makefile to spec file - rename with-confsuffix configure option to with-suffix (upstream) - Bump libusbx Requires version to 1.0.234 - Manual copy of keymaps in spec file (BZ 1875217) - Removed /usr/share/qemu-kvm/npcm7xx_bootrom.bin, considering it unpackaged for now. - Removed /usr/share/qemu-kvm/qboot.rom, considering unpackaged. - Added build dependency for meson and ninja-build - hw/s390/s390-pci-vfio.c hack - set NULL for g_autofree variables - Removed Chanelog (upstream) - Fix in directory used for docs (upstream add %name so we do not pass it in configure) - Package various .so as part of qemu-kvm-core package. Rebase notes (5.2.0 rc2): - Added fix for dtrace build on RHEL 8.4.0 Rebase notes (5.2.0 rc3): - Added man page for qemu-pr-helper - Added new configure options - Update qemu-kiwi patches to v4 Merged patches (3.1.0): - 01f0c9f RHEL8: Add disable configure options to qemu spec file - Spec file cleanups Merged patches (4.0.0): - aa4297c Add edk2 Requires to qemu-kvm - d124ff5779 Fixing brew build target - eb204b5 Introduce the qemu-kvm-tests rpm - 223cf0c Load kvm module during boot (partial) Merged patches (4.1.0): - ebb6e97 redhat: Fix LOCALVERSION creation - b0ab0cc redhat: enable tpmdev passthrough (not disabling tests) - 7cb3c4a Enable libpmem to support nvdimm - 8943607 qemu-kvm.spec: bump libseccomp >= 2.4.0 - 27b7c44 rh: set CONFIG_BOCHS_DISPLAY=y for x86 (partial) - e1fe9fe x86_64-rh-devices: enable TPM emulation (partial) Merged patches (4.2.0): - 69e1fb2 enable virgla - d4f6115 enable virgl, for real this time ... Merged patches (5.1.0): - 5edf6bd Add support for rh-brew-module - f77d52d redhat: ship virtiofsd vhost-user device backend - 63f12d4 redhat: Always use module build target for rh-brew (modified) - 9b1e140 redhat: updating the modular target - 44b8bd0 spec: Fix python shenigans for tests Merged patches (5.2.0 rc0): - 9238ce7 Add support for simpletrace - 5797cff Remove explicit glusterfs-api dependency - fd62478 disable virgl - 0205018 redhat: link /etc/qemu-ga/fsfreeze-hook to /etc/qemu-kvm/ - 3645097 redhat: Make all generated so files executable (not only block-*) Merged patches (5.2.0 rc2): - pjw 99657 redhat: introduces disable_everything macro into the configure call - pjw 99659 redhat: scripts/extract_build_cmd.py - Avoid listing empty lines - pjw 99658 redhat: Fixing rh-local build - pjw 99660 redhat: Add qemu-kiwi subpackage - d2e59ce redhat: add (un/pre)install systemd hooks for qemu-ga Merged patches (5.2.0 rc3): - pjw 99887 - redhat: allow Makefile rh-prep builddep to fail - pjw 99885 - redhat: adding rh-rpm target --- .gitignore | 1 + README.systemtap | 43 + hw/s390x/s390-pci-vfio.c | 4 +- meson.build | 4 +- redhat/Makefile | 90 + redhat/Makefile.common | 53 + redhat/README.tests | 39 + redhat/qemu-kvm.spec.template | 3409 +++++++++++++++++++++++++++++++ redhat/scripts/extract_build_cmd.py | 5 +- redhat/scripts/process-patches.sh | 17 +- scripts/qemu-guest-agent/fsfreeze-hook | 2 +- scripts/systemtap/conf.d/qemu_kvm.conf | 4 + scripts/systemtap/script.d/qemu_kvm.stp | 1 + tests/check-block.sh | 2 + ui/vnc.c | 2 +- 15 files changed, 3660 insertions(+), 16 deletions(-) create mode 100644 README.systemtap create mode 100644 redhat/Makefile create mode 100644 redhat/Makefile.common create mode 100644 redhat/README.tests create mode 100644 redhat/qemu-kvm.spec.template create mode 100644 scripts/systemtap/conf.d/qemu_kvm.conf create mode 100644 scripts/systemtap/script.d/qemu_kvm.stp diff --git a/README.systemtap b/README.systemtap new file mode 100644 index 0000000..ad913fc --- /dev/null +++ b/README.systemtap @@ -0,0 +1,43 @@ +QEMU tracing using systemtap-initscript +--------------------------------------- + +You can capture QEMU trace data all the time using systemtap-initscript. This +uses SystemTap's flight recorder mode to trace all running guests to a +fixed-size buffer on the host. Old trace entries are overwritten by new +entries when the buffer size wraps. + +1. Install the systemtap-initscript package: + # yum install systemtap-initscript + +2. Install the systemtap scripts and the conf file: + # cp /usr/share/qemu-kvm/systemtap/script.d/qemu_kvm.stp /etc/systemtap/script.d/ + # cp /usr/share/qemu-kvm/systemtap/conf.d/qemu_kvm.conf /etc/systemtap/conf.d/ + +The set of trace events to enable is given in qemu_kvm.stp. This SystemTap +script can be customized to add or remove trace events provided in +/usr/share/systemtap/tapset/qemu-kvm-simpletrace.stp. + +SystemTap customizations can be made to qemu_kvm.conf to control the flight +recorder buffer size and whether to store traces in memory only or disk too. +See stap(1) for option documentation. + +3. Start the systemtap service. + # service systemtap start qemu_kvm + +4. Make the service start at boot time. + # chkconfig systemtap on + +5. Confirm that the service works. + # service systemtap status qemu_kvm + qemu_kvm is running... + +When you want to inspect the trace buffer, perform the following steps: + +1. Dump the trace buffer. + # staprun -A qemu_kvm >/tmp/trace.log + +2. Start the systemtap service because the preceding step stops the service. + # service systemtap start qemu_kvm + +3. Translate the trace record to readable format. + # /usr/share/qemu-kvm/simpletrace.py --no-header /usr/share/qemu-kvm/trace-events /tmp/trace.log diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c index 9296e1b..f70c5a8 100644 --- a/hw/s390x/s390-pci-vfio.c +++ b/hw/s390x/s390-pci-vfio.c @@ -28,7 +28,7 @@ */ bool s390_pci_update_dma_avail(int fd, unsigned int *avail) { - g_autofree struct vfio_iommu_type1_info *info; + g_autofree struct vfio_iommu_type1_info *info = NULL; uint32_t argsz; assert(avail); @@ -229,7 +229,7 @@ static void s390_pci_read_pfip(S390PCIBusDevice *pbdev, */ void s390_pci_get_clp_info(S390PCIBusDevice *pbdev) { - g_autofree struct vfio_device_info *info; + g_autofree struct vfio_device_info *info = NULL; VFIOPCIDevice *vfio_pci; uint32_t argsz; int fd; diff --git a/meson.build b/meson.build index 5062407..c1db9b8 100644 --- a/meson.build +++ b/meson.build @@ -1149,7 +1149,9 @@ if capstone_opt == 'internal' # Include all configuration defines via a header file, which will wind up # as a dependency on the object file, and thus changes here will result # in a rebuild. - '-include', 'capstone-defs.h' + '-include', 'capstone-defs.h', + + '-Wp,-D_GLIBCXX_ASSERTIONS', ] libcapstone = static_library('capstone', diff --git a/scripts/qemu-guest-agent/fsfreeze-hook b/scripts/qemu-guest-agent/fsfreeze-hook index 13aafd4..e9b84ec 100755 --- a/scripts/qemu-guest-agent/fsfreeze-hook +++ b/scripts/qemu-guest-agent/fsfreeze-hook @@ -8,7 +8,7 @@ # request, it is issued with "thaw" argument after filesystem is thawed. LOGFILE=/var/log/qga-fsfreeze-hook.log -FSFREEZE_D=$(dirname -- "$0")/fsfreeze-hook.d +FSFREEZE_D=$(dirname -- "$(realpath $0)")/fsfreeze-hook.d # Check whether file $1 is a backup or rpm-generated file and should be ignored is_ignored_file() { diff --git a/scripts/systemtap/conf.d/qemu_kvm.conf b/scripts/systemtap/conf.d/qemu_kvm.conf new file mode 100644 index 0000000..372d816 --- /dev/null +++ b/scripts/systemtap/conf.d/qemu_kvm.conf @@ -0,0 +1,4 @@ +# Force load uprobes (see BZ#1118352) +stap -e 'probe process("/usr/libexec/qemu-kvm").function("main") { printf("") }' -c true + +qemu_kvm_OPT="-s4" # per-CPU buffer size, in megabytes diff --git a/scripts/systemtap/script.d/qemu_kvm.stp b/scripts/systemtap/script.d/qemu_kvm.stp new file mode 100644 index 0000000..c04abf9 --- /dev/null +++ b/scripts/systemtap/script.d/qemu_kvm.stp @@ -0,0 +1 @@ +probe qemu.kvm.simpletrace.handle_qmp_command,qemu.kvm.simpletrace.monitor_protocol_*,qemu.kvm.simpletrace.migrate_set_state {} diff --git a/tests/check-block.sh b/tests/check-block.sh index f6b1bda..645b550 100755 --- a/tests/check-block.sh +++ b/tests/check-block.sh @@ -58,6 +58,8 @@ if ! (sed --version | grep 'GNU sed') > /dev/null 2>&1 ; then fi fi +exit 0 + cd tests/qemu-iotests # QEMU_CHECK_BLOCK_AUTO is used to disable some unstable sub-tests diff --git a/ui/vnc.c b/ui/vnc.c index 4923505..eb5520e 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3982,7 +3982,7 @@ void vnc_display_open(const char *id, Error **errp) #ifdef CONFIG_VNC_SASL if (sasl) { - int saslErr = sasl_server_init(NULL, "qemu"); + int saslErr = sasl_server_init(NULL, "qemu-kvm"); if (saslErr != SASL_OK) { error_setg(errp, "Failed to initialize SASL auth: %s", -- 1.8.3.1