From patchwork Thu Mar 24 15:09:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 108845 X-Patchwork-Delegate: ferruh.yigit@amd.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 306E1A04FF; Thu, 24 Mar 2022 16:09:55 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 232534282B; Thu, 24 Mar 2022 16:09:55 +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 EAE5B40683 for ; Thu, 24 Mar 2022 16:09:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648134593; 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; bh=e8hX/rT/Ucrg/728zWcLWGPOlN8pDlfVOd4Dt+UCk7s=; b=CAl60cgQGvSKHgh5AFvjbYkL4jn5635PafNVhsaen0BY6W4xo5aSml7FkOpgf7SwdApqni R0jnsxUt+CoXUibvwi17/6Sh0XLp3D8OSf9MGT67F7qgM37HNw7aMReA6XkdWNgsvTQoIb zvR00864kNEFJCZcM8RXNaaSOkh7K5o= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-368-tWE28L4gMTi9nG2oQR92cA-1; Thu, 24 Mar 2022 11:09:50 -0400 X-MC-Unique: tWE28L4gMTi9nG2oQR92cA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C0B1E1044560; Thu, 24 Mar 2022 15:09:49 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.195.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1FDD2024CCA; Thu, 24 Mar 2022 15:09:48 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stable@dpdk.org, Gaetan Rivet , Hyong Youb Kim , Harman Kalra Subject: [PATCH] net/failsafe: fix interrupt handle leak Date: Thu, 24 Mar 2022 16:09:41 +0100 Message-Id: <20220324150941.26157-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 A intr_handle is being allocated as a hack to get a (proxy) eventfd from the Linux interrupt implementation. But this handle is never freed. Remove this convoluted hack and create an eventfd in Linux case. Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle") Cc: stable@dpdk.org Signed-off-by: David Marchand Acked-by: Ferruh Yigit --- drivers/net/failsafe/failsafe_ops.c | 32 ++++++++++------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 55e21d635c..2c23d0e70a 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -6,6 +6,9 @@ #include #include #include +#ifdef RTE_EXEC_ENV_LINUX +#include +#endif #include #include @@ -387,28 +390,11 @@ fs_rx_queue_setup(struct rte_eth_dev *dev, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mb_pool) { - /* - * FIXME: Add a proper interface in rte_eal_interrupts for - * allocating eventfd as an interrupt vector. - * For the time being, fake as if we are using MSIX interrupts, - * this will cause rte_intr_efd_enable to allocate an eventfd for us. - */ - struct rte_intr_handle *intr_handle; struct sub_device *sdev; struct rxq *rxq; uint8_t i; int ret; - intr_handle = rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_PRIVATE); - if (intr_handle == NULL) - return -ENOMEM; - - if (rte_intr_type_set(intr_handle, RTE_INTR_HANDLE_VFIO_MSIX)) - return -rte_errno; - - if (rte_intr_efds_index_set(intr_handle, 0, -1)) - return -rte_errno; - fs_lock(dev, 0); if (rx_conf->rx_deferred_start) { FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) { @@ -442,12 +428,16 @@ fs_rx_queue_setup(struct rte_eth_dev *dev, rxq->info.nb_desc = nb_rx_desc; rxq->priv = PRIV(dev); rxq->sdev = PRIV(dev)->subs; - ret = rte_intr_efd_enable(intr_handle, 1); - if (ret < 0) { +#ifdef RTE_EXEC_ENV_LINUX + rxq->event_fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); + if (rxq->event_fd < 0) { + ERROR("Failed to create an eventfd: %s", strerror(errno)); fs_unlock(dev, 0); - return ret; + return -errno; } - rxq->event_fd = rte_intr_efds_index_get(intr_handle, 0); +#else + rxq->event_fd = -1; +#endif dev->data->rx_queues[rx_queue_id] = rxq; FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { ret = rte_eth_rx_queue_setup(PORT_ID(sdev),