* Mon Jan 20 2025 Miroslav Rezanina <mrezanin@redhat.com> - 9.1.0-11

- kvm-target-i386-Make-sure-SynIC-state-is-really-updated-.patch [RHEL-73002]
- kvm-hw-virtio-fix-crash-in-processing-balloon-stats.patch [RHEL-73835]
- kvm-qga-Add-log-to-guest-fsfreeze-thaw-command.patch [RHEL-74361]
- kvm-qemu-ga-Optimize-freeze-hook-script-logic-of-logging.patch [RHEL-74461]
- Resolves: RHEL-73002
  (kvm-unti kvm-hyperv_synic test is stuck on AMD with COS9 [rhel-10])
- Resolves: RHEL-73835
  (VM crashes when requesting domstats [rhel-10])
- Resolves: RHEL-74361
  (qemu-ga logs only "guest-fsfreeze called" (but not "guest-fsthaw called"))
- Resolves: RHEL-74461
  (fsfreeze hooks doesn't log error on system logs when running hook fails [rhel-10])
This commit is contained in:
Miroslav Rezanina 2025-01-20 05:18:29 -05:00
parent e4745a1a97
commit 7b35fb4485
5 changed files with 323 additions and 1 deletions

View File

@ -0,0 +1,102 @@
From 58ad1bbfe399cecf0f05ebc70d2d3189fb78851d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Fri, 29 Nov 2024 13:55:05 +0000
Subject: [PATCH 2/4] hw/virtio: fix crash in processing balloon stats
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Thomas Huth <thuth@redhat.com>
RH-MergeRequest: 322: hw/virtio: fix crash in processing balloon stats
RH-Jira: RHEL-73835
RH-Acked-by: Cédric Le Goater <clg@redhat.com>
RH-Acked-by: Daniel P. Berrangé <berrange@redhat.com>
RH-Commit: [1/1] 7a0f9b816b1ce5f82ae6d0f4686fbb2ca0632e00 (thuth/qemu-kvm-cs9)
balloon_stats_get_all will iterate over guest stats upto the max
VIRTIO_BALLOON_S_NR value, calling visit_type_uint64 to populate
the QObject dict. The dict keys are obtained from the static
array balloon_stat_names which is VIRTIO_BALLOON_S_NR in size.
Unfortunately the way that array is declared results in any
unassigned stats getting a NULL name, which will then cause
visit_type_uint64 to trigger an assert in qobject_output_add_obj.
The balloon_stat_names array was fortunately fully populated with
names until recently:
commit 0d2eeef77a33315187df8519491a900bde4a3d83
Author: Bibo Mao <maobibo@loongson.cn>
Date: Mon Oct 28 10:38:09 2024 +0800
linux-headers: Update to Linux v6.12-rc5
pulled a change to include/standard-headers/linux/virtio_balloon.h
which increased VIRTIO_BALLOON_S_NR by 6, and failed to add the new
names to balloon_stat_names.
This commit fills in the missing names, and uses a static assert to
guarantee that any future changes to VIRTIO_BALLOON_S_NR will cause
a build failure until balloon_stat_names is updated.
This problem was detected by the Cockpit Project's automated
integration tests on QEMU 9.2.0-rc1.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2329448
Fixes: 0d2eeef77a3 ("linux-headers: Update to Linux v6.12-rc5")
Reported-by: Martin Pitt <mpitt@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20241129135507.699030-2-berrange@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit bff1050a5630ce5da6f43ed002725d52140bb9e6)
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
hw/virtio/virtio-balloon.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 609e39a821..afd2ad6dd6 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -167,19 +167,33 @@ static void balloon_deflate_page(VirtIOBalloon *balloon,
}
}
+/*
+ * All stats upto VIRTIO_BALLOON_S_NR /must/ have a
+ * non-NULL name declared here, since these are used
+ * as keys for populating the QDict with stats
+ */
static const char *balloon_stat_names[] = {
[VIRTIO_BALLOON_S_SWAP_IN] = "stat-swap-in",
[VIRTIO_BALLOON_S_SWAP_OUT] = "stat-swap-out",
[VIRTIO_BALLOON_S_MAJFLT] = "stat-major-faults",
[VIRTIO_BALLOON_S_MINFLT] = "stat-minor-faults",
[VIRTIO_BALLOON_S_MEMFREE] = "stat-free-memory",
+
[VIRTIO_BALLOON_S_MEMTOT] = "stat-total-memory",
[VIRTIO_BALLOON_S_AVAIL] = "stat-available-memory",
[VIRTIO_BALLOON_S_CACHES] = "stat-disk-caches",
[VIRTIO_BALLOON_S_HTLB_PGALLOC] = "stat-htlb-pgalloc",
[VIRTIO_BALLOON_S_HTLB_PGFAIL] = "stat-htlb-pgfail",
- [VIRTIO_BALLOON_S_NR] = NULL
+
+ [VIRTIO_BALLOON_S_OOM_KILL] = "stat-oom-kills",
+ [VIRTIO_BALLOON_S_ALLOC_STALL] = "stat-alloc-stalls",
+ [VIRTIO_BALLOON_S_ASYNC_SCAN] = "stat-async-scans",
+ [VIRTIO_BALLOON_S_DIRECT_SCAN] = "stat-direct-scans",
+ [VIRTIO_BALLOON_S_ASYNC_RECLAIM] = "stat-async-reclaims",
+
+ [VIRTIO_BALLOON_S_DIRECT_RECLAIM] = "stat-direct-reclaims",
};
+G_STATIC_ASSERT(G_N_ELEMENTS(balloon_stat_names) == VIRTIO_BALLOON_S_NR);
/*
* reset_stats - Mark all items in the stats array as unset
--
2.39.3

View File

@ -0,0 +1,80 @@
From 14fc984df8059560815cc1f55f058569fe480832 Mon Sep 17 00:00:00 2001
From: Dehan Meng <demeng@redhat.com>
Date: Wed, 25 Dec 2024 16:37:44 +0800
Subject: [PATCH 4/4] qemu-ga: Optimize freeze-hook script logic of logging
error
RH-Author: 6-dehan <demeng@redhat.com>
RH-MergeRequest: 326: qemu-ga: Optimize freeze-hook script logic of logging error
RH-Jira: RHEL-74461
RH-Acked-by: Konstantin Kostiuk <None>
RH-Acked-by: Yan Vugenfirer <None>
RH-Commit: [1/1] f133428aa9b511a93e528823e8253a41d46e1de5 (6-dehan/centos-qemu-kvm)
Make sure the error log of fsfreeze hooks
when freeze/thaw/snapshot could be logged
to system logs if the default logfile of
qga can't be written or other situations
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Reviewed-by: Yan Vugenfirer <yvugenfi@redhat.com>
Signed-off-by: Dehan Meng <demeng@redhat.com>
---
scripts/qemu-guest-agent/fsfreeze-hook | 36 +++++++++++++++++++++++---
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/scripts/qemu-guest-agent/fsfreeze-hook b/scripts/qemu-guest-agent/fsfreeze-hook
index 70536ba3e3..d5d8d4daf8 100755
--- a/scripts/qemu-guest-agent/fsfreeze-hook
+++ b/scripts/qemu-guest-agent/fsfreeze-hook
@@ -19,15 +19,43 @@ is_ignored_file() {
return 1
}
+USE_SYSLOG=0
+# if log file is not writable, fallback to syslog
+[ ! -w "$LOGFILE" ] && USE_SYSLOG=1
+# try to update log file and fallback to syslog if it fails
+touch "$LOGFILE" &>/dev/null || USE_SYSLOG=1
+
+# Ensure the log file is writable, fallback to syslog if not
+log_message() {
+ local message="$1"
+ if [ "$USE_SYSLOG" -eq 0 ]; then
+ printf "%s: %s\n" "$(date)" "$message" >>"$LOGFILE"
+ else
+ logger -t qemu-ga-freeze-hook "$message"
+ fi
+}
+
# Iterate executables in directory "fsfreeze-hook.d" with the specified args
[ ! -d "$FSFREEZE_D" ] && exit 0
+
for file in "$FSFREEZE_D"/* ; do
is_ignored_file "$file" && continue
[ -x "$file" ] || continue
- printf "$(date): execute $file $@\n" >>$LOGFILE
- "$file" "$@" >>$LOGFILE 2>&1
- STATUS=$?
- printf "$(date): $file finished with status=$STATUS\n" >>$LOGFILE
+
+ log_message "Executing $file $@"
+ if [ "$USE_SYSLOG" -eq 0 ]; then
+ "$file" "$@" >>"$LOGFILE" 2>&1
+ STATUS=$?
+ else
+ "$file" "$@" 2>&1 | logger -t qemu-ga-freeze-hook
+ STATUS=${PIPESTATUS[0]}
+ fi
+
+ if [ $STATUS -ne 0 ]; then
+ log_message "Error: $file finished with status=$STATUS"
+ else
+ log_message "$file finished successfully"
+ fi
done
exit 0
--
2.39.3

View File

@ -0,0 +1,54 @@
From 53cc229c86bd0c555cdf68adb75918bec6c525fb Mon Sep 17 00:00:00 2001
From: Konstantin Kostiuk <kkostiuk@redhat.com>
Date: Mon, 16 Dec 2024 17:45:52 +0200
Subject: [PATCH 3/4] qga: Add log to guest-fsfreeze-thaw command
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: 6-dehan <demeng@redhat.com>
RH-MergeRequest: 325: qga: Add log to guest-fsfreeze-thaw command
RH-Jira: RHEL-74361
RH-Acked-by: Konstantin Kostiuk <None>
RH-Acked-by: Yan Vugenfirer <None>
RH-Commit: [1/1] a6f5a87f592136857fb76b8261d1de98f1d28772 (6-dehan/centos-qemu-kvm)
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
qga/commands-posix.c | 2 ++
qga/commands-win32.c | 3 +++
2 files changed, 5 insertions(+)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index c2bd0b4316..49e40f9127 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -806,8 +806,10 @@ int64_t qmp_guest_fsfreeze_thaw(Error **errp)
int ret;
ret = qmp_guest_fsfreeze_do_thaw(errp);
+
if (ret >= 0) {
ga_unset_frozen(ga_state);
+ slog("guest-fsthaw called");
execute_fsfreeze_hook(FSFREEZE_HOOK_THAW, errp);
} else {
ret = 0;
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 61b36da469..1aea6cd167 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -1273,6 +1273,9 @@ int64_t qmp_guest_fsfreeze_thaw(Error **errp)
qga_vss_fsfreeze(&i, false, NULL, errp);
ga_unset_frozen(ga_state);
+
+ slog("guest-fsthaw called");
+
return i;
}
--
2.39.3

View File

@ -0,0 +1,64 @@
From 327e8c65d28dc357c02b508e6485e7c57d4d1efa Mon Sep 17 00:00:00 2001
From: Vitaly Kuznetsov <vkuznets@redhat.com>
Date: Tue, 7 Jan 2025 13:43:32 +0100
Subject: [PATCH 1/4] target/i386: Make sure SynIC state is really updated
before KVM_RUN
RH-Author: Vitaly Kuznetsov <vkuznets@redhat.com>
RH-MergeRequest: 314: target/i386: Make sure SynIC state is really updated before KVM_RUN
RH-Jira: RHEL-73002
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Maxim Levitsky <None>
RH-Commit: [1/1] 2d8f7605e3efd3c76d16a2cb9e7c0898786fb4e9 (vkuznets/qemu-kvm)
'hyperv_synic' test from KVM unittests was observed to be flaky on certain
hardware (hangs sometimes). Debugging shows that the problem happens in
hyperv_sint_route_new() when the test tries to set up a new SynIC
route. The function bails out on:
if (!synic->sctl_enabled) {
goto cleanup;
}
but the test writes to HV_X64_MSR_SCONTROL just before it starts
establishing SINT routes. Further investigation shows that
synic_update() (called from async_synic_update()) happens after the SINT
setup attempt and not before. Apparently, the comment before
async_safe_run_on_cpu() in kvm_hv_handle_exit() does not correctly describe
the guarantees async_safe_run_on_cpu() gives. In particular, async worked
added to a CPU is actually processed from qemu_wait_io_event() which is not
always called before KVM_RUN, i.e. kvm_cpu_exec() checks whether an exit
request is pending for a CPU and if not, keeps running the vCPU until it
meets an exit it can't handle internally. Hyper-V specific MSR writes are
not automatically trigger an exit.
Fix the issue by simply raising an exit request for the vCPU where SynIC
update was queued. This is not a performance critical path as SynIC state
does not get updated so often (and async_safe_run_on_cpu() is a big hammer
anyways).
Reported-by: Jan Richter <jarichte@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Link: https://lore.kernel.org/r/20240917160051.2637594-4-vkuznets@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit d3177e2e4353824a650434c57471615d43507500)
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
target/i386/kvm/hyperv.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/target/i386/kvm/hyperv.c b/target/i386/kvm/hyperv.c
index b94f12acc2..70b89cacf9 100644
--- a/target/i386/kvm/hyperv.c
+++ b/target/i386/kvm/hyperv.c
@@ -80,6 +80,7 @@ int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit)
* necessary because memory hierarchy is being changed
*/
async_safe_run_on_cpu(CPU(cpu), async_synic_update, RUN_ON_CPU_NULL);
+ cpu_exit(CPU(cpu));
return EXCP_INTERRUPT;
case KVM_EXIT_HYPERV_HCALL: {
--
2.39.3

View File

@ -143,7 +143,7 @@ Obsoletes: %{name}-block-ssh <= %{epoch}:%{version} \
Summary: QEMU is a machine emulator and virtualizer
Name: qemu-kvm
Version: 9.1.0
Release: 10%{?rcrel}%{?dist}%{?cc_suffix}
Release: 11%{?rcrel}%{?dist}%{?cc_suffix}
# Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped
# Epoch 15 used for RHEL 8
# Epoch 17 used for RHEL 9 (due to release versioning offset in RHEL 8.5)
@ -410,6 +410,14 @@ Patch116: kvm-pc-q35-Bump-max_cpus-to-4096-vcpus.patch
Patch117: kvm-vhost-fail-device-start-if-iotlb-update-fails.patch
# For RHEL-69500 - [Stable_Guest_ABI][USO][9.6.0-machine-type]From 10.0 to RHEL.9.6.0 the guest with 9.6 machine type only, the guest crashed with - qemu-kvm: Features 0x1c0010130afffa7 unsupported. Allowed features: 0x10179bfffe7
Patch118: kvm-virtio-net-disable-USO-for-all-RHEL9.patch
# For RHEL-73002 - kvm-unti kvm-hyperv_synic test is stuck on AMD with COS9 [rhel-10]
Patch119: kvm-target-i386-Make-sure-SynIC-state-is-really-updated-.patch
# For RHEL-73835 - VM crashes when requesting domstats [rhel-10]
Patch120: kvm-hw-virtio-fix-crash-in-processing-balloon-stats.patch
# For RHEL-74361 - qemu-ga logs only "guest-fsfreeze called" (but not "guest-fsthaw called")
Patch121: kvm-qga-Add-log-to-guest-fsfreeze-thaw-command.patch
# For RHEL-74461 - fsfreeze hooks doesn't log error on system logs when running hook fails [rhel-10]
Patch122: kvm-qemu-ga-Optimize-freeze-hook-script-logic-of-logging.patch
%if %{have_clang}
BuildRequires: clang
@ -1476,6 +1484,20 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
%endif
%changelog
* Mon Jan 20 2025 Miroslav Rezanina <mrezanin@redhat.com> - 9.1.0-11
- kvm-target-i386-Make-sure-SynIC-state-is-really-updated-.patch [RHEL-73002]
- kvm-hw-virtio-fix-crash-in-processing-balloon-stats.patch [RHEL-73835]
- kvm-qga-Add-log-to-guest-fsfreeze-thaw-command.patch [RHEL-74361]
- kvm-qemu-ga-Optimize-freeze-hook-script-logic-of-logging.patch [RHEL-74461]
- Resolves: RHEL-73002
(kvm-unti kvm-hyperv_synic test is stuck on AMD with COS9 [rhel-10])
- Resolves: RHEL-73835
(VM crashes when requesting domstats [rhel-10])
- Resolves: RHEL-74361
(qemu-ga logs only "guest-fsfreeze called" (but not "guest-fsthaw called"))
- Resolves: RHEL-74461
(fsfreeze hooks doesn't log error on system logs when running hook fails [rhel-10])
* Mon Jan 13 2025 Miroslav Rezanina <mrezanin@redhat.com> - 9.1.0-10
- kvm-qdev-Fix-set_pci_devfn-to-visit-option-only-once.patch [RHEL-43412]
- kvm-tests-avocado-hotplug_blk-Fix-addr-in-device_add-com.patch [RHEL-43412]