586cba
From fc113ecd7c99646a7ced0b99570b5927ae6d595f Mon Sep 17 00:00:00 2001
495e37
From: Miroslav Rezanina <mrezanin@redhat.com>
495e37
Date: Wed, 26 May 2021 10:56:02 +0200
495e37
Subject: Initial redhat build
495e37
495e37
This patch introduces redhat build structure in redhat subdirectory. In addition,
495e37
several issues are fixed in QEMU tree:
495e37
495e37
- Change of app name for sasl_server_init in VNC code from qemu to qemu-kvm
495e37
 - As we use qemu-kvm as name in all places, this is updated to be consistent
495e37
- Man page renamed from qemu to qemu-kvm
495e37
 - man page is installed using make install so we have to fix it in qemu tree
495e37
495e37
We disable make check due to issues with some of the tests.
495e37
586cba
This rebase is based on qemu-kvm-6.2.0-13.el9
495e37
495e37
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
495e37
--
495e37
Rebase changes (6.1.0):
495e37
- Move build to .distro
495e37
- Move changes for support file to related commit
495e37
- Added dependency for python3-sphinx-rtd_theme
495e37
- Removed --disable-sheepdog configure option
495e37
- Added new hw-display modules
495e37
- SASL initialization moved to ui/vnc-auth-sasl.c
495e37
- Add accel-qtest-<arch> and accel-tcg-x86_64 libraries
495e37
- Added hw-usb-host module
495e37
- Disable new configure options (bpf, nvmm, slirp-smbd)
495e37
- Use -pie for ksmctl build (annocheck complain fix)
495e37
495e37
Rebase changes (6.2.0):
495e37
- removed --disable-jemalloc and --disable-tcmalloc configure options
495e37
- added audio-oss.so
495e37
- added fdt requirement for x86_64
495e37
- tests/acceptance renamed to tests/avocado
495e37
- added multiboot_dma.bin
495e37
- Add -Wno-string-plus-int to extra flags
495e37
- Updated configure options
495e37
586cba
Rebase changes (7.0.0):
586cba
- Do not use -mlittle CFLAG on ppc64le
586cba
- Used upstream handling issue with ui/clipboard.c
586cba
- Use -mlittle-endian on ppc64le instead of deleteing it in configure
586cba
- Drop --disable-libxml2 option for configure (upstream)
586cba
- Remove vof roms
586cba
- Disable AVX2 support
586cba
- Use internal meson
586cba
- Disable new configure options (dbus-display and qga-vss)
586cba
- Change permissions on installing tests/Makefile.include
586cba
- Remove ssh block driver
586cba
495e37
Merged patches (6.0.0):
495e37
 - 605758c902 Limit build on Power to qemu-img and qemu-ga only
495e37
495e37
Merged patches (6.1.0):
495e37
- f04f91751f Use cached tarballs
495e37
- 6581165c65 Remove message with running VM count
495e37
- 03c3cac9fc spec-file: build qemu-kvm without SPICE and QXL
495e37
- e0ae6c1f6c spec-file: Obsolete qemu-kvm-ui-spice
495e37
- 9d2e9f9ecf spec: Do not build qemu-kvm-block-gluster
495e37
- cf470b4234 spec: Do not link pcnet and ne2k_pci roms
495e37
- e981284a6b redhat: Install the s390-netboot.img that we've built
495e37
- 24ef557f33 spec: Remove usage of Group: tag
495e37
- c40d69b4f4 spec: Drop %defattr usage
495e37
- f8e98798ce spec: Clean up BuildRequires
495e37
- 47246b43ee spec: Remove iasl BuildRequires
495e37
- 170dc1cbe0 spec: Remove redundant 0 in conditionals
495e37
- 8718f6fa11 spec: Add more have_XXX conditionals
495e37
- a001269ce9 spec: Remove binutils versioned Requires
495e37
- 34545ee641 spec: Remove diffutils BuildRequires
495e37
- c2c82beac9 spec: Remove redundant Requires:
495e37
- 9314c231f4 spec: Add XXX_version macros
495e37
- c43db0bf0f spec: Add have_block_rbd
495e37
- 3ecb0c0319 qga: drop StandardError=syslog
495e37
- 018049dc80 Remove iscsi support
495e37
- a2edf18777 redhat: Replace the kvm-setup.service with a /etc/modules-load.d config file
495e37
- 387b5fbcfe redhat: Move qemu-kvm-docs dependency to qemu-kvm
495e37
- 4ead693178 redhat: introducting qemu-kvm-hw-usbredir
495e37
- 4dc6fc3035 redhat: use the standard vhost-user JSON path
495e37
- 84757178b4 Fix local build
495e37
- 8c394227dd spec: Restrict block drivers in tools
495e37
- b6aa7c1fae Move tools to separate package
495e37
- eafd82e509 Split qemu-pr-helper to separate package
495e37
- 2c0182e2aa spec: RPM_BUILD_ROOT -> %{buildroot}
495e37
- 91bd55ca13 spec: More use of %{name} instead of 'qemu-kvm'
495e37
- 50ba299c61 spec: Use qemu-pr-helper.service from qemu.git (partial)
495e37
- ee08d4e0a3 spec: Use %{_sourcedir} for referencing sources
495e37
- 039e7f7d02 spec: Add tools_only
495e37
- 884ba71617 spec: %build: Add run_configure helper
495e37
- 8ebd864d65 spec: %build: Disable more bits with %{disable_everything} (partial)
495e37
- f23fdb53f5 spec: %build: Add macros for some 'configure' parameters
495e37
- fe951a8bd8 spec: %files: Move qemu-guest-agent and qemu-img earlier
495e37
- 353b632e37 spec: %install: Remove redundant bits
495e37
- 9d2015b752 spec: %install: Add %{modprobe_kvm_conf} macro
495e37
- 6d05134e8c spec: %install: Remove qemu-guest-agent /etc/qemu-kvm usage
495e37
- 985b226467 spec: %install: clean up qemu-ga section
495e37
- dfaf9c600d spec: %install: Use a single %{tools_only} section
495e37
- f6978ddb46 spec: Make tools_only not cross spec sections
495e37
- 071c211098 spec: %install: Limit time spent in %{qemu_kvm_build}
495e37
- 1b65c674be spec: misc syntactic merges with Fedora
495e37
- 4da16294cf spec: Use Fedora's pattern for specifying rc version
495e37
- d7ee259a79 spec: %files: don't use fine grained -docs file list
495e37
- 64cad0c60f spec: %files: Add licenses to qemu-common too
495e37
- c3de4f080a spec: %install: Drop python3 shebang fixup
495e37
- 46fc216115 Update local build to work with spec file improvements
495e37
- bab9531548 spec: Remove buildldflags
495e37
- c8360ab6a9 spec: Use %make_build macro
495e37
- f6966c66e9 spec: Drop make install sharedir and datadir usage
495e37
- 86982421bc spec: use %make_install macro
495e37
- 191c405d22 spec: parallelize `make check`
495e37
- 251a1fb958 spec: Drop explicit --build-id
495e37
- 44c7dda6c3 spec: use %{build_ldflags}
495e37
- 0009a34354 Move virtiofsd to separate package
495e37
-  34d1b200b3 Utilize --firmware configure option
495e37
- 2800e1dd03 spec: Switch toolchain to Clang/LLVM (except process-patches.sh)
495e37
- e8a70f500f spec: Use safe-stack for x86_64
495e37
- e29445d50d spec: Reenable write support for VMDK etc. in tools
495e37
- a4fe2a3e16 redhat: Disable LTO on non-x86 architectures
495e37
495e37
Merged patches (6.2.0):
495e37
- 333452440b remove sgabios dependency
495e37
- 7d3633f184 enable pulseaudio
495e37
- bd898709b0 spec: disable use of gcrypt for crypto backends in favour of gnutls
495e37
- e4f0c6dee6 spec: Remove block-curl and block-ssh dependency
495e37
- 4dc13bfe63 spec: Build the VDI block driver
495e37
- d2f2ff3c74 spec: Explicitly include compress filter
495e37
- a7d047f9c2 Move ksmtuned files to separate package
495e37
586cba
Merged patches (7.0.0):
586cba
- 098d4d08d0 spec: Rename qemu-kvm-hw-usbredir to qemu-kvm-device-usb-redirect
586cba
- c2bd0d6834 spec: Split qemu-kvm-ui-opengl
586cba
- 2c9cda805d spec: Introduce packages for virtio-gpu-* modules (changed as rhel device tree not set)
586cba
- d0414a3e0b spec: Introduce device-display-virtio-vga* packages
586cba
- 3534ec46d4 spec: Move usb-host module to separate package
586cba
- ddc14d4737 spec: Move qtest accel module to tests package
586cba
- 6f2c4befa6 spec: Extend qemu-kvm-core description
586cba
- 6f11866e4e (rhel/rhel-9.0.0) Update to qemu-kvm-6.2.0-6.el9
586cba
- da0a28758f ui/clipboard: fix use-after-free regression
586cba
- 895d4d52eb spec: Remove qemu-virtiofsd
586cba
- c8c8c8bd84 spec: Fix obsolete for spice subpackages
586cba
- d46d2710b2 spec: Obsolete old usb redir subpackage
586cba
- 6f52a50b68 spec: Obsolete ssh driver
495e37
495e37
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
495e37
---
495e37
 .distro/85-kvm.preset                   |    5 -
495e37
 .distro/Makefile                        |  100 +
586cba
 .distro/Makefile.common                 |   40 +
495e37
 .distro/README.tests                    |   39 +
495e37
 .distro/ksm.service                     |   13 -
495e37
 .distro/ksm.sysconfig                   |    4 -
495e37
 .distro/ksmctl.c                        |   77 -
495e37
 .distro/ksmtuned                        |  139 -
495e37
 .distro/ksmtuned.conf                   |   21 -
495e37
 .distro/ksmtuned.service                |   12 -
495e37
 .distro/kvm-setup                       |   49 -
495e37
 .distro/kvm-setup.service               |   14 -
495e37
 .distro/modules-load.conf               |    4 +
495e37
 .distro/qemu-guest-agent.service        |    1 -
586cba
 .distro/qemu-kvm.spec.template          | 4034 +++++++++++++++++++++++
586cba
 .distro/rpminspect.yaml                 |    6 +-
495e37
 .distro/scripts/extract_build_cmd.py    |   12 +
495e37
 .gitignore                              |    1 +
495e37
 README.systemtap                        |   43 +
495e37
 meson.build                             |    4 +-
495e37
 scripts/qemu-guest-agent/fsfreeze-hook  |    2 +-
495e37
 scripts/systemtap/conf.d/qemu_kvm.conf  |    4 +
495e37
 scripts/systemtap/script.d/qemu_kvm.stp |    1 +
495e37
 tests/check-block.sh                    |    2 +
495e37
 ui/vnc-auth-sasl.c                      |    2 +-
586cba
 25 files changed, 4290 insertions(+), 339 deletions(-)
495e37
 delete mode 100644 .distro/85-kvm.preset
495e37
 create mode 100644 .distro/Makefile
495e37
 create mode 100644 .distro/Makefile.common
495e37
 create mode 100644 .distro/README.tests
495e37
 delete mode 100644 .distro/ksm.service
495e37
 delete mode 100644 .distro/ksm.sysconfig
495e37
 delete mode 100644 .distro/ksmctl.c
495e37
 delete mode 100644 .distro/ksmtuned
495e37
 delete mode 100644 .distro/ksmtuned.conf
495e37
 delete mode 100644 .distro/ksmtuned.service
495e37
 delete mode 100644 .distro/kvm-setup
495e37
 delete mode 100644 .distro/kvm-setup.service
495e37
 create mode 100644 .distro/modules-load.conf
495e37
 create mode 100644 .distro/qemu-kvm.spec.template
495e37
 create mode 100644 README.systemtap
495e37
 create mode 100644 scripts/systemtap/conf.d/qemu_kvm.conf
495e37
 create mode 100644 scripts/systemtap/script.d/qemu_kvm.stp
495e37
495e37
diff --git a/README.systemtap b/README.systemtap
495e37
new file mode 100644
495e37
index 0000000000..ad913fc990
495e37
--- /dev/null
495e37
+++ b/README.systemtap
495e37
@@ -0,0 +1,43 @@
495e37
+QEMU tracing using systemtap-initscript
495e37
+---------------------------------------
495e37
+
495e37
+You can capture QEMU trace data all the time using systemtap-initscript.  This
495e37
+uses SystemTap's flight recorder mode to trace all running guests to a
495e37
+fixed-size buffer on the host.  Old trace entries are overwritten by new
495e37
+entries when the buffer size wraps.
495e37
+
495e37
+1. Install the systemtap-initscript package:
495e37
+  # yum install systemtap-initscript
495e37
+
495e37
+2. Install the systemtap scripts and the conf file:
495e37
+  # cp /usr/share/qemu-kvm/systemtap/script.d/qemu_kvm.stp /etc/systemtap/script.d/
495e37
+  # cp /usr/share/qemu-kvm/systemtap/conf.d/qemu_kvm.conf /etc/systemtap/conf.d/
495e37
+
495e37
+The set of trace events to enable is given in qemu_kvm.stp.  This SystemTap
495e37
+script can be customized to add or remove trace events provided in
495e37
+/usr/share/systemtap/tapset/qemu-kvm-simpletrace.stp.
495e37
+
495e37
+SystemTap customizations can be made to qemu_kvm.conf to control the flight
495e37
+recorder buffer size and whether to store traces in memory only or disk too.
495e37
+See stap(1) for option documentation.
495e37
+
495e37
+3. Start the systemtap service.
495e37
+ # service systemtap start qemu_kvm
495e37
+
495e37
+4. Make the service start at boot time.
495e37
+ # chkconfig systemtap on
495e37
+
495e37
+5. Confirm that the service works.
495e37
+  # service systemtap status qemu_kvm
495e37
+  qemu_kvm is running...
495e37
+
495e37
+When you want to inspect the trace buffer, perform the following steps:
495e37
+
495e37
+1. Dump the trace buffer.
495e37
+  # staprun -A qemu_kvm >/tmp/trace.log
495e37
+
495e37
+2. Start the systemtap service because the preceding step stops the service.
495e37
+  # service systemtap start qemu_kvm
495e37
+
495e37
+3. Translate the trace record to readable format.
495e37
+  # /usr/share/qemu-kvm/simpletrace.py --no-header /usr/share/qemu-kvm/trace-events /tmp/trace.log
495e37
diff --git a/meson.build b/meson.build
586cba
index 861de93c4f..6f7e430f0f 100644
495e37
--- a/meson.build
495e37
+++ b/meson.build
586cba
@@ -2394,7 +2394,9 @@ if capstone_opt == 'internal'
495e37
     # Include all configuration defines via a header file, which will wind up
495e37
     # as a dependency on the object file, and thus changes here will result
495e37
     # in a rebuild.
495e37
-    '-include', 'capstone-defs.h'
495e37
+    '-include', 'capstone-defs.h',
495e37
+
495e37
+    '-Wp,-D_GLIBCXX_ASSERTIONS',
495e37
   ]
495e37
 
495e37
   libcapstone = static_library('capstone',
495e37
diff --git a/scripts/qemu-guest-agent/fsfreeze-hook b/scripts/qemu-guest-agent/fsfreeze-hook
495e37
index 13aafd4845..e9b84ec028 100755
495e37
--- a/scripts/qemu-guest-agent/fsfreeze-hook
495e37
+++ b/scripts/qemu-guest-agent/fsfreeze-hook
495e37
@@ -8,7 +8,7 @@
495e37
 # request, it is issued with "thaw" argument after filesystem is thawed.
495e37
 
495e37
 LOGFILE=/var/log/qga-fsfreeze-hook.log
495e37
-FSFREEZE_D=$(dirname -- "$0")/fsfreeze-hook.d
495e37
+FSFREEZE_D=$(dirname -- "$(realpath $0)")/fsfreeze-hook.d
495e37
 
495e37
 # Check whether file $1 is a backup or rpm-generated file and should be ignored
495e37
 is_ignored_file() {
495e37
diff --git a/scripts/systemtap/conf.d/qemu_kvm.conf b/scripts/systemtap/conf.d/qemu_kvm.conf
495e37
new file mode 100644
495e37
index 0000000000..372d8160a4
495e37
--- /dev/null
495e37
+++ b/scripts/systemtap/conf.d/qemu_kvm.conf
495e37
@@ -0,0 +1,4 @@
495e37
+# Force load uprobes (see BZ#1118352)
495e37
+stap -e 'probe process("/usr/libexec/qemu-kvm").function("main") { printf("") }' -c true
495e37
+
495e37
+qemu_kvm_OPT="-s4" # per-CPU buffer size, in megabytes
495e37
diff --git a/scripts/systemtap/script.d/qemu_kvm.stp b/scripts/systemtap/script.d/qemu_kvm.stp
495e37
new file mode 100644
495e37
index 0000000000..c04abf9449
495e37
--- /dev/null
495e37
+++ b/scripts/systemtap/script.d/qemu_kvm.stp
495e37
@@ -0,0 +1 @@
495e37
+probe qemu.kvm.simpletrace.handle_qmp_command,qemu.kvm.simpletrace.monitor_protocol_*,qemu.kvm.simpletrace.migrate_set_state {}
495e37
diff --git a/tests/check-block.sh b/tests/check-block.sh
586cba
index f59496396c..d900d8b35e 100755
495e37
--- a/tests/check-block.sh
495e37
+++ b/tests/check-block.sh
586cba
@@ -48,6 +48,8 @@ if LANG=C bash --version | grep -q 'GNU bash, version [123]' ; then
586cba
     skip "bash version too old ==> Not running the qemu-iotests."
495e37
 fi
495e37
 
495e37
+exit 0
495e37
+
495e37
 cd tests/qemu-iotests
495e37
 
495e37
 # QEMU_CHECK_BLOCK_AUTO is used to disable some unstable sub-tests
495e37
diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c
495e37
index 47fdae5b21..2a950caa2a 100644
495e37
--- a/ui/vnc-auth-sasl.c
495e37
+++ b/ui/vnc-auth-sasl.c
495e37
@@ -42,7 +42,7 @@
495e37
 
495e37
 bool vnc_sasl_server_init(Error **errp)
495e37
 {
495e37
-    int saslErr = sasl_server_init(NULL, "qemu");
495e37
+    int saslErr = sasl_server_init(NULL, "qemu-kvm");
495e37
 
495e37
     if (saslErr != SASL_OK) {
495e37
         error_setg(errp, "Failed to initialize SASL auth: %s",
495e37
-- 
586cba
2.31.1
495e37