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 9D2EDA054F; Mon, 1 Mar 2021 16:20:59 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1FEEF22A2A4; Mon, 1 Mar 2021 16:20:59 +0100 (CET) Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-oln040092253102.outbound.protection.outlook.com [40.92.253.102]) by mails.dpdk.org (Postfix) with ESMTP id 8F25240041 for ; Mon, 1 Mar 2021 16:20:57 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ngUhERylUEqawxLV9cS9Lehf1uoEZQ48zpkTM4hFvLqp2NWjAKO1d2gGjMLrIpxckFwPBGTxGi5dtOSThYLJKVkr6uu3zzq3IuxpJRr4W3Vr9Mdv3sUCRaEHGRVXhJ31ysVEKv1xMQ3mIdebpzfohR5SIsZf2zLblHWL9Wvb3ai31fNsujG72Ron67AWSDADLIvETqCNnXshlk2il5di2owaKOBVOS4K+mq5uDLcFnvrBYLIGCE0wU1ITc0mB85Ki9uy4YUJfbKSScH/Er06G+fiJF+dQitzXGDPQaLeXs605ScPfSi9ULyrh7GBvXoEavMYiiVupeUeLmeeo8Svqw== 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-SenderADCheck; bh=K38S8CA/NEvVr2XYPXMgx07UObC0VI4SNkSdlJtAKBw=; b=UYH/vTD/wxH03ulDigc8Zr+/Il/ESayp4ajX+zJDOmKZYrYl6o+VwiDaEyxcq0d+vkmIasU2tToKhHg5jW5dqKRmEqoBNcuVGrCZOlncwORpHySXh2PO7cz1xI7Fm8buDKc2wP0uvGeEaUOUrTWTsOKQHDQuosJ4l7tJ6wbp4BJM0hk/Fnc/obaWtugHlFwuGEEkZyFEfi0tozvgyzSuh0fJsTbCccXei2Zmzg8BRuYZ37cdBLNZRUtOtfC+NcmgfI77ylM+5gpdmlEmibrwjZnyK7SVN0mDUYmlLSGhiZQ5nZQlYql/aZDn348psT9YB45nbHqB0LZupD6H4wnShg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K38S8CA/NEvVr2XYPXMgx07UObC0VI4SNkSdlJtAKBw=; b=BFwpqww4UawCHUSi94j8F1joywZPxfgsqUeKD+4/8mUD5aO3vi1WenDuGoMadDwWFYdKziLyjqCEDMs8+kwTykHtsEXvklFJQ+HrqXg2AOXC25zBvu5C5Co5GTHjjGzZL+GaDKn7UMd8eq5BYQHPqaJzMJg2oXWSyCdRM4BYiKSekUWpUJFwONQJmPmNXLHvqdc7TrHnUGd80MrBl0CEg5r2SwDMDFgDWUwp0iZWpoj/rspLzht3b/VRce+HxFtUpi5yWCR0gKnWW3r+PNgrhDaElDvMrSH8W6qDPnp1amaf6y+CIzJ++1SHtI66o09FkwLKuK+p47mBNv46BHk7LQ== Received: from HK2APC01FT003.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebc::43) by HK2APC01HT182.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebc::489) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19; Mon, 1 Mar 2021 15:20:53 +0000 Received: from ME3P282MB1668.AUSP282.PROD.OUTLOOK.COM (2a01:111:e400:7ebc::51) by HK2APC01FT003.mail.protection.outlook.com (2a01:111:e400:7ebc::173) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Mon, 1 Mar 2021 15:20:53 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:526FC6770C3741382599B477BF5825AA7CE01EEA6263DAE0CC05182061CAFEDE; UpperCasedChecksum:1F380BD4495E937ED5B00CBF34B73DB90A865EF1F4BC67D3D628F24649020BC4; SizeAsReceived:8884; Count:48 Received: from ME3P282MB1668.AUSP282.PROD.OUTLOOK.COM ([fe80::cde5:5660:e27b:a333]) by ME3P282MB1668.AUSP282.PROD.OUTLOOK.COM ([fe80::cde5:5660:e27b:a333%8]) with mapi id 15.20.3890.028; Mon, 1 Mar 2021 15:20:53 +0000 From: Tengfei Zhang To: Ferruh Yigit Cc: "dev@dpdk.org" References: Message-ID: Date: Mon, 1 Mar 2021 23:18:32 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TMN: [mUyJOftP+S+7Pxup7vqKeLA+N1VR5hX1] X-ClientProxiedBy: HKAPR04CA0015.apcprd04.prod.outlook.com (2603:1096:203:d0::25) To ME3P282MB1668.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:a5::11) X-Microsoft-Original-Message-ID: <0f4532fe-f405-b2ce-c7a8-d0601cdf8c2d@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.0.0.8] (222.95.177.75) by HKAPR04CA0015.apcprd04.prod.outlook.com (2603:1096:203:d0::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.20 via Frontend Transport; Mon, 1 Mar 2021 15:20:50 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 0a924350-b9cd-40d3-6cb8-08d8dcc59989 X-MS-TrafficTypeDiagnostic: HK2APC01HT182: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7t1q0KL5LYjqCO5SRPGSpvrnWg5excNnZSD8mjcwVXwAoLmleV4VCy/gshPjIK9F11cPdbqbfmr/sjBPFq2xdzQol0zXWG1Nc0LPLv78ohD7bKYaLkbq+A43Md7jfgTMB/p5neDNuwkh7fEqSdHnCMPWM8v76A2lpNw8siMx1VoA0OlF79rwiYDH02MRvvDOysdWri8iRW9QfrCj8q8AzYSPx7YSPhLtYgsfy68I+dOMdj+04sEVXaSMZ2umCA0ZqtVp1olE9Os3lQWS/pQQDxmWbg2+Qrmt+gnWawPjVnxj6Y5WtavNZqpxoCgWOdwxJ13ZEAxXS8bTZNi+vaO8/t4yVstUbFPUUFqV4lkTHPIu6LG+Yro+d3Kjil5n1vuKsP7QPYqPUZYMSobSaR2OyoGpd/mxUbsUMYWVIFQ28PzKdgU30ZAy3JG8GKug5DDp X-MS-Exchange-AntiSpam-MessageData: qnjDtqN6iQYUVlY/Xw5UXKy1JGjVtHP6fV8sy6sr6xb+nbpbAO1Tvmezwza5Ckn9Sj2rIa2T98lcb2kegBux2M4+aB+3emWl5MTklOiOhZzv6K2QarW61K913i2+5nrGIrxA8WWO+eUUuaLPe2B5yg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a924350-b9cd-40d3-6cb8-08d8dcc59989 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2021 15:20:53.4171 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HK2APC01FT003.eop-APC01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2APC01HT182 Subject: Re: [dpdk-dev] =?utf-8?b?5Zue5aSNOiBbUEFUQ0hdIGRyaXZlci9uZXQvcGNh?= =?utf-8?q?p_fix=3A_pcap_fd_leak?= 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 Sender: "dev" On 2021/3/1 下午7:40, Ferruh Yigit wrote: > Please do not top post, message moved down. > > On 2/26/2021 5:47 PM, 张 杨 wrote: >>> I think your idea is fine >>> >>> What do you think just record file path in "pmd_pcap_probe()", >>> >>> Perform an open operation only in "eth_dev_start()"? >>> >>> When the secondary process add pcap vdev, >>> >>> it send the request to primary process, >>> >>> the primary process probe pcap vdev too , >>> >>> Both the two process open the same file (in function >>> "pmd_pcap_probe()") >>> >>> It's not necessary >>> >>> I prefer "ZhangTengfei " sign (this one) >>> >>> 发送自Windows 10 版邮件 >>> 应用 >>> >>> *发件人: *Ferruh Yigit >>> *发送时间: *2021年2月27日0:46 >>> *收件人: *ZhangTengfei >>> *抄送: *dev@dpdk.org >>> *主题: *Re: [PATCH] driver/net/pcap fix: pcap fd leak >>> >>> On 2/26/2021 4:20 PM, ZhangTengfei wrote: >>>> pcap fd was opend when vdev probed, >>>> but not closed when vdev removed. >>>> This bug appears in dpdk-pdump >>>> >>>> Signed-off-by: ZhangTengfei >>>> --- >>>>   drivers/net/pcap/rte_eth_pcap.c | 1 + >>>>   1 file changed, 1 insertion(+) >>>> >>>> diff --git a/drivers/net/pcap/rte_eth_pcap.c >>>> b/drivers/net/pcap/rte_eth_pcap.c >>>> index 90f5d75ea..fb01ea924 100644 >>>> --- a/drivers/net/pcap/rte_eth_pcap.c >>>> +++ b/drivers/net/pcap/rte_eth_pcap.c >>>> @@ -1597,6 +1597,7 @@ pmd_pcap_remove(struct rte_vdev_device *dev) >>>>        if (eth_dev == NULL) >>>>                return 0; /* port already released */ >>>>   +     eth_dev_stop(eth_dev); >>>>        eth_dev_close(eth_dev); >>>>        rte_eth_dev_release_port(eth_dev); >>>> >>> >>> Thanks for the fix, >>> the cleanup seems missing in 'eth_dev_close()' too, what do you >>> think moving >>> 'eth_dev_stop(eth_dev);' inside the 'eth_dev_close()'? >>> So both 'close' and 'remove' will be covered. >>> >>> >>> Btw, you have same patch with both "ZhangTengfei >>> " sign >>> and "ZhangTengfei " sign (this one), can you >>> please >>> clarify which one do you prefer? >>> > > > > I think your idea is fine > > > > What do you think just record file path in "pmd_pcap_probe()", > > Perform an open operation only in "eth_dev_start()"? > > > > When the secondary process add pcap vdev, > > it send the request to primary process, > > the primary process probe pcap vdev too ,> > > Both the two process open the same file (in function > "pmd_pcap_probe()") > > It's not necessary > > > > Opening pcap helps us fail early in probe() if something is wrong, > otherwise the driver probed and the problem detected in the start() > when it is too late. > start() also opens pcap if it is not already opened. > > In your usecase, if the pcap added by the secondary with the intention > to use only by the secondary, yes primary process also opens the pcap > unnecessarily, but that shouldn't be really a concern, this is one > time cost in probe(). > > > I prefer "ZhangTengfei " sign (this one) > > OK, also can you please use "Name Surname " format, > to be consistent, I guess for you it means as following: > Tengfei Zhang Rarely submit code to the open source community. Thank you for your advice. I quite agree with your  view "fail early". I will update the patch