- kvm-blkdebug-Add-delay-ns-option.patch [RHEL-121686] - kvm-block-Add-blk_co_start-end_request-and-BDRV_REQ_NO_Q.patch [RHEL-121686] - kvm-block-Add-flags-parameter-to-blk_-_pdiscard.patch [RHEL-121686] - kvm-ide-Minimal-fix-for-deadlock-between-TRIM-and-drain.patch [RHEL-121686] - kvm-ide-Clean-up-ide_trim_co_entry-to-be-idiomatic-corou.patch [RHEL-121686] - kvm-ide-test-Factor-out-wait_dma_completion.patch [RHEL-121686] - kvm-ide-test-Test-reset-during-TRIM.patch [RHEL-121686] - kvm-block-graph-lock-fix-missed-wakeup-in-bdrv_graph_co_.patch [RHEL-186384] - kvm-block-curl-fix-curl-internal-handles-handling.patch [RHEL-186384] - kvm-block-curl.c-Use-explicit-long-constants-in-curl_eas.patch [RHEL-186384] - kvm-block-curl.c-Fix-CURLOPT_VERBOSE-parameter-type.patch [RHEL-186384] - kvm-block-curl-fix-concurrent-completion-handling.patch [RHEL-186384] - kvm-block-curl-free-s-password-in-cleanup-paths.patch [RHEL-186384] - kvm-nvme-Kick-and-check-completions-in-BDS-context.patch [RHEL-186384] - kvm-nvme-Note-in-which-AioContext-some-functions-run.patch [RHEL-186384] - kvm-block-remove-detached-header-option-from-opts-after-.patch [RHEL-186384] - kvm-block-fix-luks-amend-when-run-in-coroutine.patch [RHEL-186384] - kvm-qed-Don-t-try-to-flush-during-incoming-migration.patch [RHEL-186384] - kvm-block-vmdk-fix-OOB-read-in-vmdk_read_extent.patch [RHEL-186384] - kvm-block-throttle-groups-fix-deadlock-with-iolimits-and.patch [RHEL-186384] - kvm-throttle-group-Fix-race-condition-in-throttle_group_.patch [RHEL-186384] - kvm-qemu-img-Fix-amend-option-parse-error-handling.patch [RHEL-186384] - kvm-qemu-img-rebase-don-t-exceed-IO_BUF_SIZE-in-one-oper.patch [RHEL-186384] - kvm-python-backport-drop-Python3.6-workarounds.patch [RHEL-186384] - kvm-python-backport-Remove-deprecated-get_event_loop-cal.patch [RHEL-186384] - kvm-python-backport-avoid-creating-additional-event-loop.patch [RHEL-186384] - kvm-iotests-147-ensure-temporary-sockets-are-closed-befo.patch [RHEL-186384] - kvm-iotests-151-ensure-subprocesses-are-cleaned-up.patch [RHEL-186384] - kvm-tests-qemu-iotest-fix-iotest-024-with-qed-images.patch [RHEL-186384] - kvm-tests-qemu-iotests-Fix-check-for-existing-file-in-_r.patch [RHEL-186384] - kvm-async-access-bottom-half-flags-with-qatomic_read.patch [RHEL-186384] - kvm-block-linux-aio-bound-ioq_submit-recursion-depth.patch [RHEL-186384] - kvm-block-io-fallback-to-bounce-buffer-if-BLKZEROOUT-is-.patch [RHEL-186384] - kvm-file-posix-populate-pwrite_zeroes_alignment.patch [RHEL-186384] - kvm-block-use-pwrite_zeroes_alignment-when-writing-first.patch [RHEL-186384] - kvm-iotests-add-Linux-loop-device-image-creation-test.patch [RHEL-186384] - kvm-virtio-Fix-crash-when-sriov-pf-is-set-for-non-PCI-Ex.patch [RHEL-186384] - kvm-virtio-scsi-pass-the-same-cdb_size-to-virtio_scsi_po.patch [RHEL-186384] - kvm-hw-scsi-avoid-deadlock-upon-TMF-request-cancelling-w.patch [RHEL-186384] - kvm-virtio-blk-fix-zone-report-buffer-out-of-memory-CVE-.patch [RHEL-186384] - kvm-ide-Fix-potential-assertion-failure-on-VM-stop-for-P.patch [RHEL-186384] - kvm-block-Create-DEFAULT_BLOCK_CONF-macro.patch [RHEL-186384] - kvm-block-Add-more-defaults-to-DEFAULT_BLOCK_CONF.patch [RHEL-186384] - kvm-block-mirror-check-range-when-setting-zero-bitmap-fo.patch [RHEL-186384] - kvm-iotests-test-active-mirror-with-unaligned-small-writ.patch [RHEL-186384] - kvm-block-mirror-fix-assertion-failure-upon-duplicate-co.patch [RHEL-186384] - kvm-commit-Drain-nodes-across-all-of-bdrv_commit.patch [RHEL-186384] - kvm-qemu-io-Add-aio_discard-command.patch [RHEL-186384] - kvm-qcow2-Fix-corruption-on-discard-during-write-with-CO.patch [RHEL-186384] - kvm-iotests-046-Test-that-discard-write_zeroes-wait-for-.patch [RHEL-186384] - kvm-qcow2-Fix-data-loss-on-zero-write-with-detect-zeroes.patch [RHEL-186384] - kvm-block-Fix-crash-after-setting-latency-historygram-wi.patch [RHEL-186384] - Resolves: RHEL-121686 (qemu-kvm hung during drain after double pause) - Resolves: RHEL-186384 (virt-storage: Backport stable branch fixes)
122 lines
4.2 KiB
Diff
122 lines
4.2 KiB
Diff
From 6386e658adc798b2af7400a53941523d21dd581d Mon Sep 17 00:00:00 2001
|
|
From: Kevin Wolf <kwolf@redhat.com>
|
|
Date: Tue, 21 Apr 2026 18:11:26 +0200
|
|
Subject: [PATCH 01/52] blkdebug: Add 'delay-ns' option
|
|
|
|
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
RH-MergeRequest: 503: ide: Fix deadlock between TRIM and drain
|
|
RH-Jira: RHEL-121686
|
|
RH-Acked-by: Hanna Czenczek <hreitz@redhat.com>
|
|
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
RH-Commit: [1/7] b6ade079279909f3b38a03fc710c1f0ebd475915 (kmwolf/centos-qemu-kvm)
|
|
|
|
Sometimes reproducing a problem for debugging involves slow I/O, so
|
|
let's add something to blkdebug to make I/O slow when we need it. This
|
|
can be used either together with an error so that the request fails
|
|
after the delay, or with errno=0, which allows the request to succeed
|
|
after the delay.
|
|
|
|
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
Message-ID: <20260421161132.99878-2-kwolf@redhat.com>
|
|
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
(cherry picked from commit d5e4090177ad382e01084a1594a1a60a69f4c1cd)
|
|
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
|
|
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
---
|
|
block/blkdebug.c | 15 ++++++++++++++-
|
|
qapi/block-core.json | 4 ++++
|
|
2 files changed, 18 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/block/blkdebug.c b/block/blkdebug.c
|
|
index c54aee0c84..8954fc2977 100644
|
|
--- a/block/blkdebug.c
|
|
+++ b/block/blkdebug.c
|
|
@@ -95,6 +95,7 @@ typedef struct BlkdebugRule {
|
|
int immediately;
|
|
int once;
|
|
int64_t offset;
|
|
+ int64_t delay_ns;
|
|
} inject;
|
|
struct {
|
|
int new_state;
|
|
@@ -144,6 +145,10 @@ static QemuOptsList inject_error_opts = {
|
|
.name = "immediately",
|
|
.type = QEMU_OPT_BOOL,
|
|
},
|
|
+ {
|
|
+ .name = "delay-ns",
|
|
+ .type = QEMU_OPT_NUMBER,
|
|
+ },
|
|
{ /* end of list */ }
|
|
},
|
|
};
|
|
@@ -216,6 +221,8 @@ static int add_rule(void *opaque, QemuOpts *opts, Error **errp)
|
|
rule->options.inject.once = qemu_opt_get_bool(opts, "once", 0);
|
|
rule->options.inject.immediately =
|
|
qemu_opt_get_bool(opts, "immediately", 0);
|
|
+ rule->options.inject.delay_ns =
|
|
+ qemu_opt_get_number(opts, "delay-ns", 0);
|
|
sector = qemu_opt_get_number(opts, "sector", -1);
|
|
rule->options.inject.offset =
|
|
sector == -1 ? -1 : sector * BDRV_SECTOR_SIZE;
|
|
@@ -594,6 +601,7 @@ static int coroutine_fn rule_check(BlockDriverState *bs, uint64_t offset,
|
|
BlkdebugRule *rule = NULL;
|
|
int error;
|
|
bool immediately;
|
|
+ int64_t delay_ns;
|
|
|
|
qemu_mutex_lock(&s->lock);
|
|
QSIMPLEQ_FOREACH(rule, &s->active_rules, active_next) {
|
|
@@ -608,13 +616,14 @@ static int coroutine_fn rule_check(BlockDriverState *bs, uint64_t offset,
|
|
}
|
|
}
|
|
|
|
- if (!rule || !rule->options.inject.error) {
|
|
+ if (!rule) {
|
|
qemu_mutex_unlock(&s->lock);
|
|
return 0;
|
|
}
|
|
|
|
immediately = rule->options.inject.immediately;
|
|
error = rule->options.inject.error;
|
|
+ delay_ns = rule->options.inject.delay_ns;
|
|
|
|
if (rule->options.inject.once) {
|
|
QSIMPLEQ_REMOVE(&s->active_rules, rule, BlkdebugRule, active_next);
|
|
@@ -622,6 +631,10 @@ static int coroutine_fn rule_check(BlockDriverState *bs, uint64_t offset,
|
|
}
|
|
|
|
qemu_mutex_unlock(&s->lock);
|
|
+
|
|
+ if (delay_ns) {
|
|
+ qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, delay_ns);
|
|
+ }
|
|
if (!immediately) {
|
|
aio_co_schedule(qemu_get_current_aio_context(), qemu_coroutine_self());
|
|
qemu_coroutine_yield();
|
|
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
|
index 0236936139..6cf8c1b9c8 100644
|
|
--- a/qapi/block-core.json
|
|
+++ b/qapi/block-core.json
|
|
@@ -3909,6 +3909,9 @@
|
|
#
|
|
# @errno: error identifier (errno) to be returned; defaults to EIO
|
|
#
|
|
+# @delay-ns: request delay before completion in nanoseconds
|
|
+# (default: 0, since: 11.1)
|
|
+#
|
|
# @sector: specifies the sector index which has to be affected in
|
|
# order to actually trigger the event; defaults to "any sector"
|
|
#
|
|
@@ -3924,6 +3927,7 @@
|
|
'*state': 'int',
|
|
'*iotype': 'BlkdebugIOType',
|
|
'*errno': 'int',
|
|
+ '*delay-ns': 'int',
|
|
'*sector': 'int',
|
|
'*once': 'bool',
|
|
'*immediately': 'bool' } }
|
|
--
|
|
2.52.0
|
|
|