From patchwork Fri Sep 3 07:56:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Feng X-Patchwork-Id: 97876 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 613A1A0C53; Fri, 3 Sep 2021 09:56:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D6D9340DDE; Fri, 3 Sep 2021 09:56:56 +0200 (CEST) Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by mails.dpdk.org (Postfix) with ESMTP id AC080406B4 for ; Fri, 3 Sep 2021 09:56:54 +0200 (CEST) Received: by mail-pj1-f41.google.com with SMTP id f11-20020a17090aa78b00b0018e98a7cddaso3364935pjq.4 for ; Fri, 03 Sep 2021 00:56:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JeJDlOhtbDzZLOVt0CWldBRm1JgFrEUu17qttgi70Zs=; b=jc44aQBPwaSCi7T5GDDsWSnZQEN9KhUp7YhZWs+CMpukcv7vo/I/SJgg2VobNjA4vc onIfs9hXce5i//8lj612W4dSxZ2fFq5y53ESEr2t3kHoWFwdh0E1H/jSvEfp1QpxPfLT TdNtI0plEITEvRx//Mt7rih5kkEwsAnJsC1CUobsM6J6VBMqYL3aJyNalTln+Pl6BHWG LfioJv5G46oaEMkWARfyb+FdxS9zht/ejm9ca7K+X12AzWDqErilYL7VVZ/EaYKv2WGx /gYR5tWU8L3xphXA3I8VGi44bLt5thh5zALXyHtZbjxDxgUcpudyWsejd0M7yY+Cb74W 0XMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JeJDlOhtbDzZLOVt0CWldBRm1JgFrEUu17qttgi70Zs=; b=FnEG0gSM1N1qdDoHYz1/YO1qHxWw/sBRktX38+sncU3eQWIr5R3R3JcHrdn968C4EH 9QgU6emu9GRjvF8+I/KG3MgXel1c/gWcvt7MQf7R/SYL3sp017W6S9pP5Wo73x6PF3S2 rH/AreQtAYX5btuTNwe+hGQ4H3AnvEXGHDXiqj9XKswI0uabUxbzTXg3zzNVPVAAQG+o WevWDtxudi3+fGHHjxb1cJgQA6L2RgIYPmSIv4ggfaaoEJXDU+9sUKtZpsywh8cG0gXZ wZ6iW0jxHQsmvpx7+2Dj3w4JbXrMWxtZqf6vK4Py8tmYAt+s55pDMNWeM2A9iWQhBISu o0Ag== X-Gm-Message-State: AOAM532KV/xE12ZL7o3wqzh8LZc1sFp4ft6gVNsQBtuaGYGdGiApUL+U KaiApKhYjHnxpg3TplQCV9VvAA== X-Google-Smtp-Source: ABdhPJy3xNEGeeSLq59+bbHe3rMcaGYJTfwToDh2w04rTWrN3P8GuWs4G/06lPwqxIvvTEvzcgnU4g== X-Received: by 2002:a17:90a:c7d0:: with SMTP id gf16mr8588422pjb.17.1630655813616; Fri, 03 Sep 2021 00:56:53 -0700 (PDT) Received: from 64-217.smartx.com ([103.97.201.35]) by smtp.gmail.com with ESMTPSA id r15sm4657278pfh.45.2021.09.03.00.56.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 00:56:53 -0700 (PDT) From: Li Feng To: Maxime Coquelin , Chenbo Xia Cc: dev@dpdk.org, Li Feng Date: Fri, 3 Sep 2021 15:56:37 +0800 Message-Id: <20210903075637.2201185-1-fengli@smartx.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] vhost: call destroy_device always in vhost_destroy_device_notify X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Vhost-user client must send the mem table, kick fd, call fd on all vas, then the device will be VIRTIO_DEV_RUNNING. If the vhost-user communication is initialized partly, e.g. - When initializing the vhost-user, try to restart the vhost-user backend; - Seabios only initialized the vhost-scsi req vq. The device is not with flags VIRTIO_DEV_RUNNING.. Root Cause: The vhost session has been created, and added the scsi/blk requestq poller into reactor, but when destroying the device, the requestq is not unregistered. Reproduce the crash on spdk vhost-user backend: 1. Create a VM; 2. Mount a ISO to a VM, start the VM, don't install the OS; 3. Restart the spdk_tgt; Another discusstion is in seabiso: https://patchew.org/Seabios/20210831122339.2591585-1-fengli@smartx.com/ Signed-off-by: Li Feng --- lib/vhost/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index 355ff37651..191ba82c41 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -710,8 +710,8 @@ vhost_destroy_device_notify(struct virtio_net *dev) if (vdpa_dev) vdpa_dev->ops->dev_close(dev->vid); dev->flags &= ~VIRTIO_DEV_RUNNING; - dev->notify_ops->destroy_device(dev->vid); } + dev->notify_ops->destroy_device(dev->vid); } /*