From nobody Mon Nov 25 04:48:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1717528052; cv=none; d=zohomail.com; s=zohoarc; b=kKFRCTn3CfpgqlsTIAATVMpflTngsgOp9b9kZWf5RoTyUKSi6EXuh/qDTjSZRRj/rQPFuwPocacZnMxV8klsOLq3/7p2y3b4LxlW2HRn0Se1V/cgyDuwA7Ntm1YMXN3oxlW7TyzMBteOLIXBWQF/X5OZNWyX37QGqWarKGiKes8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717528052; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+cVsXdQI2RthGLy7TxkQZRDMuYIrDeTU2bckWSqVXa0=; b=UZ02QZORnOSnRbi4SinoS1atXiRcoQ4qOh1xUd+y+9exN4m67EBNAKc9LpM/0YOMK0dM/SpCrfMNFIPM+yHPX/lWvBBLruPgwYW4Fc+AbaJAs+rGSTSjK/762x9kIMXB3F4o+qDxpZmtX6MA4j7KiRKNx2lAQmvJrf1jl2SQvIc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717528052923910.5101214055181; Tue, 4 Jun 2024 12:07:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sEZUs-0006dc-JV; Tue, 04 Jun 2024 15:07:02 -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 1sEZUr-0006cx-5w for qemu-devel@nongnu.org; Tue, 04 Jun 2024 15:07:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sEZUo-0000qa-V0 for qemu-devel@nongnu.org; Tue, 04 Jun 2024 15:07:00 -0400 Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-3gBYGC6wP7CBdfHRIPsNWA-1; Tue, 04 Jun 2024 15:06:55 -0400 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2ea93c06e3cso40114581fa.2 for ; Tue, 04 Jun 2024 12:06:55 -0700 (PDT) Received: from redhat.com ([2a0d:6fc7:552:cf5c:2b13:215c:b9df:f231]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-421526593cfsm27227825e9.42.2024.06.04.12.06.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 12:06:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717528017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+cVsXdQI2RthGLy7TxkQZRDMuYIrDeTU2bckWSqVXa0=; b=HKtcIwc8QGhh54QXzUPQkZlzE/SEE90lrovueAk4ILWZHb5EnscaROR9spX27k+d1/ofpi ycdkgDk7ugh00KmugqGcrMN2BVeFIJKaJHTClh8qsfcStsbGucQBcZ3MgiaWHKR89ZswA3 jTWwOC7oy8eI+NdRfY7H/1oQ4SBApio= X-MC-Unique: 3gBYGC6wP7CBdfHRIPsNWA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717528013; x=1718132813; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+cVsXdQI2RthGLy7TxkQZRDMuYIrDeTU2bckWSqVXa0=; b=WGTmWLvlUllFFDlfpUt53YWdaJC+WjKZnFiRu0TCNW9SXOaWg6343ltpFe0Xv7jUDc a9U6EM8VNbtj3sulkCRTiwAW76n8ObcYK/tI0M7FTTIaY2eu3RVD/AgQgpSIpMX9S3wS BoezeHq6EWjnrcOL/Q8QALlusHI+aWCBRVBzXwerBQxMToQV5/QSxDE5myy+3JzjsYHr FpvvBcYWl0rwVoCqGvumfC48Vt7/asL+xibRmZ0E6V+zVdPIMLhB9Kmmzct37cyNkLmQ R7TUn1kaQpxZepb3k1GIiFzRp1MCg9xXTDknqQXMOlqhE1aWbysYcpXTbMgKcbPAQgfU Z/Ng== X-Gm-Message-State: AOJu0YxYH6dJY4HvO7wzSWMIhtepjMR0+DeUsFSHciRMh1Ttng1SA0iA Doze8c5QUMW1oALWtKRw3WuEV/DdM/C9qNUl/Io6mTSCS5T2gNyfQassmWMVe+99vZrX8ZuE6Lg wmrrQ64OvdcuH8Wj1Ym0eC0r1DrrX6f6eRmRKVKLX17kWuhzmw/5S1o1Ksh6ymwEvdy3ft7sn9z Nckd3r9ggcwY5XuGBmMhbsednZKq2JXg== X-Received: by 2002:a05:651c:b2a:b0:2e9:5b89:dc6a with SMTP id 38308e7fff4ca-2eac7a52b27mr1366381fa.39.1717528013256; Tue, 04 Jun 2024 12:06:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE7Ru2hPSpUe0cE9lir+g1PguAn9zQdV1nKll5J/tP04HjprCj9F6vnCPvONBdGL11xbxK21w== X-Received: by 2002:a05:651c:b2a:b0:2e9:5b89:dc6a with SMTP id 38308e7fff4ca-2eac7a52b27mr1366031fa.39.1717528012630; Tue, 04 Jun 2024 12:06:52 -0700 (PDT) Date: Tue, 4 Jun 2024 15:06:49 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Li Feng , Raphael Norwitz , Kevin Wolf , Hanna Reitz , Paolo Bonzini , Fam Zheng , Alex =?utf-8?Q?Benn=C3=A9e?= , qemu-block@nongnu.org Subject: [PULL 15/46] Revert "vhost-user: fix lost reconnect" Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1717528053961100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Li Feng This reverts commit f02a4b8e6431598612466f76aac64ab492849abf. Since the current patch cannot completely fix the lost reconnect problem, there is a scenario that is not considered: - When the virtio-blk driver is removed from the guest os, s->connected has no chance to be set to false, resulting in subsequent reconnection not being executed. The next patch will completely fix this issue with a better approach. Signed-off-by: Li Feng Message-Id: <20240516025753.130171-2-fengli@smartx.com> Reviewed-by: Raphael Norwitz Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-user.h | 3 +-- hw/block/vhost-user-blk.c | 2 +- hw/scsi/vhost-user-scsi.c | 3 +-- hw/virtio/vhost-user-base.c | 2 +- hw/virtio/vhost-user.c | 10 ++-------- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/include/hw/virtio/vhost-user.h b/include/hw/virtio/vhost-user.h index d7c09ffd34..324cd8663a 100644 --- a/include/hw/virtio/vhost-user.h +++ b/include/hw/virtio/vhost-user.h @@ -108,7 +108,6 @@ typedef void (*vu_async_close_fn)(DeviceState *cb); =20 void vhost_user_async_close(DeviceState *d, CharBackend *chardev, struct vhost_dev *vhost, - vu_async_close_fn cb, - IOEventHandler *event_cb); + vu_async_close_fn cb); =20 #endif diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index bc2677dbef..15cc24d017 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -385,7 +385,7 @@ static void vhost_user_blk_event(void *opaque, QEMUChrE= vent event) case CHR_EVENT_CLOSED: /* defer close until later to avoid circular close */ vhost_user_async_close(dev, &s->chardev, &s->dev, - vhost_user_blk_disconnect, vhost_user_blk_e= vent); + vhost_user_blk_disconnect); break; case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index 0b050805a8..421cd654f8 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -215,8 +215,7 @@ static void vhost_user_scsi_event(void *opaque, QEMUChr= Event event) case CHR_EVENT_CLOSED: /* defer close until later to avoid circular close */ vhost_user_async_close(dev, &vs->conf.chardev, &vsc->dev, - vhost_user_scsi_disconnect, - vhost_user_scsi_event); + vhost_user_scsi_disconnect); break; case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: diff --git a/hw/virtio/vhost-user-base.c b/hw/virtio/vhost-user-base.c index a83167191e..4b54255682 100644 --- a/hw/virtio/vhost-user-base.c +++ b/hw/virtio/vhost-user-base.c @@ -254,7 +254,7 @@ static void vub_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_CLOSED: /* defer close until later to avoid circular close */ vhost_user_async_close(dev, &vub->chardev, &vub->vhost_dev, - vub_disconnect, vub_event); + vub_disconnect); break; case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index cdf9af4a4b..c929097e87 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -2776,7 +2776,6 @@ typedef struct { DeviceState *dev; CharBackend *cd; struct vhost_dev *vhost; - IOEventHandler *event_cb; } VhostAsyncCallback; =20 static void vhost_user_async_close_bh(void *opaque) @@ -2791,10 +2790,7 @@ static void vhost_user_async_close_bh(void *opaque) */ if (vhost->vdev) { data->cb(data->dev); - } else if (data->event_cb) { - qemu_chr_fe_set_handlers(data->cd, NULL, NULL, data->event_cb, - NULL, data->dev, NULL, true); - } + } =20 g_free(data); } @@ -2806,8 +2802,7 @@ static void vhost_user_async_close_bh(void *opaque) */ void vhost_user_async_close(DeviceState *d, CharBackend *chardev, struct vhost_dev *vhost, - vu_async_close_fn cb, - IOEventHandler *event_cb) + vu_async_close_fn cb) { if (!runstate_check(RUN_STATE_SHUTDOWN)) { /* @@ -2823,7 +2818,6 @@ void vhost_user_async_close(DeviceState *d, data->dev =3D d; data->cd =3D chardev; data->vhost =3D vhost; - data->event_cb =3D event_cb; =20 /* Disable any further notifications on the chardev */ qemu_chr_fe_set_handlers(chardev, --=20 MST