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 A6166A0C41; Tue, 19 Oct 2021 15:35:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 91655411AA; Tue, 19 Oct 2021 15:35:36 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id D61C44119C for ; Tue, 19 Oct 2021 15:35:34 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10141"; a="228459101" X-IronPort-AV: E=Sophos;i="5.87,163,1631602800"; d="scan'208";a="228459101" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2021 06:09:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,163,1631602800"; d="scan'208";a="444484135" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga003.jf.intel.com with ESMTP; 19 Oct 2021 06:09:21 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 19 Oct 2021 06:09:21 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Tue, 19 Oct 2021 06:09:21 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.44) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Tue, 19 Oct 2021 06:09:21 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nwVEPs1/aGrypilrRiOddc3KbrE0WmkAeKlKd6jeVx+P7w4LcdtCaLUUMHeRBVVaovrsEp7GJJ+tCRxvcwzDUdutH6K200VZTUIztYWspBS+T08FKqZf7gb/mahE3zzyG4hfUPXzThSuRic8WpIhZHOWGIyX+4ZKSPFrp1nZB5R/QflPuaWxEmyU6SxG5kCgrS5zvreYENSD78/r+IS3IhV2YX2zvz9ga43R8h58P3Y+7FQ9DkYoUNrd/a9o3rb9b9YT2ef0m9so32RBVK/ZEB2tFgX1hCWiCpSJ2pFIoVQX3GfaecOSk/J3rd8GOeJHONupu7jcW0qr2qvl3pmAfQ== 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=Mgd3apSF7HPYaO1qcDh6pIBevnNhWeipu/Q6cRSk8Ks=; b=Z2smkwXMC9fUDgR2TSMNwFclTKaZ9cNGZqH3lTjD5svWcIxGVMieoRbM3oAxz+Rv7q0iRvwuOYTlmrmfGHo81Qi0RItSoU6nobBfvnf4rokwKgOAMe4dvz8ZtQZQ/kYJ96ExWFFOzRNrkJD12O+3JRug1CxItXd6XfnlTNkQNVRQ3+4tNSa6kO90z0iLnVAtMewvAOxkKI4GlUIW8PXftmuJH9anro6hN916zcEUKGISRVMliqPvGC54y2o5cFlIni857uT2SbKmUvnixag7pIa53ZgVwVhjNz9HnBv+iVrDpkoNSDT7O+9mjF/2hac6PgLbdH4S4PsQFuJB2YMyiw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Mgd3apSF7HPYaO1qcDh6pIBevnNhWeipu/Q6cRSk8Ks=; b=XJWgGiebPsOCCFa6HWcynj6jC3XMBgyUi+nKJdXhHP2jqU+PyfMHYJobbPMcQ3MIQbT2VotMZKc4zpHDnGr+umZC7+ntFnc9P9AaQhJxrVthGOSMK36uMDfYCRgnsW4VVBmX4ZyrEjgNthq/6p3HKPFbSujKWA7QAluY0FsvfI0= Authentication-Results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by PH0PR11MB5110.namprd11.prod.outlook.com (2603:10b6:510:3f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15; Tue, 19 Oct 2021 13:09:20 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bd7d:29be:3342:632c]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bd7d:29be:3342:632c%5]) with mapi id 15.20.4608.018; Tue, 19 Oct 2021 13:09:20 +0000 Message-ID: <50757f4f-2d73-9552-79ce-470cfb7da322@intel.com> Date: Tue, 19 Oct 2021 14:09:14 +0100 Content-Language: en-US To: Huisong Li , CC: , , , References: <1627908397-51565-1-git-send-email-lihuisong@huawei.com> <20211015034447.26368-1-lihuisong@huawei.com> From: Ferruh Yigit X-User: ferruhy In-Reply-To: <20211015034447.26368-1-lihuisong@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0391.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::19) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 Received: from [192.168.0.206] (37.228.236.146) by LO2P265CA0391.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 13:09:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b1be5729-95fb-447d-c272-08d99301a9a9 X-MS-TrafficTypeDiagnostic: PH0PR11MB5110: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VBi+7zdMvzwQcnSaDDipuRyW5GYEaqw9N5TxP3qHoAOQoUIZMm/cGwuV3JYPoQfgT9rOR0jkyvn7F5rufw/VTlUkSmlGkaZEJU0A7glLPu2ZphB5BoL1CFsSg02PKzLI2R3R4oqhus+lXPFkQNdNU8++pqf+aoz3eifEIx8T2slMUvEesbcsjUSbp0urq0kLZtf2p0RQqiKhiGWOOeQPP3AofkAiqKDdkOgFcyocQrujwNAitN8fry1Z2uwAr6pZWk7j1dLwc1EvjyKEsMWeObLLflSW0/G8vl290lQNObhAXKMU6/BA/YpvtY2/EVHpreuyRjdVLtWTpDt5i3aGGP7g+IuDzZD58Ag+OXoyYyZxS/+xXV7MvHjZXwW26zUgiW2Q+EO9jJje3Tu5WFtMQb8A1NGGwc7vJHTU8S6HEWy5Dn/Ri/RIdWSCDhEmVTrHS3ajP9BD/JJgwnjFNi78iJSmEp0xqe+Fqh8fy6GsAOk+AtoI5jnmBpcTCLKfZVyxdVLYQge0+D5yZx+rBl8ua5gAKwwgTTTdhH17jQfimqkswHyWkkXqPAHs3vr8BXGlG9wfVl/G3sMhcsit5Dc0zQkZVrKq70N4nUhZ/loRekQLYRL/0wheXUePSk5ctognZ0tGMjRqrhrxojrJhJSlmczKs8AjFWW1quiBUIp66WOl/ZHDHLXqLM7ZmOq24D5WHt/I2dsOA009QigE4L8wyg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5000.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(8676002)(186003)(8936002)(53546011)(26005)(4326008)(66946007)(956004)(44832011)(5660300002)(66476007)(2616005)(66556008)(2906002)(508600001)(6486002)(16576012)(316002)(31696002)(38100700002)(31686004)(36756003)(83380400001)(86362001)(6666004)(82960400001)(107886003)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TzZnanc5cTI0aWtEdzFQVndCTlRCYmV1T0l4azFJaUxrVkdETVE0U0o2Y2tR?= =?utf-8?B?QktGRHM0bmI0Y2hpcVNQSmpwSGo4MGtsYVV5cTJGOHBrVzZ6dEJNRkthZGJ5?= =?utf-8?B?ek9OaVV2NzM1UkR6Q29GZllTWUdpQi85SllVOWFQRlRSYUNtOWNzdit5V0xE?= =?utf-8?B?SVZnMiszUjlFMXVxUGl1cEZYek9OVTJmb213M1pIb0ZBdUw4bHBRTHA0Tko4?= =?utf-8?B?cDhiOTZuUGpHangwdldXZnVqeENYTW8wOXRNOGZFeVJyUG9VYzA1ZXh4aWVC?= =?utf-8?B?Nkd4Yk5HeFg3MEhmKzU2YnRFUGJ1RStUVG9ZakhlTnhxZ2VkaFI0Ti9lZ3Za?= =?utf-8?B?eThFMlE4ZVhlcFNUcTROZTNqMHp4RU9PQ0cwNWZwZ3VkajRoblF4cEVrUXF0?= =?utf-8?B?eFkrRDFGVzMrYjIrNi81eTBDMk80ZzdPUENWMGp1NmhiWjVwMWhaVldjN0Zo?= =?utf-8?B?Vm5lTHpNYWwwbGNjR0hiM2w5TUkza0ZsUzdT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M0UxTUlxOHN4YkUzUENCVkdOYkltc1d4UzlPRkxPOWcw?= =?utf-8?B?KzIvK3ErR3JJRHFhcDFub0k3SitLRG03WHNPWlNyQVZIUXRLS01qWVpycXlN?= =?utf-8?B?NENoU2ppUWE1TTRmMnd2TGJGeW9EQ25kVUw2ZlJOWkJMbDlaSVhEYWNaV0JD?= =?utf-8?B?OFBTNitzcnhzTTJkVC9NTGpZZmkwMnJaVHE0ZEp1WUtGd1kvYXgxYm9uK1dE?= =?utf-8?B?amhOeU03RVJ1Zm9BeGV4NDVyYTBLOUJQR0w1bmRoYk1mY1JIL0NXNUZwclBl?= =?utf-8?B?QU5mWXR0UmhONUNEZWJBS29PeEg5WnFrSWVBamFFYy81eUR3WkVPcUE1blFo?= =?utf-8?B?MUxDaHUxU1lnam1KbnZOR3B4U290WGZIZ0V1dXVneHg5Y1g1QzRlWnBGczhN?= =?utf-8?B?SElvblQ2dG5QL01GU1QyU1UwTHV1MHQ1blVqdnNmYnFxbHpOY1k3Q2pYYnRK?= =?utf-8?B?TThpYkNXYWZUOWcySnZzSkt5NHpjcGRZb3FpaDFoNjNNNVVQaTZ4MmlaT3Ro?= =?utf-8?B?OTd2OWM3MWVQUUlVVFFnOHE1ZHE5SEkremVKUUx1OFEwSm05cVFqQU1hM2g1?= =?utf-8?B?Qzl2aFZ6TGFDZUpjQ1hIRCtwT3liWDdqT1dkSlMzemVCYkFabThsL2R3RHFX?= =?utf-8?B?VUV6S0J0cGxiRVBUMWxwK0JmOXpZV2VGS1FCeEd2RFowTytpNXkwbm00QWh6?= =?utf-8?B?akczZTQ5N3hzVWdvc3RYQlc1ZzEwem5DNTFjRGJrWDFkK3dhZTdETlJiejEr?= =?utf-8?Q?QdHaC8clpU5NsU2xW6yEi9o=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: b1be5729-95fb-447d-c272-08d99301a9a9 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 13:09:20.3467 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BmPiison4PS9BOQI/kZvmCT3+Sqe7x8mllB8YPz3BpmoiuQsXTV+Edd8HSAb/Qm7ILP7HXXq9lYHlKaQP/l2XA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5110 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH V3] ethdev: fix eth device released repeatedly 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 10/15/2021 4:44 AM, Huisong Li wrote: > In secondary process, rte_eth_dev_close() doesn't clear eth_dev->data. > If calling rte_dev_remove() after rte_eth_dev_close(), > in rte_eth_dev_pci_generic_remove() function, the released eth device still > can be found by its name in shared memory. As a result, the eth device will > be released repeatedly. The state of the eth device is modified to > RTE_ETH_DEV_UNUSED after rte_eth_dev_close(). So this state can be used to > avoid this problem. > Hi Huisong, Can you please add Fixes line, and stable tag if the change is requested for backport? > Signed-off-by: Huisong Li > --- > v2 -> v3: > * fix the commit log description and the comment inside the code. > v1 -> v2: > * fix the commit log description. > RFC -> v1: > * fix commit log and add a judgment for secondary process. > --- > lib/ethdev/ethdev_pci.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h > index 8edca82ce8..fcabae02fa 100644 > --- a/lib/ethdev/ethdev_pci.h > +++ b/lib/ethdev/ethdev_pci.h > @@ -151,6 +151,16 @@ rte_eth_dev_pci_generic_remove(struct rte_pci_device *pci_dev, > if (!eth_dev) > return 0; > > + /* > + * In secondary process, a released eth device can be found by its name > + * in shared memory. > + * If the state of the eth device is RTE_ETH_DEV_UNUSED, it means the > + * eth device has been released. > + */ > + if (rte_eal_process_type() == RTE_PROC_SECONDARY && > + eth_dev->state == RTE_ETH_DEV_UNUSED) > + return 0; > + > if (dev_uninit) { > ret = dev_uninit(eth_dev); > if (ret) >