From nobody Tue Feb 10 00:23:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1555421055; cv=none; d=zoho.com; s=zohoarc; b=SSqe8tpZkZzdjHKAeTewQtYP8DkW4dcCapr4Z1WkDa6fy4DDKIQgRrXh0TX26BO3sC/s4RcaU8T2rQZn0z0mMh4k2Z/MTaO+icTRlZsC3poNcJxEKoiiTOhgYrUdEl1G5pgxZmFibrMeKwIIVEJ+mGth07610v6tvVcVHvQhvPQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555421055; 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:ARC-Authentication-Results; bh=e2JtH7krSyKhhuS6XhE+iZmIweMnN9Gq6tcyXtUXsMg=; b=CVc7yxmrL5+OykpFaXou2yhjKYdbQb1d1rM26crBkP2i4bFodQlQOnlCkaRuDE2p0MbflcHrBnXer0vRIx/DJz2oJAPcW0x6A8oHtvopna4V2DGodz6LIMd7T54dQxHf7N/SqbaXwDyVYPb1AKw7QYLT1HXUXLaryWJ3yxKlSCk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555421055473616.7369666585498; Tue, 16 Apr 2019 06:24:15 -0700 (PDT) Received: from localhost ([127.0.0.1]:36733 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGO4H-0008NC-Es for importer@patchew.org; Tue, 16 Apr 2019 09:24:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGNga-00064O-7E for qemu-devel@nongnu.org; Tue, 16 Apr 2019 08:59:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hGNgY-00022c-3s for qemu-devel@nongnu.org; Tue, 16 Apr 2019 08:59:40 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:37994) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hGNgX-00021t-Pf for qemu-devel@nongnu.org; Tue, 16 Apr 2019 08:59:38 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3GCxTmU055626; Tue, 16 Apr 2019 12:59:36 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 2rusnetf76-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Apr 2019 12:59:36 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3GCwAUL185417; Tue, 16 Apr 2019 12:59:35 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 2rwe79s8ag-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Apr 2019 12:59:35 +0000 Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x3GCxXGX020497; Tue, 16 Apr 2019 12:59:34 GMT Received: from spark.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 16 Apr 2019 05:59:33 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=/f6Vn0qOWjqIheyoMHr5MtfUPS8Upb1rVgZ3o5Gcs3s=; b=IxTpEU+1oXtFTLCfD7pqlb4x7sT+xoRA+0kK62O2EZ84BetkPkosnMK2Gu0w8EKI5QyC 7w47ffzqdJEDOgSJ7wp/XAqyNXUTk9tXKUNOeq2YtMU4P0NtjaYqiOjii3IGCWOZCQgs Cz1IIXVHD8cLkxuzQAFpBwywhaQSA4KsKmdysYV3qzQ9Xb2UAq7/nJi7D0awK6yWJSGg qGrpUfj1guRYBF6OL8ICdeMrn1OH9BEiYO9wpZr8/7TpB6O/1uxRkKxxk4+5OPah+ZB5 UZE/xf7ECOYSa3aiNu3CrB/MX40V6dpB8oH8fDYhnbKrM7uYNCunnQWXZGaGfqpsqZ2/ 9A== From: Liran Alon To: qemu-devel@nongnu.org Date: Tue, 16 Apr 2019 15:59:10 +0300 Message-Id: <20190416125912.44001-2-liran.alon@oracle.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190416125912.44001-1-liran.alon@oracle.com> References: <20190416125912.44001-1-liran.alon@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9228 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904160088 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9228 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904160088 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by userp2120.oracle.com id x3GCxTmU055626 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.85 Subject: [Qemu-devel] [PATCH v2 1/3] vhost-scsi: The vhost backend should be stopped when the VM is not running X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ehabkost@redhat.com, stefanha@gmail.com, mtosatti@redhat.com, bijan.mottahedeh@oracle.com, Liran Alon , pbonzini@redhat.com, nir.weiner@oracle.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Nir Weiner vhost-scsi doesn=E2=80=99t takes into account whether the VM is running or = not in order to decide if it should start/stop vhost backend. This would lead to vhost backend still being active when VM's RunState suddenly change to stopped. An example of when this issue is encountered is when Live-Migration Pre-Copy phase completes. As in this case, VM state will be changed to stopped (while vhost backend is still active), which will result in virtio_vmstate_change() -> virtio_set_status() -> vhost_scsi_set_status() executed but vhost_scsi_set_status() will just return without stopping vhost backend. To handle this, change code to consider that vhost processing should be stopped when VM is not running. Similar to how it is done in vhost-vsock device at vhost_vsock_set_status(). Fixes: 5e9be92d7752 ("vhost-scsi: new device supporting the tcm_vhost Linux= kernel module=E2=80=9D) Reviewed-by: Bijan Mottahedeh Reviewed-by: Liran Alon Signed-off-by: Nir Weiner --- hw/scsi/vhost-scsi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index 61e2e57da9d5..ca42cff1b907 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -114,6 +114,10 @@ static void vhost_scsi_set_status(VirtIODevice *vdev, = uint8_t val) VHostSCSICommon *vsc =3D VHOST_SCSI_COMMON(s); bool start =3D (val & VIRTIO_CONFIG_S_DRIVER_OK); =20 + if (!vdev->vm_running) { + start =3D false; + } + if (vsc->dev.started =3D=3D start) { return; } --=20 2.20.1