From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BAF7643E50; Fri, 12 Apr 2024 10:10:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5150E40299; Fri, 12 Apr 2024 10:10:30 +0200 (CEST) Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.44]) by mails.dpdk.org (Postfix) with ESMTP id EE34C40295 for ; Fri, 12 Apr 2024 10:10:28 +0200 (CEST) Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-5a50880ce2aso391173eaf.0 for ; Fri, 12 Apr 2024 01:10:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20230601.gappssmtp.com; s=20230601; t=1712909427; x=1713514227; darn=dpdk.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=WOQNF4WkWJuSKx9AWYIXAJJKpGMoyDsO71dy+nnCcYM=; b=TbWFV4PL7ULxlBaRpxdLN3InZfWiTtfWyKQfIxiNZAlv8oOvgUDDGpdB0NfXyJuK56 yhAeBtNIcwzf/eVI9SRf3ohez8QOR4dfcJ121UTasZY4aFWcN0+xiavHzqFaZg5frPm1 +rQkYW54VpVEE9BXE1SFWj79NbXIrqCfRlZSYc89dmlQ9rsMuOwi94m/oMjw3p22k4TG gk78aiNco2u3aMJtdcObObLEiwoJQ3IjJ9qg41Iq22qwqa0HBnYsWxRLdePPJdHmUOk3 /yp6td3N4x4B5jRI08mHGXPcYszUMewiWJ8o56T+6EPepNg0WOjsvW3UFwBKxwnytljf XnKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712909427; x=1713514227; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WOQNF4WkWJuSKx9AWYIXAJJKpGMoyDsO71dy+nnCcYM=; b=tpUDYFWIMw4YdR7MB5+gJkUs74BjZHxcEZbCRIaQgtQgfdfYA7E9ej24UYDRtXbIE6 6k1p+OIN559G7NyDRgPCvBKD7r0dectz5Z4eoObb92BFoVpiFD18vzzuP1ZHQyzViDuk pjBUwqncahEW92hxLV9AA0SMxOaC8SseEjcdw4AIkX7sqS9oV4LYfsG1BoyhLiECBu/t L3ElHQ2OSYcBv5v9Bv1m3RQq1JqvqhUVi2+mNKx+8gmddaWeev74uWeOhrijMU5bLD1i Falt59v2vcgG+d9qdHo1mod+UcvkyL3TqRCd6gQdrh69AUpKlaFrJ+gcI0UqIvDjeXln kmfA== X-Gm-Message-State: AOJu0YzWTwK3yj2TGtFySUaZ4w+YANv4Poof03x1oNpwfDmmF4OXP40A RXg/5xDhk4veJfBXMJVIYpGu2JOHVt+Wo9SMX2dgOuHUt3ExRHlDqfkimLmYlwdO+6cDoVuLDKM SB2k= X-Google-Smtp-Source: AGHT+IGT1oJGtskcG2HOwcIakE9/DNXVcPOAHlP73A0bOc7E/5t4JKZfVV0ewt6AWzZ+WQB+LWMSXQ== X-Received: by 2002:a05:6870:e989:b0:229:fd96:1e6f with SMTP id r9-20020a056870e98900b00229fd961e6fmr2139711oao.24.1712909427302; Fri, 12 Apr 2024 01:10:27 -0700 (PDT) Received: from smtpclient.apple ([8.210.91.195]) by smtp.gmail.com with ESMTPSA id y15-20020aa79e0f000000b006edbcfe7005sm2411215pfq.144.2024.04.12.01.10.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Apr 2024 01:10:26 -0700 (PDT) From: Haoqian He Message-Id: <0884BFE3-D739-4E61-BB0F-109959A1F88E@smartx.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_33484BD3-1CD0-43D4-A3C9-3FE4B428C294" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.500.231\)) Subject: Re: [PATCH] vhost: cleanup vq resubmit info when set_inflight_fd Date: Fri, 12 Apr 2024 16:10:13 +0800 In-Reply-To: <20240321095805.923117-1-haoqian.he@smartx.com> Cc: Chenbo Xia , Li Feng To: dev@dpdk.org, Maxime Coquelin References: <20240321095805.923117-1-haoqian.he@smartx.com> X-Mailer: Apple Mail (2.3731.500.231) 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 --Apple-Mail=_33484BD3-1CD0-43D4-A3C9-3FE4B428C294 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > 2024=E5=B9=B43=E6=9C=8821=E6=97=A5 17:57=EF=BC=8CHaoqian He = =E5=86=99=E9=81=93=EF=BC=9A >=20 > We should cleanup vq resubmit info when set_inflight_fd > before set_vring_kick which will check if there is any > inflight io waiting for resubmission. >=20 > Otherwise, when the vm is rebooting immediately after > reconnecting to the vhost target (inflight io has not > been resubmitted yet), the vhost backend still use the > old resubmit info set when reconnection. >=20 > Signed-off-by: Haoqian He > --- > lib/vhost/vhost_user.c | 1 + > 1 file changed, 1 insertion(+) >=20 > 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; >=20 > + cleanup_vq_inflight(dev, vq); > if (vq_is_packed(dev)) { > vq->inflight_packed =3D addr; > vq->inflight_packed->desc_num =3D queue_size; > --=20 > 2.41.0 >=20 Ping. Hi, Maxime. This patch fix the potential error when VM reboot after vhost live = recovery which could lead to the VM hang as missing resubmit info cleanup. If inflight io that should be resubmitted during the latest vhost = reconnection has not been submitted yet, so GET_VRING_BASE would not wait these inflight = io, at this time the resubmit info has been set and restart the VM = immediately. Currently, we do not cleanup the resubmit info before VM restart, so = when VM restarts, SET_VRING_KICK will resubmit these inflight io (If resubmit = info is not null, function set_vring_kick will return without updating resubmit = info). It=E2=80=99s an error, any stale inflight io should not be resubmitted = after the VM restart. Thanks, Haoqian =20 --Apple-Mail=_33484BD3-1CD0-43D4-A3C9-3FE4B428C294 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

2024=E5=B9=B43=E6=9C=8821=E6=97=A5 17:57=EF=BC=8CHaoqia= n He <haoqian.he@smartx.com> =E5=86=99=E9=81=93=EF=BC=9A

We should cleanup vq = resubmit info when set_inflight_fd
before set_vring_kick which will = check if there is any
inflight io waiting for = resubmission.

Otherwise, when the vm is rebooting immediately = after
reconnecting to the vhost target (inflight io has not
been = resubmitted yet), the vhost backend still use the
old resubmit info = set when reconnection.

Signed-off-by: Haoqian He = <haoqian.he@smartx.com>
---
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 =3D = addr;
= = = vq->inflight_packed->desc_num =3D queue_size;
-- =
2.41.0


Ping.
=
Hi, Maxime.

This patch fix the = potential error when VM reboot after vhost live recovery = which
could lead to the VM hang as missing resubmit info = cleanup.

If inflight io that should be = resubmitted during the latest vhost reconnection has
not been = submitted yet, so GET_VRING_BASE would not wait these inflight = io,
at this time the resubmit info has been set and restart = the VM immediately.

Currently, we do not = cleanup the resubmit info before VM restart, so when = VM
restarts, SET_VRING_KICK will resubmit these inflight io = (If resubmit info is not
null, function set_vring_kick will = return without updating resubmit info).

It=E2=80=99= s an error, any stale inflight io should not be resubmitted after = the VM = restart.

Thanks,
Haoqian

=


 

<= br>
= --Apple-Mail=_33484BD3-1CD0-43D4-A3C9-3FE4B428C294--