All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ying Fang <fangying1@huawei.com>
To: <qemu-devel@nongnu.org>
Cc: kwolf@redhat.com, Ying Fang <fangying1@huawei.com>,
	Jiahui Cen <cenjiahui@huawei.com>,
	zhang.zhanghailiang@huawei.com, mreitz@redhat.com
Subject: [RFC PATCH 7/7] qapi: add I/O hang and I/O hang timeout qapi event
Date: Sun, 27 Sep 2020 21:04:20 +0800	[thread overview]
Message-ID: <20200927130420.1095-8-fangying1@huawei.com> (raw)
In-Reply-To: <20200927130420.1095-1-fangying1@huawei.com>

Sometimes hypervisor management tools like libvirt may need to monitor
I/O hang events. Let's report I/O hang and I/O hang timeout event via qapi.

Signed-off-by: Jiahui Cen <cenjiahui@huawei.com>
Signed-off-by: Ying Fang <fangying1@huawei.com>
---
 block/block-backend.c |  3 +++
 qapi/block-core.json  | 26 ++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/block/block-backend.c b/block/block-backend.c
index 95b2d6a679..5dc5b11bcc 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -2540,6 +2540,7 @@ static bool blk_iohang_handle(BlockBackend *blk, int new_status)
             /* Case when I/O Hang is recovered */
             blk->is_iohang_timeout = false;
             blk->iohang_time = 0;
+            qapi_event_send_block_io_hang(false);
         }
         break;
     case BLOCK_IO_HANG_STATUS_HANG:
@@ -2547,12 +2548,14 @@ static bool blk_iohang_handle(BlockBackend *blk, int new_status)
             /* Case when I/O hang is first triggered */
             blk->iohang_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME) / 1000;
             need_rehandle = true;
+            qapi_event_send_block_io_hang(true);
         } else {
             if (!blk->is_iohang_timeout) {
                 now = qemu_clock_get_ms(QEMU_CLOCK_REALTIME) / 1000;
                 if (now >= (blk->iohang_time + blk->iohang_timeout)) {
                     /* Case when I/O hang is timeout */
                     blk->is_iohang_timeout = true;
+                    qapi_event_send_block_io_hang_timeout(true);
                 } else {
                     /* Case when I/O hang is continued */
                     need_rehandle = true;
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 3c16f1e11d..7bdf75c6d7 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -5535,3 +5535,29 @@
 { 'command': 'blockdev-snapshot-delete-internal-sync',
   'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
   'returns': 'SnapshotInfo' }
+
+##
+# @BLOCK_IO_HANG:
+#
+# Emitted when device I/O hang trigger event begin or end
+#
+# @set: true if I/O hang begin; false if I/O hang end.
+#
+# Since: 5.2
+#
+##
+{ 'event': 'BLOCK_IO_HANG',
+  'data': { 'set': 'bool' }}
+
+##
+# @BLOCK_IO_HANG_TIMEOUT:
+#
+# Emitted when device I/O hang timeout event set or clear
+#
+# @set: true if set; false if clear.
+#
+# Since: 5.2
+#
+##
+{ 'event': 'BLOCK_IO_HANG_TIMEOUT',
+  'data': { 'set': 'bool' }}
-- 
2.23.0



  parent reply	other threads:[~2020-09-27 13:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-27 13:04 [RFC PATCH 0/7] block-backend: Introduce I/O hang Ying Fang
2020-09-27 13:04 ` [RFC PATCH 1/7] block-backend: introduce I/O rehandle info Ying Fang
2020-09-27 13:04 ` [RFC PATCH 2/7] block-backend: rehandle block aios when EIO Ying Fang
2020-09-27 13:04 ` [RFC PATCH 3/7] block-backend: add I/O hang timeout Ying Fang
2020-09-27 13:04 ` [RFC PATCH 4/7] block-backend: add I/O hang drain when disbale Ying Fang
2020-09-28 15:09   ` Eric Blake
2020-09-27 13:04 ` [RFC PATCH 5/7] virtio-blk: disable I/O hang when resetting Ying Fang
2020-09-27 13:04 ` [RFC PATCH 6/7] qemu-option: add I/O hang timeout option Ying Fang
2020-09-27 13:04 ` Ying Fang [this message]
2020-09-27 13:27 ` [RFC PATCH 0/7] block-backend: Introduce I/O hang no-reply
2020-09-27 13:32 ` no-reply
2020-09-28 10:57 ` Kevin Wolf
2020-09-29  9:48   ` cenjiahui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200927130420.1095-8-fangying1@huawei.com \
    --to=fangying1@huawei.com \
    --cc=cenjiahui@huawei.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhang.zhanghailiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.