aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonid Kaplan <xeor@yandex-team.ru>2024-10-02 18:18:06 +0300
committerKevin Wolf <kwolf@redhat.com>2024-10-22 17:52:49 +0200
commit2155d2dd7f733674586119b6b4ee0f52d2032779 (patch)
tree82bad64fcf9295b3f64e3ac135d177579fc487a4
parent7452162adec25c1003d5bf0079aca52913a80e0c (diff)
downloadqemu-2155d2dd7f733674586119b6b4ee0f52d2032779.zip
qemu-2155d2dd7f733674586119b6b4ee0f52d2032779.tar.gz
qemu-2155d2dd7f733674586119b6b4ee0f52d2032779.tar.bz2
block-backend: per-device throttling of BLOCK_IO_ERROR reports
BLOCK_IO_ERROR events comes from guest, so we must throttle them. We still want per-device throttling, so let's use device id as a key. Signed-off-by: Leonid Kaplan <xeor@yandex-team.ru> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Message-ID: <20241002151806.592469-3-vsementsov@yandex-team.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--monitor/monitor.c7
-rw-r--r--qapi/block-core.json2
2 files changed, 7 insertions, 2 deletions
diff --git a/monitor/monitor.c b/monitor/monitor.c
index db52a9c..56786c0 100644
--- a/monitor/monitor.c
+++ b/monitor/monitor.c
@@ -308,6 +308,7 @@ int error_printf_unless_qmp(const char *fmt, ...)
static MonitorQAPIEventConf monitor_qapi_event_conf[QAPI_EVENT__MAX] = {
/* Limit guest-triggerable events to 1 per second */
[QAPI_EVENT_RTC_CHANGE] = { 1000 * SCALE_MS },
+ [QAPI_EVENT_BLOCK_IO_ERROR] = { 1000 * SCALE_MS },
[QAPI_EVENT_WATCHDOG] = { 1000 * SCALE_MS },
[QAPI_EVENT_BALLOON_CHANGE] = { 1000 * SCALE_MS },
[QAPI_EVENT_QUORUM_REPORT_BAD] = { 1000 * SCALE_MS },
@@ -493,7 +494,8 @@ static unsigned int qapi_event_throttle_hash(const void *key)
hash += g_str_hash(qdict_get_str(evstate->data, "node-name"));
}
- if (evstate->event == QAPI_EVENT_MEMORY_DEVICE_SIZE_CHANGE) {
+ if (evstate->event == QAPI_EVENT_MEMORY_DEVICE_SIZE_CHANGE ||
+ evstate->event == QAPI_EVENT_BLOCK_IO_ERROR) {
hash += g_str_hash(qdict_get_str(evstate->data, "qom-path"));
}
@@ -519,7 +521,8 @@ static gboolean qapi_event_throttle_equal(const void *a, const void *b)
qdict_get_str(evb->data, "node-name"));
}
- if (eva->event == QAPI_EVENT_MEMORY_DEVICE_SIZE_CHANGE) {
+ if (eva->event == QAPI_EVENT_MEMORY_DEVICE_SIZE_CHANGE ||
+ eva->event == QAPI_EVENT_BLOCK_IO_ERROR) {
return !strcmp(qdict_get_str(eva->data, "qom-path"),
qdict_get_str(evb->data, "qom-path"));
}
diff --git a/qapi/block-core.json b/qapi/block-core.json
index fe63ba6..fd3bcc1 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -5611,6 +5611,8 @@
# .. note:: If action is "stop", a STOP event will eventually follow
# the BLOCK_IO_ERROR event.
#
+# .. note:: This event is rate-limited.
+#
# Since: 0.13
#
# .. qmp-example::