import OL qemu-kvm-9.1.0-29.el9_7.6
This commit is contained in:
parent
10664bf57f
commit
55a4ebb850
@ -0,0 +1,74 @@
|
||||
From 4ee660087a19801d660ce8c4df172ea8e35ca0cf Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Bonzini <pbonzini@redhat.com>
|
||||
Date: Fri, 12 Dec 2025 00:48:42 +0100
|
||||
Subject: [PATCH] Revert "i386/cpu: Move adjustment of CPUID_EXT_PDCM before
|
||||
feature_dependencies[] check"
|
||||
|
||||
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-MergeRequest: 524: Revert "i386/cpu: Move adjustment of CPUID_EXT_PDCM before feature_dependencies[] check"
|
||||
RH-Jira: RHEL-135451
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
||||
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
RH-Commit: [1/1] 26f2a271f44f6cb115005a28f9fb5b5eaf88589c
|
||||
|
||||
JIRA: https://issues.redhat.com/browse/RHEL-135451
|
||||
|
||||
This reverts commit 8a277943ace0616783b83af301b78a56b0607e20.
|
||||
|
||||
Quoting from commit 6529f31e0dc ("target/i386: add compatibility
|
||||
property for pdcm feature", 2025-10-07):
|
||||
|
||||
The pdcm feature is supposed to be disabled when PMU is not
|
||||
available. Up until v10.1, pdcm feature is enabled even when PMU
|
||||
is off. This behavior has been fixed but this change breaks the
|
||||
migration of VMs that are run with QEMU < 10.0 and expect the pdcm
|
||||
feature to be enabled on the destination host.
|
||||
|
||||
This commit restores the legacy behavior for machines with version
|
||||
prior to 10.1 to allow the migration from older QEMU to QEMU 10.1.
|
||||
|
||||
Signed-off-by: Hector Cao <hector.cao@canonical.com>
|
||||
Link: https://lore.kernel.org/r/20250910115733.21149-3-hector.cao@canonical.com
|
||||
Fixes: e68ec298090 ("i386/cpu: Move adjustment of CPUID_EXT_PDCM before feature_dependencies[] check", 2025-06-20)
|
||||
[Move property from migration object to CPU. - Paolo]
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
|
||||
For RHEL9.7 we don't have machine types so just revert, while keeping only
|
||||
the TDX check.
|
||||
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
---
|
||||
target/i386/cpu.c | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
|
||||
index f75cc04cd3..5f94887ab5 100644
|
||||
--- a/target/i386/cpu.c
|
||||
+++ b/target/i386/cpu.c
|
||||
@@ -7028,6 +7028,10 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
|
||||
if (threads_per_pkg > 1) {
|
||||
*ebx |= threads_per_pkg << 16;
|
||||
}
|
||||
+ /* PDCM is fixed1 bit for TDX */
|
||||
+ if (!cpu->enable_pmu && !is_tdx_vm()) {
|
||||
+ *ecx &= ~CPUID_EXT_PDCM;
|
||||
+ }
|
||||
break;
|
||||
case 2:
|
||||
/* cache info: needed for Pentium Pro compatibility */
|
||||
@@ -8012,11 +8016,6 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
|
||||
}
|
||||
}
|
||||
|
||||
- /* PDCM is fixed1 bit for TDX */
|
||||
- if (!cpu->enable_pmu && !is_tdx_vm()) {
|
||||
- env->features[FEAT_1_ECX] &= ~CPUID_EXT_PDCM;
|
||||
- }
|
||||
-
|
||||
for (i = 0; i < ARRAY_SIZE(feature_dependencies); i++) {
|
||||
FeatureDep *d = &feature_dependencies[i];
|
||||
if (!(env->features[d->from.index] & d->from.mask)) {
|
||||
--
|
||||
2.51.1
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
From 2ee7d080350ffbca115f90f61f205b8a929e10db Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Bonzini <pbonzini@redhat.com>
|
||||
Date: Wed, 19 Nov 2025 12:51:32 +0100
|
||||
Subject: [PATCH 1/4] accel/kvm: check for KVM_CAP_READONLY_MEM on VM
|
||||
|
||||
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-MergeRequest: 510: SNP fixes for RHEL 9.7.z
|
||||
RH-Jira: RHEL-129551
|
||||
RH-Acked-by: Yash Mankad <None>
|
||||
RH-Acked-by: Bandan Das <bdas@redhat.com>
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
||||
RH-Commit: [1/3] c9b724b06a4786ff7af0480dda5bab91855d6580
|
||||
|
||||
JIRA: https://issues.redhat.com/browse/RHEL-126551
|
||||
Y-JIRA: https://issues.redhat.com/browse/RHEL-126693
|
||||
|
||||
KVM_CAP_READONLY_MEM used to be a global capability, but with the
|
||||
introduction of AMD SEV-SNP confidential VMs, this extension is not
|
||||
always available on all VM types [1,2].
|
||||
|
||||
Query the extension on the VM level instead of on the KVM level.
|
||||
|
||||
[1] https://patchwork.kernel.org/project/kvm/patch/20240809190319.1710470-2-seanjc@google.com/
|
||||
[2] https://patchwork.kernel.org/project/kvm/patch/20240902144219.3716974-1-erbse.13@gmx.de/
|
||||
|
||||
Cc: Paolo Bonzini <pbonzini@redhat.com>
|
||||
Signed-off-by: Tom Dohrmann <erbse.13@gmx.de>
|
||||
Link: https://lore.kernel.org/r/20240903062953.3926498-1-erbse.13@gmx.de
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
(cherry picked from commit 64e0e63ea16aa0122dc0c41a0679da0ae4616208)
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
---
|
||||
accel/kvm/kvm-all.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
|
||||
index 1fd7773a28..1d215d096e 100644
|
||||
--- a/accel/kvm/kvm-all.c
|
||||
+++ b/accel/kvm/kvm-all.c
|
||||
@@ -2700,7 +2700,7 @@ static int kvm_init(MachineState *ms)
|
||||
}
|
||||
|
||||
kvm_readonly_mem_allowed =
|
||||
- (kvm_check_extension(s, KVM_CAP_READONLY_MEM) > 0);
|
||||
+ (kvm_vm_check_extension(s, KVM_CAP_READONLY_MEM) > 0);
|
||||
|
||||
kvm_resamplefds_allowed =
|
||||
(kvm_check_extension(s, KVM_CAP_IRQFD_RESAMPLE) > 0);
|
||||
--
|
||||
2.51.1
|
||||
|
||||
@ -0,0 +1,122 @@
|
||||
From 684f49e9717dc98b1c4d5ef05f91bfa6fd3c4106 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Fri, 28 Nov 2025 23:14:40 +0100
|
||||
Subject: [PATCH] file-posix: Handle suspended dm-multipath better for SG_IO
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
RH-MergeRequest: 521: file-posix: Handle suspended dm-multipath better for SG_IO
|
||||
RH-Jira: RHEL-133302
|
||||
RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
RH-Commit: [1/1] 249610bae92bb3a7e6b25caed58010d5868c559b (kmwolf/rhel-qemu-kvm)
|
||||
|
||||
When introducing DM_MPATH_PROBE_PATHS, we already anticipated that
|
||||
dm-multipath devices might be suspended for a short time when the DM
|
||||
tables are reloaded and that they return -EAGAIN in this case. We then
|
||||
wait for a millisecond and retry.
|
||||
|
||||
However, meanwhile it has also turned out that libmpathpersist (which is
|
||||
used by qemu-pr-helper) may need to perform more complex recovery
|
||||
operations to get reservations back to expected state if a path failure
|
||||
happened in the middle of a PR operation. In this case, the device is
|
||||
suspended for a longer time compared to the case we originally expected.
|
||||
|
||||
This patch changes hdev_co_ioctl() to treat -EAGAIN separately so that
|
||||
it doesn't result in an immediate failure if the device is suspended for
|
||||
more than 1ms, and moves to incremental backoff to cover both quick and
|
||||
slow cases without excessive delays.
|
||||
|
||||
Buglink: https://issues.redhat.com/browse/RHEL-121543
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-ID: <20251128221440.89125-1-kwolf@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 2c3165a1a61c299b4a3ae30899e1cc738d20e004)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
---
|
||||
block/file-posix.c | 56 ++++++++++++++++++++++++++++------------------
|
||||
1 file changed, 34 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/block/file-posix.c b/block/file-posix.c
|
||||
index ce5da2b4c2..28ca28d16f 100644
|
||||
--- a/block/file-posix.c
|
||||
+++ b/block/file-posix.c
|
||||
@@ -4279,25 +4279,8 @@ hdev_open_Mac_error:
|
||||
static bool coroutine_fn sgio_path_error(int ret, sg_io_hdr_t *io_hdr)
|
||||
{
|
||||
if (ret < 0) {
|
||||
- switch (ret) {
|
||||
- case -ENODEV:
|
||||
- return true;
|
||||
- case -EAGAIN:
|
||||
- /*
|
||||
- * The device is probably suspended. This happens while the dm table
|
||||
- * is reloaded, e.g. because a path is added or removed. This is an
|
||||
- * operation that should complete within 1ms, so just wait a bit and
|
||||
- * retry.
|
||||
- *
|
||||
- * If the device was suspended for another reason, we'll wait and
|
||||
- * retry SG_IO_MAX_RETRIES times. This is a tolerable delay before
|
||||
- * we return an error and potentially stop the VM.
|
||||
- */
|
||||
- qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, 1000000);
|
||||
- return true;
|
||||
- default:
|
||||
- return false;
|
||||
- }
|
||||
+ /* Path errors sometimes result in -ENODEV */
|
||||
+ return ret == -ENODEV;
|
||||
}
|
||||
|
||||
if (io_hdr->host_status != SCSI_HOST_OK) {
|
||||
@@ -4366,6 +4349,7 @@ hdev_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
|
||||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
RawPosixAIOData acb;
|
||||
+ uint64_t eagain_sleep_ns = 1 * SCALE_MS;
|
||||
int retries = SG_IO_MAX_RETRIES;
|
||||
int ret;
|
||||
|
||||
@@ -4394,9 +4378,37 @@ hdev_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
|
||||
},
|
||||
};
|
||||
|
||||
- do {
|
||||
- ret = raw_thread_pool_submit(handle_aiocb_ioctl, &acb);
|
||||
- } while (req == SG_IO && retries-- && hdev_co_ioctl_sgio_retry(&acb, ret));
|
||||
+retry:
|
||||
+ ret = raw_thread_pool_submit(handle_aiocb_ioctl, &acb);
|
||||
+ if (req == SG_IO && s->use_mpath) {
|
||||
+ if (ret == -EAGAIN && eagain_sleep_ns < NANOSECONDS_PER_SECOND) {
|
||||
+ /*
|
||||
+ * If this is a multipath device, it is probably suspended.
|
||||
+ *
|
||||
+ * This can happen while the dm table is reloaded, e.g. because a
|
||||
+ * path is added or removed. This is an operation that should
|
||||
+ * complete within 1ms, so just wait a bit and retry.
|
||||
+ *
|
||||
+ * There are also some cases in which libmpathpersist must recover
|
||||
+ * from path failure during its operation, which can leave the
|
||||
+ * device suspended for a bit longer while the library brings back
|
||||
+ * reservations into the expected state.
|
||||
+ *
|
||||
+ * Use increasing delays to cover both cases without waiting
|
||||
+ * excessively, and stop after a bit more than a second (1023 ms).
|
||||
+ * This is a tolerable delay before we return an error and
|
||||
+ * potentially stop the VM.
|
||||
+ */
|
||||
+ qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, eagain_sleep_ns);
|
||||
+ eagain_sleep_ns *= 2;
|
||||
+ goto retry;
|
||||
+ }
|
||||
+
|
||||
+ /* Even for ret == 0, the SG_IO header can contain an error */
|
||||
+ if (retries-- && hdev_co_ioctl_sgio_retry(&acb, ret)) {
|
||||
+ goto retry;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
return ret;
|
||||
}
|
||||
--
|
||||
2.51.1
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
From fe05c3a7f85d479df1d3214dc2f06d5eecdec06a Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Bonzini <pbonzini@redhat.com>
|
||||
Date: Wed, 19 Nov 2025 12:51:32 +0100
|
||||
Subject: [PATCH 3/4] ram-block-attributes: Unify the retrieval of the block
|
||||
size
|
||||
|
||||
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-MergeRequest: 510: SNP fixes for RHEL 9.7.z
|
||||
RH-Jira: RHEL-129551
|
||||
RH-Acked-by: Yash Mankad <None>
|
||||
RH-Acked-by: Bandan Das <bdas@redhat.com>
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
||||
RH-Commit: [3/3] a7c0d9e98aa363337b79a891691e60d33523af3d
|
||||
|
||||
JIRA: https://issues.redhat.com/browse/RHEL-126551
|
||||
Y-JIRA: https://issues.redhat.com/browse/RHEL-126693
|
||||
|
||||
There's an existing helper function designed to obtain the block size.
|
||||
Modify ram_block_attribute_create() to use this function for
|
||||
consistency.
|
||||
|
||||
Tested-by: Farrah Chen <farrah.chen@intel.com>
|
||||
Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
|
||||
Link: https://lore.kernel.org/r/20251023095526.48365-3-chenyi.qiang@intel.com
|
||||
[peterx: fix double spaces, per david]
|
||||
Signed-off-by: Peter Xu <peterx@redhat.com>
|
||||
(cherry picked from commit b2ceb87b1a210d91a29d525590eb164d1121b8a1)
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
---
|
||||
system/ram-block-attributes.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c
|
||||
index 0f09d73ab3..ae28b15e4c 100644
|
||||
--- a/system/ram-block-attributes.c
|
||||
+++ b/system/ram-block-attributes.c
|
||||
@@ -390,7 +390,7 @@ int ram_block_attributes_state_change(RamBlockAttributes *attr,
|
||||
|
||||
RamBlockAttributes *ram_block_attributes_create(RAMBlock *ram_block)
|
||||
{
|
||||
- const int block_size = qemu_real_host_page_size();
|
||||
+ const int block_size = ram_block_attributes_get_block_size();
|
||||
RamBlockAttributes *attr;
|
||||
MemoryRegion *mr = ram_block->mr;
|
||||
|
||||
--
|
||||
2.51.1
|
||||
|
||||
@ -0,0 +1,127 @@
|
||||
From e20a6ae07f1ec43a985e5884bd1b2e99824f4146 Mon Sep 17 00:00:00 2001
|
||||
From: Paolo Bonzini <pbonzini@redhat.com>
|
||||
Date: Wed, 19 Nov 2025 12:51:32 +0100
|
||||
Subject: [PATCH 2/4] ram-block-attributes: fix interaction with hugetlb memory
|
||||
backends
|
||||
|
||||
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
|
||||
RH-MergeRequest: 510: SNP fixes for RHEL 9.7.z
|
||||
RH-Jira: RHEL-129551
|
||||
RH-Acked-by: Yash Mankad <None>
|
||||
RH-Acked-by: Bandan Das <bdas@redhat.com>
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
||||
RH-Commit: [2/3] f93ec3a62939310fc0d556a4b9c134150e16a53f
|
||||
|
||||
JIRA: https://issues.redhat.com/browse/RHEL-126551
|
||||
Y-JIRA: https://issues.redhat.com/browse/RHEL-126693
|
||||
|
||||
Currently, CoCo VMs can perform conversion at the base page granularity,
|
||||
which is the granularity that has to be tracked. In relevant setups, the
|
||||
target page size is assumed to be equal to the host page size, thus
|
||||
fixing the block size to the host page size.
|
||||
|
||||
However, since private memory and shared memory have different backend
|
||||
at present, users can specify shared memory with a hugetlbfs backend
|
||||
while private memory with guest_memfd backend only supports 4K page
|
||||
size. In this scenario, ram_block->page_size is different from the host
|
||||
page size which will trigger an assertion when retrieving the block
|
||||
size.
|
||||
|
||||
To address this, return the host page size directly to relax the
|
||||
restriction. This changes fixes a regression of using hugetlbfs backend
|
||||
for shared memory within CoCo VMs, with or without VFIO devices' presence.
|
||||
|
||||
Acked-by: David Hildenbrand <david@redhat.com>
|
||||
Tested-by: Farrah Chen <farrah.chen@intel.com>
|
||||
Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
|
||||
Link: https://lore.kernel.org/r/20251023095526.48365-2-chenyi.qiang@intel.com
|
||||
[peterx: fix subject, per david]
|
||||
Cc: qemu-stable <qemu-stable@nongnu.org>
|
||||
Signed-off-by: Peter Xu <peterx@redhat.com>
|
||||
(cherry picked from commit 8922a758b29251d9009ec509e7f580b76509ab3d)
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
---
|
||||
system/ram-block-attributes.c | 18 ++++++++----------
|
||||
1 file changed, 8 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c
|
||||
index 0bded54e9c..0f09d73ab3 100644
|
||||
--- a/system/ram-block-attributes.c
|
||||
+++ b/system/ram-block-attributes.c
|
||||
@@ -22,16 +22,14 @@ OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES(RamBlockAttributes,
|
||||
{ })
|
||||
|
||||
static size_t
|
||||
-ram_block_attributes_get_block_size(const RamBlockAttributes *attr)
|
||||
+ram_block_attributes_get_block_size(void)
|
||||
{
|
||||
/*
|
||||
* Because page conversion could be manipulated in the size of at least 4K
|
||||
* or 4K aligned, Use the host page size as the granularity to track the
|
||||
* memory attribute.
|
||||
*/
|
||||
- g_assert(attr && attr->ram_block);
|
||||
- g_assert(attr->ram_block->page_size == qemu_real_host_page_size());
|
||||
- return attr->ram_block->page_size;
|
||||
+ return qemu_real_host_page_size();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +38,7 @@ ram_block_attributes_rdm_is_populated(const RamDiscardManager *rdm,
|
||||
const MemoryRegionSection *section)
|
||||
{
|
||||
const RamBlockAttributes *attr = RAM_BLOCK_ATTRIBUTES(rdm);
|
||||
- const size_t block_size = ram_block_attributes_get_block_size(attr);
|
||||
+ const size_t block_size = ram_block_attributes_get_block_size();
|
||||
const uint64_t first_bit = section->offset_within_region / block_size;
|
||||
const uint64_t last_bit =
|
||||
first_bit + int128_get64(section->size) / block_size - 1;
|
||||
@@ -81,7 +79,7 @@ ram_block_attributes_for_each_populated_section(const RamBlockAttributes *attr,
|
||||
{
|
||||
unsigned long first_bit, last_bit;
|
||||
uint64_t offset, size;
|
||||
- const size_t block_size = ram_block_attributes_get_block_size(attr);
|
||||
+ const size_t block_size = ram_block_attributes_get_block_size();
|
||||
int ret = 0;
|
||||
|
||||
first_bit = section->offset_within_region / block_size;
|
||||
@@ -122,7 +120,7 @@ ram_block_attributes_for_each_discarded_section(const RamBlockAttributes *attr,
|
||||
{
|
||||
unsigned long first_bit, last_bit;
|
||||
uint64_t offset, size;
|
||||
- const size_t block_size = ram_block_attributes_get_block_size(attr);
|
||||
+ const size_t block_size = ram_block_attributes_get_block_size();
|
||||
int ret = 0;
|
||||
|
||||
first_bit = section->offset_within_region / block_size;
|
||||
@@ -163,7 +161,7 @@ ram_block_attributes_rdm_get_min_granularity(const RamDiscardManager *rdm,
|
||||
const RamBlockAttributes *attr = RAM_BLOCK_ATTRIBUTES(rdm);
|
||||
|
||||
g_assert(mr == attr->ram_block->mr);
|
||||
- return ram_block_attributes_get_block_size(attr);
|
||||
+ return ram_block_attributes_get_block_size();
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -265,7 +263,7 @@ ram_block_attributes_is_valid_range(RamBlockAttributes *attr, uint64_t offset,
|
||||
g_assert(mr);
|
||||
|
||||
uint64_t region_size = memory_region_size(mr);
|
||||
- const size_t block_size = ram_block_attributes_get_block_size(attr);
|
||||
+ const size_t block_size = ram_block_attributes_get_block_size();
|
||||
|
||||
if (!QEMU_IS_ALIGNED(offset, block_size) ||
|
||||
!QEMU_IS_ALIGNED(size, block_size)) {
|
||||
@@ -322,7 +320,7 @@ int ram_block_attributes_state_change(RamBlockAttributes *attr,
|
||||
uint64_t offset, uint64_t size,
|
||||
bool to_discard)
|
||||
{
|
||||
- const size_t block_size = ram_block_attributes_get_block_size(attr);
|
||||
+ const size_t block_size = ram_block_attributes_get_block_size();
|
||||
const unsigned long first_bit = offset / block_size;
|
||||
const unsigned long nbits = size / block_size;
|
||||
const unsigned long last_bit = first_bit + nbits - 1;
|
||||
--
|
||||
2.51.1
|
||||
|
||||
@ -0,0 +1,155 @@
|
||||
From f42c949324373b2a76eda951c6351ef951c60842 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Wolf <kwolf@redhat.com>
|
||||
Date: Mon, 7 Apr 2025 17:59:49 +0200
|
||||
Subject: [PATCH 4/4] scsi-disk: Apply error policy for host_status errors
|
||||
again
|
||||
|
||||
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
||||
RH-MergeRequest: 514: scsi-disk: Apply error policy for host_status errors again
|
||||
RH-Jira: RHEL-130209
|
||||
RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
|
||||
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
RH-Commit: [1/1] 060d047ff3b64eef988c184d85f69aa21d4bdc9f (kmwolf/rhel-qemu-kvm)
|
||||
|
||||
Originally, all failed SG_IO requests called scsi_handle_rw_error() to
|
||||
apply the configured error policy. However, commit f3126d65, which was
|
||||
supposed to be a mere refactoring for scsi-disk.c, broke this and
|
||||
accidentally completed the SCSI request without considering the error
|
||||
policy any more if the error was signalled in the host_status field.
|
||||
|
||||
Apart from the commit message not describing the change as intended,
|
||||
errors indicated in host_status are also obviously backend errors and
|
||||
not something the guest must deal with independently of the error
|
||||
policy.
|
||||
|
||||
This behaviour means that some recoverable errors (such as a path error
|
||||
in multipath configurations) were reported to the guest anyway, which
|
||||
might not expect it and might consider its disk broken.
|
||||
|
||||
Make sure that we apply the error policy again for host_status errors,
|
||||
too. This addresses an existing FIXME comment and allows us to remove
|
||||
some comments warning that callbacks weren't always called. With this
|
||||
fix, they are called in all cases again.
|
||||
|
||||
The return value passed to the request callback doesn't have more free
|
||||
values that could be used to indicate host_status errors as well as SAM
|
||||
status codes and negative errno. Store the value in the host_status
|
||||
field of the SCSIRequest instead and use -ENODEV as the return value (if
|
||||
a path hasn't been reachable for a while, blk_aio_ioctl() will return
|
||||
-ENODEV instead of just setting host_status, so just reuse it here -
|
||||
it's not necessarily entirely accurate, but it's as good as any errno).
|
||||
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Fixes: f3126d65b393 ('scsi: move host_status handling into SCSI drivers')
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-ID: <20250407155949.44736-1-kwolf@redhat.com>
|
||||
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
(cherry picked from commit 61b6d9b749ba233784c7214cfe9585ea321159dc)
|
||||
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||
---
|
||||
hw/scsi/scsi-disk.c | 39 +++++++++++++++++++++++++--------------
|
||||
1 file changed, 25 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
|
||||
index de0c295173..2da0e5699f 100644
|
||||
--- a/hw/scsi/scsi-disk.c
|
||||
+++ b/hw/scsi/scsi-disk.c
|
||||
@@ -68,10 +68,9 @@ struct SCSIDiskClass {
|
||||
SCSIDeviceClass parent_class;
|
||||
/*
|
||||
* Callbacks receive ret == 0 for success. Errors are represented either as
|
||||
- * negative errno values, or as positive SAM status codes.
|
||||
- *
|
||||
- * Beware: For errors returned in host_status, the function may directly
|
||||
- * complete the request and never call the callback.
|
||||
+ * negative errno values, or as positive SAM status codes. For host_status
|
||||
+ * errors, the function passes ret == -ENODEV and sets the host_status field
|
||||
+ * of the SCSIRequest.
|
||||
*/
|
||||
DMAIOFunc *dma_readv;
|
||||
DMAIOFunc *dma_writev;
|
||||
@@ -226,11 +225,26 @@ static bool scsi_handle_rw_error(SCSIDiskReq *r, int ret, bool acct_failed)
|
||||
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
|
||||
SCSIDiskClass *sdc = (SCSIDiskClass *) object_get_class(OBJECT(s));
|
||||
SCSISense sense = SENSE_CODE(NO_SENSE);
|
||||
+ int16_t host_status;
|
||||
int error;
|
||||
bool req_has_sense = false;
|
||||
BlockErrorAction action;
|
||||
int status;
|
||||
|
||||
+ /*
|
||||
+ * host_status should only be set for SG_IO requests that came back with a
|
||||
+ * host_status error in scsi_block_sgio_complete(). This error path passes
|
||||
+ * -ENODEV as the return value.
|
||||
+ *
|
||||
+ * Reset host_status in the request because we may still want to complete
|
||||
+ * the request successfully with the 'stop' or 'ignore' error policy.
|
||||
+ */
|
||||
+ host_status = r->req.host_status;
|
||||
+ if (host_status != -1) {
|
||||
+ assert(ret == -ENODEV);
|
||||
+ r->req.host_status = -1;
|
||||
+ }
|
||||
+
|
||||
if (ret < 0) {
|
||||
status = scsi_sense_from_errno(-ret, &sense);
|
||||
error = -ret;
|
||||
@@ -290,6 +304,10 @@ static bool scsi_handle_rw_error(SCSIDiskReq *r, int ret, bool acct_failed)
|
||||
if (acct_failed) {
|
||||
block_acct_failed(blk_get_stats(s->qdev.conf.blk), &r->acct);
|
||||
}
|
||||
+ if (host_status != -1) {
|
||||
+ scsi_req_complete_failed(&r->req, host_status);
|
||||
+ return true;
|
||||
+ }
|
||||
if (req_has_sense) {
|
||||
sdc->update_sense(&r->req);
|
||||
} else if (status == CHECK_CONDITION) {
|
||||
@@ -411,7 +429,6 @@ done:
|
||||
scsi_req_unref(&r->req);
|
||||
}
|
||||
|
||||
-/* May not be called in all error cases, don't rely on cleanup here */
|
||||
static void scsi_dma_complete(void *opaque, int ret)
|
||||
{
|
||||
SCSIDiskReq *r = (SCSIDiskReq *)opaque;
|
||||
@@ -452,7 +469,6 @@ done:
|
||||
scsi_req_unref(&r->req);
|
||||
}
|
||||
|
||||
-/* May not be called in all error cases, don't rely on cleanup here */
|
||||
static void scsi_read_complete(void *opaque, int ret)
|
||||
{
|
||||
SCSIDiskReq *r = (SCSIDiskReq *)opaque;
|
||||
@@ -592,7 +608,6 @@ done:
|
||||
scsi_req_unref(&r->req);
|
||||
}
|
||||
|
||||
-/* May not be called in all error cases, don't rely on cleanup here */
|
||||
static void scsi_write_complete(void * opaque, int ret)
|
||||
{
|
||||
SCSIDiskReq *r = (SCSIDiskReq *)opaque;
|
||||
@@ -2854,14 +2869,10 @@ static void scsi_block_sgio_complete(void *opaque, int ret)
|
||||
sg_io_hdr_t *io_hdr = &req->io_header;
|
||||
|
||||
if (ret == 0) {
|
||||
- /* FIXME This skips calling req->cb() and any cleanup in it */
|
||||
if (io_hdr->host_status != SCSI_HOST_OK) {
|
||||
- scsi_req_complete_failed(&r->req, io_hdr->host_status);
|
||||
- scsi_req_unref(&r->req);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if (io_hdr->driver_status & SG_ERR_DRIVER_TIMEOUT) {
|
||||
+ r->req.host_status = io_hdr->host_status;
|
||||
+ ret = -ENODEV;
|
||||
+ } else if (io_hdr->driver_status & SG_ERR_DRIVER_TIMEOUT) {
|
||||
ret = BUSY;
|
||||
} else {
|
||||
ret = io_hdr->status;
|
||||
--
|
||||
2.51.1
|
||||
|
||||
@ -149,7 +149,7 @@ Obsoletes: %{name}-block-ssh <= %{epoch}:%{version} \
|
||||
Summary: QEMU is a machine emulator and virtualizer
|
||||
Name: qemu-kvm
|
||||
Version: 9.1.0
|
||||
Release: 29%{?rcrel}%{?dist}%{?cc_suffix}.3
|
||||
Release: 29%{?rcrel}%{?dist}%{?cc_suffix}.6
|
||||
# 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)
|
||||
@ -1205,6 +1205,18 @@ Patch394: kvm-arm-kvm-report-registers-we-failed-to-set.patch
|
||||
Patch395: kvm-io-move-websock-resource-release-to-close-method.patch
|
||||
# For RHEL-120125 - CVE-2025-11234 qemu-kvm: VNC WebSocket handshake use-after-free [rhel-9.7.z]
|
||||
Patch396: kvm-io-fix-use-after-free-in-websocket-handshake-code.patch
|
||||
# For RHEL-129551 - [RHEL 9]snp guest fail to boot with hugepage [rhel-9.7.z]
|
||||
Patch397: kvm-accel-kvm-check-for-KVM_CAP_READONLY_MEM-on-VM.patch
|
||||
# For RHEL-129551 - [RHEL 9]snp guest fail to boot with hugepage [rhel-9.7.z]
|
||||
Patch398: kvm-ram-block-attributes-fix-interaction-with-hugetlb-me.patch
|
||||
# For RHEL-129551 - [RHEL 9]snp guest fail to boot with hugepage [rhel-9.7.z]
|
||||
Patch399: kvm-ram-block-attributes-Unify-the-retrieval-of-the-bloc.patch
|
||||
# For RHEL-130209 - scsi-block: Error policy is ignored for host_status errors [rhel-9.7.z]
|
||||
Patch400: kvm-scsi-disk-Apply-error-policy-for-host_status-errors-.patch
|
||||
# For RHEL-133302 - The VM hit io error when do S3-PR integration on the pass-through failover multipath device [rhel-9.7.z]
|
||||
Patch401: kvm-file-posix-Handle-suspended-dm-multipath-better-for-.patch
|
||||
# For RHEL-135451 - Live migration after workload update fails with operation failed: guest CPU doesn't match specification: missing features: pdcm [rhel-9]
|
||||
Patch402: kvm-Revert-i386-cpu-Move-adjustment-of-CPUID_EXT_PDCM-be.patch
|
||||
|
||||
%if %{have_clang}
|
||||
BuildRequires: clang
|
||||
@ -2280,6 +2292,26 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Dec 15 2025 Jon Maloy <jmaloy@redhat.com> - 9.1.0-29.el9_7.6
|
||||
- kvm-Revert-i386-cpu-Move-adjustment-of-CPUID_EXT_PDCM-be.patch [RHEL-135451]
|
||||
- Resolves: RHEL-135451
|
||||
(Live migration after workload update fails with operation failed: guest CPU doesn't match specification: missing features: pdcm [rhel-9])
|
||||
|
||||
* Mon Dec 08 2025 Jon Maloy <jmaloy@redhat.com> - 9.1.0-29.el9_7.5
|
||||
- kvm-file-posix-Handle-suspended-dm-multipath-better-for-.patch [RHEL-133302]
|
||||
- Resolves: RHEL-133302
|
||||
(The VM hit io error when do S3-PR integration on the pass-through failover multipath device [rhel-9.7.z])
|
||||
|
||||
* Tue Dec 02 2025 Jon Maloy <jmaloy@redhat.com> - 9.1.0-29.el9_7.4
|
||||
- kvm-accel-kvm-check-for-KVM_CAP_READONLY_MEM-on-VM.patch [RHEL-129551]
|
||||
- kvm-ram-block-attributes-fix-interaction-with-hugetlb-me.patch [RHEL-129551]
|
||||
- kvm-ram-block-attributes-Unify-the-retrieval-of-the-bloc.patch [RHEL-129551]
|
||||
- kvm-scsi-disk-Apply-error-policy-for-host_status-errors-.patch [RHEL-130209]
|
||||
- Resolves: RHEL-129551
|
||||
([RHEL 9]snp guest fail to boot with hugepage [rhel-9.7.z])
|
||||
- Resolves: RHEL-130209
|
||||
(scsi-block: Error policy is ignored for host_status errors [rhel-9.7.z])
|
||||
|
||||
* Mon Nov 17 2025 Jon Maloy <jmaloy@redhat.com> - 9.1.0-29.el9_7.3
|
||||
- kvm-io-move-websock-resource-release-to-close-method.patch [RHEL-120125]
|
||||
- kvm-io-fix-use-after-free-in-websocket-handshake-code.patch [RHEL-120125]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user