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 6DD4D46211 for ; Thu, 13 Feb 2025 11:02:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 66AB242EE9; Thu, 13 Feb 2025 11:02:05 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 4E76342EE7 for ; Thu, 13 Feb 2025 11:02:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1739440922; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JpM0T3w8Ejbo4SpQBgusIyhkybsf8wtGs7THekLZy9U=; b=Nwhbco/oxxnlxJbpXJqwD1tGa888AgQm7k+j+/iAvTGtYVi3I2CKEojwOCBfZTREgtgLgf qw800Qvc83PRUu9KxBMBJcx9yCy6Yt46nkVkBf6QOXcq/G45z1DBhoDfv1BZC/CGe7rVRX xyk44byEACv65fCrZ0FCH2TvwtBFntE= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-224-5YZsF0TIN4C-y_E3CwDmVw-1; Thu, 13 Feb 2025 05:01:59 -0500 X-MC-Unique: 5YZsF0TIN4C-y_E3CwDmVw-1 X-Mimecast-MFC-AGG-ID: 5YZsF0TIN4C-y_E3CwDmVw_1739440918 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A9A8B19039C6; Thu, 13 Feb 2025 10:01:58 +0000 (UTC) Received: from rh.Home (unknown [10.45.224.21]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A56531800365; Thu, 13 Feb 2025 10:01:56 +0000 (UTC) From: Kevin Traynor To: Maxime Coquelin Cc: David Marchand , Chenbo Xia , dpdk stable Subject: patch 'vhost: fix FD entries cleanup' has been queued to stable release 24.11.2 Date: Thu, 13 Feb 2025 09:58:26 +0000 Message-ID: <20250213095933.362078-59-ktraynor@redhat.com> In-Reply-To: <20250213095933.362078-1-ktraynor@redhat.com> References: <20250213095933.362078-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: l-votN3DxDRZ9l-Y9_uxjSb2nQjmx7OZsT3hd4urA-Q_1739440918 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 24.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/17/25. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/17320be508658dba6e61ab78b3154c85749464fe Thanks. Kevin --- >From 17320be508658dba6e61ab78b3154c85749464fe Mon Sep 17 00:00:00 2001 From: Maxime Coquelin Date: Thu, 6 Feb 2025 09:41:54 +0100 Subject: [PATCH] vhost: fix FD entries cleanup [ upstream commit 50966930caf2d1a82655f2c3415c093421d70072 ] With the recent rework of the FD manager to use epoll, an error message is emitted with Vhost-user at FD entry removal: ERR|VHOST_FDMAN: could not remove 102 fd from 101 epfd: No such file or directory It occurs because the read callback closes the file descriptor before it is removed from the FD set. This patch defers the close() after the FD entry is removed from the set. Fixes: 0e38b42bf61c ("vhost: manage FD with epoll") Signed-off-by: David Marchand Signed-off-by: Maxime Coquelin Reviewed-by: Chenbo Xia --- lib/vhost/fd_man.c | 12 +++++++----- lib/vhost/fd_man.h | 2 +- lib/vhost/socket.c | 11 +++++------ lib/vhost/vduse.c | 9 ++++----- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c index 9bc7e50b93..f9147edee7 100644 --- a/lib/vhost/fd_man.c +++ b/lib/vhost/fd_man.c @@ -334,5 +334,5 @@ fdset_event_dispatch(void *arg) void *dat; int fd, numfds; - int remove1, remove2; + int close1, close2; struct fdset *pfdset = arg; @@ -358,5 +358,5 @@ fdset_event_dispatch(void *arg) } - remove1 = remove2 = 0; + close1 = close2 = 0; rcb = pfdentry->rcb; @@ -368,7 +368,7 @@ fdset_event_dispatch(void *arg) if (rcb && events[i].events & (EPOLLIN | EPOLLERR | EPOLLHUP)) - rcb(fd, dat, &remove1); + rcb(fd, dat, &close1); if (wcb && events[i].events & (EPOLLOUT | EPOLLERR | EPOLLHUP)) - wcb(fd, dat, &remove2); + wcb(fd, dat, &close2); pfdentry->busy = 0; /* @@ -382,6 +382,8 @@ fdset_event_dispatch(void *arg) * fdset_del_locked(). */ - if (remove1 || remove2) + if (close1 || close2) { fdset_del(pfdset, fd); + close(fd); + } } diff --git a/lib/vhost/fd_man.h b/lib/vhost/fd_man.h index 6398343a6a..eadcc6fb42 100644 --- a/lib/vhost/fd_man.h +++ b/lib/vhost/fd_man.h @@ -13,5 +13,5 @@ struct fdset; #define MAX_FDS 1024 -typedef void (*fd_cb)(int fd, void *dat, int *remove); +typedef void (*fd_cb)(int fd, void *dat, int *close); struct fdset *fdset_init(const char *name); diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c index 05a7e5902f..799c6b0590 100644 --- a/lib/vhost/socket.c +++ b/lib/vhost/socket.c @@ -85,6 +85,6 @@ struct vhost_user { #define MAX_VIRTIO_BACKLOG 128 -static void vhost_user_server_new_connection(int fd, void *data, int *remove); -static void vhost_user_read_cb(int fd, void *dat, int *remove); +static void vhost_user_server_new_connection(int fd, void *data, int *close); +static void vhost_user_read_cb(int fd, void *dat, int *close); static int create_unix_socket(struct vhost_user_socket *vsocket); static int vhost_user_start_client(struct vhost_user_socket *vsocket); @@ -291,5 +291,5 @@ err: /* call back when there is new vhost-user connection from client */ static void -vhost_user_server_new_connection(int fd, void *dat, int *remove __rte_unused) +vhost_user_server_new_connection(int fd, void *dat, int *close __rte_unused) { struct vhost_user_socket *vsocket = dat; @@ -304,5 +304,5 @@ vhost_user_server_new_connection(int fd, void *dat, int *remove __rte_unused) static void -vhost_user_read_cb(int connfd, void *dat, int *remove) +vhost_user_read_cb(int connfd, void *dat, int *close) { struct vhost_user_connection *conn = dat; @@ -314,6 +314,5 @@ vhost_user_read_cb(int connfd, void *dat, int *remove) struct virtio_net *dev = get_device(conn->vid); - close(connfd); - *remove = 1; + *close = 1; if (dev) diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c index be548f051e..801674be42 100644 --- a/lib/vhost/vduse.c +++ b/lib/vhost/vduse.c @@ -118,5 +118,5 @@ static struct vhost_backend_ops vduse_backend_ops = { static void -vduse_control_queue_event(int fd, void *arg, int *remove __rte_unused) +vduse_control_queue_event(int fd, void *arg, int *close __rte_unused) { struct virtio_net *dev = arg; @@ -352,5 +352,5 @@ vduse_device_stop(struct virtio_net *dev) static void -vduse_events_handler(int fd, void *arg, int *remove __rte_unused) +vduse_events_handler(int fd, void *arg, int *close __rte_unused) { struct virtio_net *dev = arg; @@ -565,5 +565,5 @@ vduse_reconnect_log_check(struct virtio_net *dev, uint64_t features, uint32_t to static void -vduse_reconnect_handler(int fd, void *arg, int *remove) +vduse_reconnect_handler(int fd __rte_unused, void *arg, int *close) { struct virtio_net *dev = arg; @@ -571,6 +571,5 @@ vduse_reconnect_handler(int fd, void *arg, int *remove) vduse_device_start(dev, true); - close(fd); - *remove = 1; + *close = 1; } -- 2.48.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-02-12 17:29:40.812387807 +0000 +++ 0059-vhost-fix-FD-entries-cleanup.patch 2025-02-12 17:29:34.382946121 +0000 @@ -1 +1 @@ -From 50966930caf2d1a82655f2c3415c093421d70072 Mon Sep 17 00:00:00 2001 +From 17320be508658dba6e61ab78b3154c85749464fe Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 50966930caf2d1a82655f2c3415c093421d70072 ] + @@ -18 +19,0 @@ -Cc: stable@dpdk.org @@ -80 +81 @@ -index 894a0f0dcb..4c6c551c3d 100644 +index 05a7e5902f..799c6b0590 100644