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 4B6C945F2F; Tue, 24 Dec 2024 16:50:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 26B90402DF; Tue, 24 Dec 2024 16:50:16 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 02883402EE for ; Tue, 24 Dec 2024 16:50:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1735055414; 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=aeIzt/lUhQSfdqy9QH/SXVUHuO4lEXm3U31x1SHLH6U=; b=AGPRn4IKZY3k3WA4SH7dehO5YWysCcRAZbMj3hajIhAZhA4ltY8Nv8aClSTDflXHV7hJTm qUPZ+eWzjZU9F7P/PUF/B2FFTo8l57gCcqbIelPbIHWhVNgVgn5A47gKL10tMiEFHN1wNZ I/GeTqMoND67Y2yVStwfohdOv/18W6M= Received: from mx-prod-mc-03.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-339-q1h7XKZdM7avZ1Ge5MSsdg-1; Tue, 24 Dec 2024 10:50:11 -0500 X-MC-Unique: q1h7XKZdM7avZ1Ge5MSsdg-1 X-Mimecast-MFC-AGG-ID: q1h7XKZdM7avZ1Ge5MSsdg Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 53E601955E9E; Tue, 24 Dec 2024 15:50:10 +0000 (UTC) Received: from max-p1.redhat.com (unknown [10.39.208.4]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AB5971956086; Tue, 24 Dec 2024 15:50:08 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, david.marchand@redhat.com, chenbox@nvidia.com Cc: Maxime Coquelin Subject: [RFC 3/3] vhost: improve VDUSE reconnect handler cleanup Date: Tue, 24 Dec 2024 16:49:58 +0100 Message-ID: <20241224154958.146852-4-maxime.coquelin@redhat.com> In-Reply-To: <20241224154958.146852-1-maxime.coquelin@redhat.com> References: <20241224154958.146852-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: sZe7Q21SkmnTMNxosApUZGnF6myxBLQCxCaXQl3hr34_1735055410 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 makes use of the new FD entry cleanup callback to close the VDUSE reconnect eventfd after its removal from the FD set. Signed-off-by: Maxime Coquelin --- lib/vhost/vduse.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c index 9c10fbc684..a841da966c 100644 --- a/lib/vhost/vduse.c +++ b/lib/vhost/vduse.c @@ -563,16 +563,21 @@ 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 *remove) { struct virtio_net *dev = arg; vduse_device_start(dev, true); - close(fd); *remove = 1; } +static void +vduse_reconnect_handler_cleanup(int fd, void *arg __rte_unused) +{ + close(fd); +} + static int vduse_reconnect_start_device(struct virtio_net *dev) { @@ -590,7 +595,8 @@ vduse_reconnect_start_device(struct virtio_net *dev) goto out_err; } - ret = fdset_add(vduse.fdset, fd, vduse_reconnect_handler, NULL, NULL, dev); + ret = fdset_add(vduse.fdset, fd, vduse_reconnect_handler, NULL, + vduse_reconnect_handler_cleanup, dev); if (ret) { VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to add reconnect efd %d to vduse fdset", fd); -- 2.47.1