From nobody Tue Feb 10 10:59:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1601459457; cv=none; d=zohomail.com; s=zohoarc; b=jC4P0TVTrTzkWhVFC1qT5rfckUE+SfXwJS/AfCXfXSso/rSSuxEQtXw/c4U1/ZkOUPT5++Uj/rwhMb6assNuThsV97UohzfsOeL+gjpALfT+8e9SgtLDFUZdGDgO9QRRHQy8Nh2CDunVN69IjxOlkuAsAfmtSqDkL8glCpY6DJc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601459457; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Q1+kmg1ABxEF/dFL6nNhyhU2XYW0rb0JAI+egcqsRW0=; b=eRdP5mc0Rar035DHmbJ84HzwvG9r11293aktN07elwgrRpIN1U3GkrkuiFIlB0V4luuDPP6ey8Dkzd1PnRlNEs4yPdZ+fMvukYSwZ+K/oay99CLP9u/J53Jvd6T8cbdc16v5b/7SVizvrPXOh+KGNwCcUvP+uMCr3A7//bL2Kr0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601459457112631.3232016388997; Wed, 30 Sep 2020 02:50:57 -0700 (PDT) Received: from localhost ([::1]:55626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kNYlB-0002OF-UW for importer@patchew.org; Wed, 30 Sep 2020 05:50:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kNYhR-00072w-Kl for qemu-devel@nongnu.org; Wed, 30 Sep 2020 05:47:01 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:40788 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kNYhM-0003oI-TM for qemu-devel@nongnu.org; Wed, 30 Sep 2020 05:47:01 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id AEF0E67C36DC74AF360E; Wed, 30 Sep 2020 17:46:52 +0800 (CST) Received: from localhost (10.174.186.107) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Wed, 30 Sep 2020 17:46:46 +0800 From: Jiahui Cen To: Subject: [RFC PATCH v2 8/8] qapi: add I/O hang and I/O hang timeout qapi event Date: Wed, 30 Sep 2020 17:46:06 +0800 Message-ID: <20200930094606.5323-9-cenjiahui@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200930094606.5323-1-cenjiahui@huawei.com> References: <20200930094606.5323-1-cenjiahui@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.186.107] X-CFilter-Loop: Reflected Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=45.249.212.35; envelope-from=cenjiahui@huawei.com; helo=huawei.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/30 05:46:53 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fangying1@huawei.com, cenjiahui@huawei.com, zhang.zhanghailiang@huawei.com, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" 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 Signed-off-by: Ying Fang --- 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 c812b3a9c7..42337ceb04 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -2556,6 +2556,7 @@ static bool blk_iohang_handle(BlockBackend *blk, int = new_status) /* Case when I/O Hang is recovered */ blk->is_iohang_timeout =3D false; blk->iohang_time =3D 0; + qapi_event_send_block_io_hang(false); } break; case BLOCK_IO_HANG_STATUS_HANG: @@ -2563,12 +2564,14 @@ static bool blk_iohang_handle(BlockBackend *blk, in= t new_status) /* Case when I/O hang is first triggered */ blk->iohang_time =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME) / = 1000; need_rehandle =3D true; + qapi_event_send_block_io_hang(true); } else { if (!blk->is_iohang_timeout) { now =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME) / 1000; if (now >=3D (blk->iohang_time + blk->iohang_timeout)) { /* Case when I/O hang is timeout */ blk->is_iohang_timeout =3D true; + qapi_event_send_block_io_hang_timeout(true); } else { /* Case when I/O hang is continued */ need_rehandle =3D 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' }} --=20 2.28.0