From d3ad6ab6babc436b41132521a5ea45f022829d62 Mon Sep 17 00:00:00 2001 From: Yan Wang Date: Thu, 24 Mar 2022 20:43:05 +0800 Subject: [PATCH 1/4] spec: add hw-usb-host rpm package Signed-off-by: Yan Wang --- qemu.spec | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/qemu.spec b/qemu.spec index 2326488..311f8c4 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1,6 +1,6 @@ Name: qemu Version: 6.2.0 -Release: 27 +Release: 28 Epoch: 2 Summary: QEMU is a generic and open source machine emulator and virtualizer License: GPLv2 and BSD and MIT and CC-BY-SA-4.0 @@ -297,6 +297,7 @@ Requires(preun): systemd-units Requires(postun): systemd-units Requires(postun): qemu-block-iscsi Requires(postun): qemu-block-curl +Requires(postun): qemu-hw-usb-host %description @@ -354,6 +355,11 @@ Summary: Qemu-block-curl %description block-curl This package provides block-curl support for Qemu +%package hw-usb-host +Summary: Qemu-hw-usb-host +%description hw-usb-host +This package provides hw-usb-host support for Qemu + %ifarch %{ix86} x86_64 %package seabios Summary: QEMU seabios @@ -518,7 +524,6 @@ rm -rf %{buildroot}%{_libdir}/%{name}/chardev-baum.so rm -rf %{buildroot}%{_libdir}/%{name}/chardev-spice.so rm -rf %{buildroot}%{_libdir}/%{name}/hw-display-qxl.so rm -rf %{buildroot}%{_libdir}/%{name}/hw-s390x-virtio-gpu-ccw.so -rm -rf %{buildroot}%{_libdir}/%{name}/hw-usb-host.so rm -rf %{buildroot}%{_libdir}/%{name}/hw-usb-redirect.so rm -rf %{buildroot}%{_libdir}/%{name}/ui-opengl.so rm -rf %{buildroot}%{_libdir}/%{name}/ui-spice-app.so @@ -532,6 +537,7 @@ strip %{buildroot}%{_libdir}/%{name}/block-rbd.so strip %{buildroot}%{_libdir}/%{name}/block-iscsi.so strip %{buildroot}%{_libdir}/%{name}/block-curl.so strip %{buildroot}%{_libdir}/%{name}/block-ssh.so +strip %{buildroot}%{_libdir}/%{name}/hw-usb-host.so for f in %{buildroot}%{_bindir}/* %{buildroot}%{_libdir}/* \ %{buildroot}%{_libexecdir}/*; do @@ -680,6 +686,9 @@ getent passwd qemu >/dev/null || \ %files block-curl %{_libdir}/%{name}/block-curl.so +%files hw-usb-host +%{_libdir}/%{name}/hw-usb-host.so + %ifarch %{ix86} x86_64 %files seabios %{_datadir}/%{name}/bios-256k.bin @@ -687,6 +696,9 @@ getent passwd qemu >/dev/null || \ %endif %changelog +* Thu Mar 24 2022 Yan Wang +- spec: add hw-usb-host rpm package + * Fri Mar 18 2022 yezengruan - coro: support live patch for libcare - add patch for sw64 support -- Gitee From f0684b551e851cdee969be5cf52917d3737958b7 Mon Sep 17 00:00:00 2001 From: Jinhua Cao Date: Fri, 25 Mar 2022 09:35:16 +0800 Subject: [PATCH 2/4] qemu-img create: cache paramter only use for reg file image The paramter 'cache' is invalid for host device(/dev/xxx). If 'qemu-img create' operator performed on host device, the host device not support 'cache' would result 'qemu-img create excute' failed. Signed-off-by: Jinhua Cao --- ...cache-paramter-only-use-for-reg-file.patch | 66 +++++++++++++++++++ qemu.spec | 6 +- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 qemu-img-create-cache-paramter-only-use-for-reg-file.patch diff --git a/qemu-img-create-cache-paramter-only-use-for-reg-file.patch b/qemu-img-create-cache-paramter-only-use-for-reg-file.patch new file mode 100644 index 0000000..c4664e1 --- /dev/null +++ b/qemu-img-create-cache-paramter-only-use-for-reg-file.patch @@ -0,0 +1,66 @@ +From 85a876e0d28eac4c71350baede38ca755fdf6df0 Mon Sep 17 00:00:00 2001 +From: Jinhua Cao +Date: Thu, 24 Mar 2022 17:12:49 +0800 +Subject: [PATCH] qemu-img create: 'cache' paramter only use for reg file image + +The paramter 'cache' is invalid for host device(/dev/xxx). If +'qemu-img create' operator performed on host device, the host +device not support 'cache' would result 'qemu-img create' execute +failed. + +Signed-off-by: Jinhua Cao +--- + qemu-img.c | 30 ++++++++++++++++++++++++------ + 1 file changed, 24 insertions(+), 6 deletions(-) + +diff --git a/qemu-img.c b/qemu-img.c +index 9409558772..059bf42fc1 100644 +--- a/qemu-img.c ++++ b/qemu-img.c +@@ -496,6 +496,22 @@ static int64_t cvtnum(const char *name, const char *value) + return cvtnum_full(name, value, 0, INT64_MAX); + } + ++static bool is_reg_file(const char *filename) ++{ ++ struct stat st; ++ ++ /* file not exist, file will be create later, so it's a reg file */ ++ if (access(filename, F_OK) == -1) { ++ return true; ++ } ++ ++ /* file exist, check file type */ ++ if (stat(filename, &st) >= 0 && S_ISREG(st.st_mode)) { ++ return true; ++ } ++ return false; ++} ++ + static int img_create(int argc, char **argv) + { + int c; +@@ -586,12 +602,14 @@ static int img_create(int argc, char **argv) + error_exit("Unexpected argument: %s", argv[optind]); + } + +- if (!options) { +- options = g_strdup_printf(BLOCK_OPT_CACHE"=%s", cache); +- } else { +- char *old_options = options; +- options = g_strdup_printf("%s,"BLOCK_OPT_CACHE"=%s", options, cache); +- g_free(old_options); ++ if (is_reg_file(filename)) { ++ if (!options) { ++ options = g_strdup_printf(BLOCK_OPT_CACHE"=%s", cache); ++ } else { ++ char *old_options = options; ++ options = g_strdup_printf("%s,"BLOCK_OPT_CACHE"=%s", options, cache); ++ g_free(old_options); ++ } + } + + bdrv_img_create(filename, fmt, base_filename, base_fmt, +-- +2.27.0 + diff --git a/qemu.spec b/qemu.spec index 311f8c4..d150804 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1,6 +1,6 @@ Name: qemu Version: 6.2.0 -Release: 28 +Release: 29 Epoch: 2 Summary: QEMU is a generic and open source machine emulator and virtualizer License: GPLv2 and BSD and MIT and CC-BY-SA-4.0 @@ -236,6 +236,7 @@ Patch0222: scsi-bus-fix-unmatched-object_unref.patch Patch0223: tools-virtiofsd-Add-rseq-syscall-to-the-seccomp-allo.patch Patch0224: sw_64-Add-sw64-architecture-support.patch Patch0225: coro-support-live-patch-for-libcare.patch +Patch0226: qemu-img-create-cache-paramter-only-use-for-reg-file.patch BuildRequires: flex BuildRequires: gcc @@ -696,6 +697,9 @@ getent passwd qemu >/dev/null || \ %endif %changelog +* Fri Mar 25 2022 Jinhua Cao +- qemu-img create: 'cache' paramter only use for reg file image + * Thu Mar 24 2022 Yan Wang - spec: add hw-usb-host rpm package -- Gitee From 90f33cc4736031d475468f455ea70452c70833de Mon Sep 17 00:00:00 2001 From: yezengruan Date: Wed, 30 Mar 2022 10:05:08 +0800 Subject: [PATCH 3/4] fix some IO hang bugs scsi-bus: fix incorrect call for blk_error_retry_reset_timeout() Revert "monitor: limit io error qmp event to at most once per 60s" Signed-off-by: Yan Wang Signed-off-by: yezengruan --- ...imit-io-error-qmp-event-to-at-most-o.patch | 31 +++++++ ...orrect-call-for-blk_error_retry_rese.patch | 80 +++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 Revert-monitor-limit-io-error-qmp-event-to-at-most-o.patch create mode 100644 scsi-bus-fix-incorrect-call-for-blk_error_retry_rese.patch diff --git a/Revert-monitor-limit-io-error-qmp-event-to-at-most-o.patch b/Revert-monitor-limit-io-error-qmp-event-to-at-most-o.patch new file mode 100644 index 0000000..112161f --- /dev/null +++ b/Revert-monitor-limit-io-error-qmp-event-to-at-most-o.patch @@ -0,0 +1,31 @@ +From e42b57adeac96c7d39b1c032ab3b66b7eff18cc8 Mon Sep 17 00:00:00 2001 +From: Yan Wang +Date: Tue, 29 Mar 2022 15:18:56 +0800 +Subject: [PATCH 2/2] Revert "monitor: limit io error qmp event to at most once + per 60s" + +This reverts commit 44f45b5c163efed5387dac40e229e0a50bf5921a. + +The commit 44f45b5c will reduse the IO-hang related log, which +is useful to solve the problem. + +Signed-off-by: Yan Wang +--- + monitor/monitor.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/monitor/monitor.c b/monitor/monitor.c +index 28206bedc4..257ef4ee54 100644 +--- a/monitor/monitor.c ++++ b/monitor/monitor.c +@@ -301,7 +301,6 @@ static MonitorQAPIEventConf monitor_qapi_event_conf[QAPI_EVENT__MAX] = { + [QAPI_EVENT_QUORUM_FAILURE] = { 1000 * SCALE_MS }, + [QAPI_EVENT_VSERPORT_CHANGE] = { 1000 * SCALE_MS }, + [QAPI_EVENT_MEMORY_DEVICE_SIZE_CHANGE] = { 1000 * SCALE_MS }, +- [QAPI_EVENT_BLOCK_IO_ERROR] = { 60L * 1000 * SCALE_MS }, + }; + + /* +-- +2.27.0 + diff --git a/scsi-bus-fix-incorrect-call-for-blk_error_retry_rese.patch b/scsi-bus-fix-incorrect-call-for-blk_error_retry_rese.patch new file mode 100644 index 0000000..4f4804f --- /dev/null +++ b/scsi-bus-fix-incorrect-call-for-blk_error_retry_rese.patch @@ -0,0 +1,80 @@ +From 3ab10a5ad9bf1cbf3b4603f5a930a7924a07ad5a Mon Sep 17 00:00:00 2001 +From: Yan Wang +Date: Tue, 29 Mar 2022 12:05:56 +0800 +Subject: [PATCH 1/2] scsi-bus: fix incorrect call for + blk_error_retry_reset_timeout() + +Fix commit 52115ca0("scsi-disk: Add support for retry on errors"). +Call Stack: + ... + scsi_read_data() + scsi_do_read(r, 0) + scsi_disk_req_check_error() + blk_error_retry_reset_timeout() + blk->retry_start_time = 0; + +It will cause IO hang when storage network disconnected. Before the +storage network recovered, the upper call stack will reset the +retry_start_time, and cause the next IO operation not returned immediately. + +Signed-off-by: Yan Wang +--- + hw/scsi/scsi-disk.c | 20 ++++++++++++++++---- + 1 file changed, 16 insertions(+), 4 deletions(-) + +diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c +index 8661932a15..a66d2b0a98 100644 +--- a/hw/scsi/scsi-disk.c ++++ b/hw/scsi/scsi-disk.c +@@ -255,10 +255,8 @@ static bool scsi_handle_rw_error(SCSIDiskReq *r, int ret, bool acct_failed) + } + } + +-static bool scsi_disk_req_check_error(SCSIDiskReq *r, int ret, bool acct_failed) ++static bool scsi_disk_req_handle_error(SCSIDiskReq *r, int ret, bool acct_failed) + { +- SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); +- + if (r->req.io_canceled) { + scsi_req_cancel_complete(&r->req); + return true; +@@ -268,6 +266,17 @@ static bool scsi_disk_req_check_error(SCSIDiskReq *r, int ret, bool acct_failed) + return scsi_handle_rw_error(r, ret, acct_failed); + } + ++ return false; ++} ++ ++static bool scsi_disk_req_check_error(SCSIDiskReq *r, int ret, bool acct_failed) ++{ ++ SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); ++ ++ if (r->req.io_canceled || ret < 0) { ++ return scsi_disk_req_handle_error(r, ret, acct_failed); ++ } ++ + blk_error_retry_reset_timeout(s->qdev.conf.blk); + return false; + } +@@ -418,7 +427,7 @@ static void scsi_do_read(SCSIDiskReq *r, int ret) + SCSIDiskClass *sdc = (SCSIDiskClass *) object_get_class(OBJECT(s)); + + assert (r->req.aiocb == NULL); +- if (scsi_disk_req_check_error(r, ret, false)) { ++ if (scsi_disk_req_handle_error(r, ret, false)) { + goto done; + } + +@@ -458,6 +467,9 @@ static void scsi_do_read_cb(void *opaque, int ret) + block_acct_failed(blk_get_stats(s->qdev.conf.blk), &r->acct); + } else { + block_acct_done(blk_get_stats(s->qdev.conf.blk), &r->acct); ++ if (!r->req.io_canceled) { ++ blk_error_retry_reset_timeout(s->qdev.conf.blk); ++ } + } + scsi_do_read(opaque, ret); + aio_context_release(blk_get_aio_context(s->qdev.conf.blk)); +-- +2.27.0 + -- Gitee From cf2a6631e67bf3f9562e264728b569ab5b20f03a Mon Sep 17 00:00:00 2001 From: yezengruan Date: Wed, 30 Mar 2022 10:08:05 +0800 Subject: [PATCH 4/4] spec: Update release version with !273 fix some IO hang bugs Signed-off-by: yezengruan --- qemu.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index d150804..3c2f4f7 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1,6 +1,6 @@ Name: qemu Version: 6.2.0 -Release: 29 +Release: 30 Epoch: 2 Summary: QEMU is a generic and open source machine emulator and virtualizer License: GPLv2 and BSD and MIT and CC-BY-SA-4.0 @@ -237,6 +237,8 @@ Patch0223: tools-virtiofsd-Add-rseq-syscall-to-the-seccomp-allo.patch Patch0224: sw_64-Add-sw64-architecture-support.patch Patch0225: coro-support-live-patch-for-libcare.patch Patch0226: qemu-img-create-cache-paramter-only-use-for-reg-file.patch +Patch0227: scsi-bus-fix-incorrect-call-for-blk_error_retry_rese.patch +Patch0228: Revert-monitor-limit-io-error-qmp-event-to-at-most-o.patch BuildRequires: flex BuildRequires: gcc @@ -697,6 +699,10 @@ getent passwd qemu >/dev/null || \ %endif %changelog +* Wed Mar 30 2022 yezengruan +- scsi-bus: fix incorrect call for blk_error_retry_reset_timeout() +- Revert "monitor: limit io error qmp event to at most once per 60s" + * Fri Mar 25 2022 Jinhua Cao - qemu-img create: 'cache' paramter only use for reg file image -- Gitee