From patchwork Wed Oct 11 07:17:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: lv.mengzhao@zte.com.cn X-Patchwork-Id: 1846765 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S5DHN6qrgz23jg for ; Thu, 12 Oct 2023 00:33:20 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqZKP-0006gc-VE; Wed, 11 Oct 2023 09:32:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqTU8-0000Ew-HO; Wed, 11 Oct 2023 03:18:24 -0400 Received: from mxct.zte.com.cn ([183.62.165.209]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqTU3-0000Wq-HY; Wed, 11 Oct 2023 03:18:24 -0400 Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4S53yJ11YBz4xVbv; Wed, 11 Oct 2023 15:18:00 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.99.176]) by mse-fl2.zte.com.cn with SMTP id 39B7HqQo085845; Wed, 11 Oct 2023 15:17:53 +0800 (+08) (envelope-from lv.mengzhao@zte.com.cn) Received: from mapi (xaxapp03[null]) by mapi (Zmail) with MAPI id mid31; Wed, 11 Oct 2023 15:17:54 +0800 (CST) Date: Wed, 11 Oct 2023 15:17:54 +0800 (CST) X-Zmail-TransId: 2afb65264c226da-73b8f X-Mailer: Zmail v1.0 Message-ID: <202310111517549668181@zte.com.cn> Mime-Version: 1.0 From: To: , , , Cc: , , Subject: =?utf-8?q?=5BPATCH=5D_virtio-blk=3A_don=27t_start_dataplane_during_?= =?utf-8?q?the_stop_of_dataplane?= X-MAIL: mse-fl2.zte.com.cn 39B7HqQo085845 X-Fangmail-Gw-Spam-Type: 0 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 65264C28.000/4S53yJ11YBz4xVbv Received-SPF: pass client-ip=183.62.165.209; envelope-from=lv.mengzhao@zte.com.cn; helo=mxct.zte.com.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 11 Oct 2023 09:32:07 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: hujian During the stop of dataplane for virtio-blk, virtio_bus_cleanup_host_notifier() is be called to clean up notifier at the end, if polled ioeventfd, virtio_blk_handle_output() is used to handle io request. But due to s->dataplane_disabled is false, it will be returned directly, which drops io request. Backtrace: ->virtio_blk_data_plane_stop ->virtio_bus_cleanup_host_notifier ->virtio_queue_host_notifier_read ->virtio_queue_notify_vq ->vq->handle_output ->virtio_blk_handle_output ->if (s->dataplane && !s->dataplane_stoped) ->if (!s->dataplane_disabled) ->return * ->virtio_blk_handle_output_do The above problem can occur when using "virsh reset" cmdline to reset guest, while guest does io. To fix this problem, don't try to start dataplane if s->stopping is true, and io will be handled by virtio_blk_handle_vq(). Signed-off-by: hujian --- hw/block/virtio-blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.8.3.1 diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 39e7f23..c2d5938 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -1166,7 +1166,7 @@ static void virtio_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq) { VirtIOBlock *s = (VirtIOBlock *)vdev; - if (s->dataplane && !s->dataplane_started) { + if (s->dataplane && !s->dataplane_started && !s->stopping) { /* Some guests kick before setting VIRTIO_CONFIG_S_DRIVER_OK so start * dataplane here instead of waiting for .set_status(). */