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 DB5CFA04FF; Fri, 29 Apr 2022 15:55:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C60C8415D7; Fri, 29 Apr 2022 15:55:58 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2044.outbound.protection.outlook.com [40.107.94.44]) by mails.dpdk.org (Postfix) with ESMTP id 27D91410E3; Fri, 29 Apr 2022 15:55:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A1u3BQOXiwn1xcYfY/sfTIVw9VJ0GGqCd1XhIN4RT1dnE6I0Au91fUtL75NQ92h7uHkj2f6OARqj4wA8Luze7xxIO9b3fET1LwipfQn56Ol46+lH+zSVd4czY8iyOb2FM9Ns7GN8BeiVvifnKRqtkJIgpHAsHeC1eF/7pS7MW/aCOMPVUoi3aL4+zOKlm01FPjSZTiNarV+lLe6olGkw9ASkezHpaEgKz2iW7B6Nezjvufmx2B8V4Jl6yFtsN/mzZbVe7/qdx5bt+tvbVmK6KYqaeNWOrIUOynH00IAeLTyOSLbfci9AUPZ5GP0E6DEVIckuYUvSoYH0ybgFWL4heg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yUyBq/FO/VeAbR/ZA/+3yM8ppfcFD5QfyNOnnPsavRQ=; b=mINSmTjiIUAvz5o+fggpUXhRzOtx+DkCqpuXIo9hHKyDoTncO9O04OJr3hOCb0n5cZqu7WdfLGun8tZykNpuGO8b5fI/1/OPa8tpumYmkQrucLp5NSASvYc+Kk3z8WTB5j5WNlffHDP9TRyIs7srcaXxpLBLg6W7Llzsz28iSxiK6FEajBqYHzIkOW4m4OYE0hf5g4S/cLF7Gv0T24OmIy9FF9ypu8PquHJzLTwSLqjfRKxCbQJL6+VXHg8QBwuMK7ffNdbw1ykiol7KCK4+mPvNlzfkBCDfk0VfSFaNLi/NpA6QOHd5Iq562mCo5X6AtD8hde03wE+KTQEJqMES5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.80.198) smtp.rcpttodomain=redhat.com smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yUyBq/FO/VeAbR/ZA/+3yM8ppfcFD5QfyNOnnPsavRQ=; b=mW8gC2O8gG6cjoBf8uVKWUq7+jQWyDJ0W4spDlhbn3WJbaRWmML5vp4ksgo+sC2MoGl+pY00S/S52vhIiVD3RS6eL1nKb9ounkegrCtl6ewAn2uEeg7bripRHsfpcuM5P6gBpEVf5e7vzsq/LYg9SG8R0jYupuaZEUJWYaJQ86E= Received: from SA0PR12CA0018.namprd12.prod.outlook.com (2603:10b6:806:6f::23) by CH2PR02MB6165.namprd02.prod.outlook.com (2603:10b6:610:7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.13; Fri, 29 Apr 2022 13:55:55 +0000 Received: from SN1NAM02FT0008.eop-nam02.prod.protection.outlook.com (2603:10b6:806:6f:cafe::c3) by SA0PR12CA0018.outlook.office365.com (2603:10b6:806:6f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5206.14 via Frontend Transport; Fri, 29 Apr 2022 13:55:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.80.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.80.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.80.198; helo=xir-pvapexch02.xlnx.xilinx.com; Received: from xir-pvapexch02.xlnx.xilinx.com (149.199.80.198) by SN1NAM02FT0008.mail.protection.outlook.com (10.97.5.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5206.12 via Frontend Transport; Fri, 29 Apr 2022 13:55:54 +0000 Received: from xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) by xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Fri, 29 Apr 2022 14:55:53 +0100 Received: from smtp.xilinx.com (172.21.105.197) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Fri, 29 Apr 2022 14:55:53 +0100 Envelope-to: david.marchand@redhat.com, grive@u256.net, stable@dpdk.org, hyonkim@cisco.com, hkalra@marvell.com, dev@dpdk.org Received: from [172.21.34.28] (port=43414) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nkR69-0003mJ-5D; Fri, 29 Apr 2022 14:55:53 +0100 Message-ID: Date: Fri, 29 Apr 2022 14:55:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH] net/failsafe: fix interrupt handle leak Content-Language: en-US To: David Marchand , Gaetan Rivet CC: , Hyong Youb Kim , Harman Kalra , References: <20220324150941.26157-1-david.marchand@redhat.com> From: Ferruh Yigit In-Reply-To: <20220324150941.26157-1-david.marchand@redhat.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c1338b26-8ed8-48a4-b1d8-08da29e7fb09 X-MS-TrafficTypeDiagnostic: CH2PR02MB6165:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JpKGXK2OvXh+94Ok0/VNCywAmQZxQlbmO2AgyJPz4Xw8n2NifFZq2jaUkIUUhi4+RRUAAykKlr0mb8aeUIK8cZLgkKrBjAjM2C71/txAbU4oHJMEwUH7p9fJtaw0i71sd4aBgvcyzcWg2t2izIMjwnVtB4LuP/FIxcmyAZhHoOdU6aaeDusL/Owse61oqlO1mBTPuigw1hqS3msOLyG+97vjkWgdxso85JQ8JaQaZ42SYd8Hjt+WXORIy8qzDZxfA/6rR1S1Lv31vqbVoQOeQHU35VnUHGqvSKWZpMx55/AehTW7HV8zqdhhI0aUm9yodnqsMXHUJSemaL/HNd+ZEGld1h8+5G0o/eN7tGX/ON1CMIcwhSnsDS83YooVd2Ds/zSe3vEjtZKOk9Xdaq/4+CjRvUQhT2F6CJtdqlvOeoRhE3pTEVfbMB9ogaatWtZyZoVI0w0er72QfXwBAbQ1xk9fKuk0e5OCSQ/ZYU5FPkd5nhvps2du3iSGTDsZSk/g8YQC5JiL4zUPnImye1u0SeRS0I58HuZxWh1ZXx5rofSMHvSbg7st7eiHWeSc/1lQnZVakYRXLT7g+1KFUgVqLSKWPEQ3zVLJG5IQGhmYvlxNuQZscAJ0ZiO2MinmDBDEE0JLrfcYhJZsFziE8WZqVZwdWblSyJXw1ussqWmfRxJBjh0oWKacmTJx6K1YHPRvCa8u6npHh9SiAwrowhlIeamdEOc2KlOF1HOomPfRBHo= X-Forefront-Antispam-Report: CIP:149.199.80.198; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:xir-pvapexch02.xlnx.xilinx.com; PTR:unknown-80-198.xilinx.com; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(508600001)(36860700001)(356005)(110136005)(31696002)(8676002)(4326008)(54906003)(40460700003)(70206006)(7636003)(70586007)(316002)(31686004)(26005)(53546011)(2906002)(5660300002)(47076005)(426003)(336012)(2616005)(44832011)(186003)(82310400005)(83380400001)(8936002)(36756003)(9786002)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2022 13:55:54.9434 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c1338b26-8ed8-48a4-b1d8-08da29e7fb09 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.80.198]; Helo=[xir-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0008.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR02MB6165 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 On 3/24/2022 3:09 PM, David Marchand wrote: > 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 > --- > 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 How this impacts the BSD? I don't know if driver used on BSD but technically it looks supported. @Gaetan, any objection to the change?