From patchwork Fri Apr 26 11:09:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Haoqian He X-Patchwork-Id: 139702 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 69D9143F13; Fri, 26 Apr 2024 13:10:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E1E8343D75; Fri, 26 Apr 2024 13:10:07 +0200 (CEST) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mails.dpdk.org (Postfix) with ESMTP id BFBBA40289 for ; Fri, 26 Apr 2024 13:10:06 +0200 (CEST) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1e65b29f703so17944125ad.3 for ; Fri, 26 Apr 2024 04:10:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20230601.gappssmtp.com; s=20230601; t=1714129806; x=1714734606; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GKTxmqew+rvCX5Zg7C+CU2vpNXsP12QqlfX5l5cK+VU=; b=Hqsu5N3uLfBAFPvJGIe/UlOaTHAo4sXxBkbBOrp2Dxu5kEMc7FLZy5yQMD8v6XsvA8 WhKYc7U2cATqs1tIjMeCwna4ocJ6uHSJyk0GIR9R0/7pGE7sdRbG1eb6iuyF6YRy7eF2 uzzopBarqUpi1EiYJrdgX6sqJ0+voxzpZ2swi4NjqsSuPAlFQDKHPK9M50unb29WslyV xuL4eJCSgpxYEY2x/9ZTWHzlmz+FcyxU7SBxs/GlppNsZNXVpgkG7pA7AHgd0tiEh8Vh 1OdIF4s7+ARM7Iol7RnjbUZDzwpW3bmGL9qbmfD+lCwzAtBNLK28FcPJOxpTc6n922Ag PrpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714129806; x=1714734606; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GKTxmqew+rvCX5Zg7C+CU2vpNXsP12QqlfX5l5cK+VU=; b=KzLfNwurEHx7XYwwJlHofhjnJs4dwaB1KCneVlMR3T9/7x11quz6nllnHBo26OZ03o Vr5JPSxlnKbY2IM5q8BSMjD0SndoHMoH/wzI2pJTHSwwRr+AjjEKHtbRd8bMzkpZUeHk 8UO/PMWNBBLlbojGC60u4UoJpDNsH0OWd6B08UVKoyDTmSKtw3E0qjHfdAWeZlmk+JaA Yv8KgiMQfiBcYOHbJoRbw/LGruhc6QJlO2p2mpsZaKDLNhtVR2X2+x4RMRlQQ4F/WKiV zvi7dysbMBgYqbYUrvo6SSnz3R3d7qtUSsqxgHyPegkin79tQba/7Pwj7d1d5TfPEYbV Aang== X-Forwarded-Encrypted: i=1; AJvYcCU62MO6epGrPtZ3VpbpA9YleZkkJaFqYIi+tMlFGn0kem9iqhjTYdDdLFUfmQuC8IIF23XD8IjeOqkHD60= X-Gm-Message-State: AOJu0Ywcw7rTIifJDtSVRPG0jkBT6QRUx3aw4z1oCS9oc91cnGezMp37 oCFCTS41WdsxzNUC8cFT//u0OYeLGzLdnXG085lUkMWaZWXQ9W+4MtBlHarCUUI= X-Google-Smtp-Source: AGHT+IHn8xo7qifFlwHFNdgh5SZkP3sRCliS7sckA+RoXBIEj8OpUqE1L6CUzJVanSkduYunPzvjMA== X-Received: by 2002:a17:902:ef89:b0:1e1:214:1b7d with SMTP id iz9-20020a170902ef8900b001e102141b7dmr2073633plb.61.1714129804855; Fri, 26 Apr 2024 04:10:04 -0700 (PDT) Received: from fedora.smartx.com ([1.202.18.10]) by smtp.gmail.com with ESMTPSA id c7-20020a170903234700b001eb0dd08e40sm925467plh.133.2024.04.26.04.10.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 04:10:04 -0700 (PDT) From: Haoqian He To: maxime.coquelin@redhat.com Cc: chenbox@nvidia.com, dev@dpdk.org, haoqian.he@smartx.com, fengli@smartx.com, stable@dpdk.org Subject: [PATCH v2] vhost: cleanup resubmit info before inflight setup Date: Fri, 26 Apr 2024 07:09:46 -0400 Message-ID: <20240426110947.881407-1-haoqian.he@smartx.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <8a04f203-4ef0-4840-b480-b21e08561c7d@redhat.com> References: <8a04f203-4ef0-4840-b480-b21e08561c7d@redhat.com> MIME-Version: 1.0 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 This patch fixes a potential VM hang bug when the VM reboots after vhost live recovery due to missing cleanup virtqueue resubmit info. Specifically, if inflight IO that should be resubmitted during the latest vhost reconnection has not been submitted yet while VM rebooting, so GET_VRING_BASE would not wait for the inflight IO, at this time the resubmit info has been. When the VM restarts, SET_VRING_KICK will resubmit the inflight IO (If resubmit info is not null, function set_vring_kick will return without updating resubmit info). It’s an error, any stale inflight IO should not be resubmitted after the VM restart. The solution is to clean up virtqueue resubmit info when function set_inflight_fd before function set_vring_kick. Fixes: ad0a4ae491fe ("vhost: checkout resubmit inflight information") Cc: stable@dpdk.org Signed-off-by: Haoqian He --- v2: rewrite the commit message. lib/vhost/vhost_user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index 414192500e..7c54afc5fb 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -1871,6 +1871,7 @@ vhost_user_set_inflight_fd(struct virtio_net **pdev, if (!vq) continue; + cleanup_vq_inflight(dev, vq); if (vq_is_packed(dev)) { vq->inflight_packed = addr; vq->inflight_packed->desc_num = queue_size;