From 1d56fd030815d1b7412015f968b1af650e157803 Mon Sep 17 00:00:00 2001 From: Zvonko Kaiser Date: Fri, 6 Dec 2024 00:45:43 +0000 Subject: [PATCH 1/8] qemu: Remove abs path We want to stick with the other build scripts and only use relative paths. Signed-off-by: Zvonko Kaiser --- tools/packaging/static-build/qemu/build-qemu.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/packaging/static-build/qemu/build-qemu.sh b/tools/packaging/static-build/qemu/build-qemu.sh index cab5f251b1f7..15d60a6bb7bd 100755 --- a/tools/packaging/static-build/qemu/build-qemu.sh +++ b/tools/packaging/static-build/qemu/build-qemu.sh @@ -8,7 +8,9 @@ set -o errexit set -o nounset set -o pipefail -kata_packaging_dir="/root/kata-containers/tools/packaging" +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +kata_packaging_dir="${script_dir}/../.." kata_packaging_scripts="${kata_packaging_dir}/scripts" kata_static_build_dir="${kata_packaging_dir}/static-build" From e604e51b3dec4dadd493c23830a58fe0c4689046 Mon Sep 17 00:00:00 2001 From: Zvonko Kaiser Date: Fri, 6 Dec 2024 00:49:02 +0000 Subject: [PATCH 2/8] qemu: Build as user We moved all others artifacts to be build as a user, QEMU should not be the exception Signed-off-by: Zvonko Kaiser --- tools/packaging/static-build/qemu/build-base-qemu.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/packaging/static-build/qemu/build-base-qemu.sh b/tools/packaging/static-build/qemu/build-base-qemu.sh index 4a8f5a3c7036..5105ad0dc4cc 100755 --- a/tools/packaging/static-build/qemu/build-base-qemu.sh +++ b/tools/packaging/static-build/qemu/build-base-qemu.sh @@ -59,9 +59,7 @@ ${container_engine} pull ${container_image} || ("${container_engine}" build \ # No-op unless PUSH_TO_REGISTRY is exported as "yes" push_to_registry "${container_image}") -"${container_engine}" run \ - --rm \ - -i \ +"${container_engine}" run --rm -i \ --env BUILD_SUFFIX="${build_suffix}" \ --env PKGVERSION="${PKGVERSION}" \ --env QEMU_DESTDIR="${qemu_destdir}" \ @@ -71,7 +69,9 @@ ${container_engine} pull ${container_image} || ("${container_engine}" build \ --env HYPERVISOR_NAME="${HYPERVISOR_NAME}" \ --env QEMU_VERSION_NUM="${qemu_version}" \ --env ARCH="${ARCH}" \ - -v "${repo_root_dir}:/root/kata-containers" \ + --user "$(id -u)":"$(id -g)" \ + -w "${PWD}" \ + -v "${repo_root_dir}:${repo_root_dir}" \ -v "${PWD}":/share "${container_image}" \ bash -c "/root/kata-containers/tools/packaging/static-build/qemu/build-qemu.sh" From eef279522616e25502255a221434514b98d38164 Mon Sep 17 00:00:00 2001 From: Zvonko Kaiser Date: Fri, 6 Dec 2024 00:50:07 +0000 Subject: [PATCH 3/8] qemu: Use proper QEMU builder Do not use hardcoded abs path. Use the deduced rel path. Signed-off-by: Zvonko Kaiser --- tools/packaging/static-build/qemu/build-base-qemu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/static-build/qemu/build-base-qemu.sh b/tools/packaging/static-build/qemu/build-base-qemu.sh index 5105ad0dc4cc..727189494351 100755 --- a/tools/packaging/static-build/qemu/build-base-qemu.sh +++ b/tools/packaging/static-build/qemu/build-base-qemu.sh @@ -73,5 +73,5 @@ ${container_engine} pull ${container_image} || ("${container_engine}" build \ -w "${PWD}" \ -v "${repo_root_dir}:${repo_root_dir}" \ -v "${PWD}":/share "${container_image}" \ - bash -c "/root/kata-containers/tools/packaging/static-build/qemu/build-qemu.sh" + bash -c "${qemu_builder}" From c15f77737a02011c8c4b26e678140fd9939144c6 Mon Sep 17 00:00:00 2001 From: Zvonko Kaiser Date: Fri, 6 Dec 2024 00:51:36 +0000 Subject: [PATCH 4/8] qemu: Bump Ubuntu version in Dockerfile We need jammy for a new package that is not available in focal Signed-off-by: Zvonko Kaiser --- tools/packaging/static-build/qemu/Dockerfile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/packaging/static-build/qemu/Dockerfile b/tools/packaging/static-build/qemu/Dockerfile index f8e477f07ae2..b913c59a3083 100644 --- a/tools/packaging/static-build/qemu/Dockerfile +++ b/tools/packaging/static-build/qemu/Dockerfile @@ -2,7 +2,7 @@ # Copyright (c) 2020 Ant Group # # SPDX-License-Identifier: Apache-2.0 -FROM ubuntu:20.04 +FROM ubuntu:22.04 # CACHE_TIMEOUT: date to invalid cache, if the date changes the image will be rebuild # This is required to keep build dependencies with security fixes. @@ -17,13 +17,13 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] RUN if [ "${ARCH}" != "$(uname -m)" ]; then sed -i 's/^deb/deb [arch=amd64]/g' /etc/apt/sources.list && \ dpkg --add-architecture "${DPKG_ARCH#:}" && \ - echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ focal main restricted" >> /etc/apt/sources.list && \ - echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ focal-updates main restricted" >> /etc/apt/sources.list && \ - echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ focal universe" >> /etc/apt/sources.list && \ - echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ focal-updates universe" >> /etc/apt/sources.list && \ - echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ focal multiverse" >> /etc/apt/sources.list && \ - echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ focal-updates multiverse" >> /etc/apt/sources.list && \ - echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ focal-backports main restricted universe multiverse" >> /etc/apt/sources.list; fi + echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ jammy main restricted" >> /etc/apt/sources.list && \ + echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ jammy-updates main restricted" >> /etc/apt/sources.list && \ + echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ jammy universe" >> /etc/apt/sources.list && \ + echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ jammy-updates universe" >> /etc/apt/sources.list && \ + echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ jammy multiverse" >> /etc/apt/sources.list && \ + echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ jammy-updates multiverse" >> /etc/apt/sources.list && \ + echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ jammy-backports main restricted universe multiverse" >> /etc/apt/sources.list; fi RUN apt-get update && apt-get upgrade -y && \ apt-get --no-install-recommends install -y \ From a88174e977484431390beb967ea8581c8b405c23 Mon Sep 17 00:00:00 2001 From: Zvonko Kaiser Date: Fri, 6 Dec 2024 00:53:34 +0000 Subject: [PATCH 5/8] qemu: Replace from source build with package In jammy we have the liburing package available, hence remove the source build and include the package. Signed-off-by: Zvonko Kaiser --- tools/packaging/static-build/qemu/Dockerfile | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tools/packaging/static-build/qemu/Dockerfile b/tools/packaging/static-build/qemu/Dockerfile index b913c59a3083..24331147c50d 100644 --- a/tools/packaging/static-build/qemu/Dockerfile +++ b/tools/packaging/static-build/qemu/Dockerfile @@ -53,6 +53,7 @@ RUN apt-get update && apt-get upgrade -y && \ libpixman-1-dev${DPKG_ARCH} \ libselinux1-dev${DPKG_ARCH} \ libtool${DPKG_ARCH} \ + liburing-dev${DPKG_ARCH} \ make \ ninja-build \ pkg-config${DPKG_ARCH} \ @@ -69,10 +70,3 @@ RUN apt-get update && apt-get upgrade -y && \ if [ "${ARCH}" != "$(uname -m)" ]; then apt-get install --no-install-recommends -y gcc-"${GCC_ARCH}"-linux-gnu; fi && \ apt-get clean && rm -rf /var/lib/apt/lists/ -RUN git clone https://github.com/axboe/liburing/ ~/liburing && \ - cd ~/liburing && \ - git checkout tags/liburing-2.1 && \ - GCC_ARCH="${ARCH}" && if [ "${ARCH}" = "ppc64le" ]; then GCC_ARCH="powerpc64le"; fi && \ - if [ "${ARCH}" != "$(uname -m)" ]; then PREFIX="${GCC_ARCH}-linux-gnu"; fi && \ - ./configure --cc=${GCC_ARCH}-linux-gnu-gcc --cxx=${GCC_ARCH}-linux-gnu-cpp --prefix=/usr/${PREFIX}/ && \ - make && make install && ldconfig From c82db45eaae090572d09d411720f89525ebd10c3 Mon Sep 17 00:00:00 2001 From: Zvonko Kaiser Date: Fri, 6 Dec 2024 00:56:58 +0000 Subject: [PATCH 6/8] qemu: Disable pmem We're disabling pmem support, it is heavilly broken with Ubuntu's static build of QEMU and not needed Signed-off-by: Zvonko Kaiser --- tools/packaging/scripts/configure-hypervisor.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/packaging/scripts/configure-hypervisor.sh b/tools/packaging/scripts/configure-hypervisor.sh index f88536dec57f..6c6d1c1aca28 100755 --- a/tools/packaging/scripts/configure-hypervisor.sh +++ b/tools/packaging/scripts/configure-hypervisor.sh @@ -428,14 +428,13 @@ generate_qemu_options() { if [ "$arch" == x86_64 ]; then qemu_options+=(speed:--enable-avx2) qemu_options+=(speed:--enable-avx512f) - # According to QEMU's nvdimm documentation: When 'pmem' is 'on' and QEMU is - # built with libpmem support, QEMU will take necessary operations to guarantee - # the persistence of its own writes to the vNVDIMM backend. - qemu_options+=(functionality:--enable-libpmem) else qemu_options+=(speed:--disable-avx2) - qemu_options+=(functionality:--disable-libpmem) fi + # We're disabling pmem support, it is heavilly broken with + # Ubuntu's static build of QEMU + qemu_options+=(functionality:--disable-libpmem) + # Enable libc malloc_trim() for memory optimization. qemu_options+=(speed:--enable-malloc-trim) From 69ed4bc3b71d251f01e94713140485b3e3b1615e Mon Sep 17 00:00:00 2001 From: Zvonko Kaiser Date: Fri, 6 Dec 2024 00:52:40 +0000 Subject: [PATCH 7/8] qemu: Add depedency The new QEMU build needs python-tomli, now that we bumped Ubuntu we can include the needed tomli package Signed-off-by: Zvonko Kaiser --- tools/packaging/static-build/qemu/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/packaging/static-build/qemu/Dockerfile b/tools/packaging/static-build/qemu/Dockerfile index 24331147c50d..7a910958f81e 100644 --- a/tools/packaging/static-build/qemu/Dockerfile +++ b/tools/packaging/static-build/qemu/Dockerfile @@ -63,6 +63,7 @@ RUN apt-get update && apt-get upgrade -y && \ python3 \ python3-dev \ python3-venv \ + python3-tomli \ rsync \ zlib1g-dev${DPKG_ARCH} && \ if [ "${ARCH}" != s390x ]; then apt-get install -y --no-install-recommends libpmem-dev${DPKG_ARCH}; fi && \ From cc9ecedaeaf201b37bf7f722366e0c2f21e50e0d Mon Sep 17 00:00:00 2001 From: Zvonko Kaiser Date: Fri, 6 Dec 2024 00:43:27 +0000 Subject: [PATCH 8/8] qemu: Bump version, new options, add no_patches We want to have the latest QEMU version available which is as of this writing v9.1.2 Signed-off-by: Zvonko Kaiser qemu: Add new options for 9.1.2 We need to fence specific options depending on the version and disable ones that are not needed anymore Signed-off-by: Zvonko Kaiser qemu: Add no_patches.txt Since we do not have any patches for this version let's create the appropriate files. Signed-off-by: Zvonko Kaiser --- .../qemu/patches/9.1.x/no_patches.txt | 0 .../patches/tag_patches/v9.1.2/no_patches.txt | 0 .../packaging/scripts/configure-hypervisor.sh | 23 +++++++++++++++---- versions.yaml | 4 ++-- 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 tools/packaging/qemu/patches/9.1.x/no_patches.txt create mode 100644 tools/packaging/qemu/patches/tag_patches/v9.1.2/no_patches.txt diff --git a/tools/packaging/qemu/patches/9.1.x/no_patches.txt b/tools/packaging/qemu/patches/9.1.x/no_patches.txt new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tools/packaging/qemu/patches/tag_patches/v9.1.2/no_patches.txt b/tools/packaging/qemu/patches/tag_patches/v9.1.2/no_patches.txt new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tools/packaging/scripts/configure-hypervisor.sh b/tools/packaging/scripts/configure-hypervisor.sh index 6c6d1c1aca28..6fe9aeb56aa9 100755 --- a/tools/packaging/scripts/configure-hypervisor.sh +++ b/tools/packaging/scripts/configure-hypervisor.sh @@ -222,9 +222,6 @@ generate_qemu_options() { # Disabled options - # Disable block migration in the main migration stream - qemu_options+=(size:--disable-live-block-migration) - # braille support not required qemu_options+=(size:--disable-brlapi) @@ -397,6 +394,23 @@ generate_qemu_options() { qemu_options+=(size:--disable-vhdx) qemu_options+=(size:--disable-hv-balloon) + # Disable various features based on the qemu_version + if gt_eq "${qemu_version}" "9.1.0" ; then + # Disable Query Processing Library support + qemu_options+=(size:--disable-qpl) + # Disable UADK Library support + qemu_options+=(size:--disable-uadk) + # Disable syscall buffer debugging support + qemu_options+=(size:--disable-debug-remap) + + fi + + # Disable gio support + qemu_options+=(size:--disable-gio) + # Disable libdaxctl part of ndctl support + qemu_options+=(size:--disable-libdaxctl) + qemu_options+=(size:--disable-oss) + #--------------------------------------------------------------------- # Enabled options @@ -409,6 +423,7 @@ generate_qemu_options() { # Support Linux AIO (native) qemu_options+=(size:--enable-linux-aio) + qemu_options+=(size:--enable-linux-io-uring) # Support Ceph RADOS Block Device (RBD) [ -z "${static}" ] && qemu_options+=(functionality:--enable-rbd) @@ -427,7 +442,7 @@ generate_qemu_options() { # for that architecture if [ "$arch" == x86_64 ]; then qemu_options+=(speed:--enable-avx2) - qemu_options+=(speed:--enable-avx512f) + qemu_options+=(speed:--enable-avx512bw) else qemu_options+=(speed:--disable-avx2) fi diff --git a/versions.yaml b/versions.yaml index 0691915e6a0a..591cff0a2052 100644 --- a/versions.yaml +++ b/versions.yaml @@ -88,8 +88,8 @@ assets: qemu: description: "VMM that uses KVM" url: "https://github.com/qemu/qemu" - version: "v8.2.4" - tag: "v8.2.4" + version: "v9.1.2" + tag: "v9.1.2" # Do not include any non-full release versions # Break the line *without CR or space being appended*, to appease # yamllint, and note the deliberate ' ' at the end of the expression.