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 6/7] qemu-option: add I/O hang timeout option
Date: Sun, 27 Sep 2020 21:04:19 +0800	[thread overview]
Message-ID: <20200927130420.1095-7-fangying1@huawei.com> (raw)
In-Reply-To: <20200927130420.1095-1-fangying1@huawei.com>

I/O hang timeout should be different under different situations. So it is
better to provide an option for user to determine I/O hang timeout for
each block device.

Signed-off-by: Jiahui Cen <cenjiahui@huawei.com>
Signed-off-by: Ying Fang <fangying1@huawei.com>
---
 blockdev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/blockdev.c b/blockdev.c
index 7f2561081e..ff8cdcd497 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -500,6 +500,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
     BlockdevDetectZeroesOptions detect_zeroes =
         BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF;
     const char *throttling_group = NULL;
+    int64_t iohang_timeout = 0;
 
     /* Check common options by copying from bs_opts to opts, all other options
      * stay in bs_opts for processing by bdrv_open(). */
@@ -622,6 +623,12 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
 
         bs->detect_zeroes = detect_zeroes;
 
+        /* init timeout value for I/O Hang */
+        iohang_timeout = qemu_opt_get_number(opts, "iohang-timeout", 0);
+        if (iohang_timeout > 0) {
+            blk_iohang_init(blk, iohang_timeout);
+        }
+
         block_acct_setup(blk_get_stats(blk), account_invalid, account_failed);
 
         if (!parse_stats_intervals(blk_get_stats(blk), interval_list, errp)) {
@@ -3786,6 +3793,10 @@ QemuOptsList qemu_common_drive_opts = {
             .type = QEMU_OPT_BOOL,
             .help = "whether to account for failed I/O operations "
                     "in the statistics",
+        },{
+            .name = "iohang-timeout",
+            .type = QEMU_OPT_NUMBER,
+            .help = "timeout value for I/O Hang",
         },
         { /* end of list */ }
     },
-- 
2.23.0



  parent reply	other threads:[~2020-09-27 13:06 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 ` Ying Fang [this message]
2020-09-27 13:04 ` [RFC PATCH 7/7] qapi: add I/O hang and I/O hang timeout qapi event Ying Fang
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-7-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.