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 B82AAA0C47; Wed, 18 Aug 2021 11:47:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 47C5A4069E; Wed, 18 Aug 2021 11:47:48 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id F328C4014E for ; Wed, 18 Aug 2021 11:47:46 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10079"; a="216019082" X-IronPort-AV: E=Sophos;i="5.84,330,1620716400"; d="scan'208,217";a="216019082" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2021 02:47:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,330,1620716400"; d="scan'208,217";a="531488033" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by fmsmga002.fm.intel.com with ESMTP; 18 Aug 2021 02:47:45 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Wed, 18 Aug 2021 02:47:45 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Wed, 18 Aug 2021 02:47:45 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.104) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Wed, 18 Aug 2021 02:47:45 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F2Ygsco+D2F5fsUbpr57mjPMVW62W1moPh4ndv5Qd8nyBaTLbG9UilIDgsv7xP9XEoMivIeWKvNAIzPB8cdfcrg6TSdvQgordUtmWsqzS1MWJfQrGaDqE3BsHbJJ2R9V6Nd8EpTmSnp1F32OoaI0zWwfy0a5IAfFiFPRXpTIL3UMyw3bGJwagDt4YAd0HNPXFUudn1Wxh4QeX8IVVyVpxO+YGAv9AFptCy003PK93aNJfR5Rw+0YfAmK1qBhbv8w+QefYEagzPGERruDzfoB/Mu8tYwZm5LNkQiyFYMob/2DhOOiXXuVjawNDTAp9m14DCdJth+tjUBZfq+9wmUVMQ== 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=3XlJjCR7ke1C4RWtNOrbGGtaFYikb6ZWxEctir3PIuQ=; b=mqM1rVAJgf/S3BtGtEIcs68yL1S1g7fgT7ZPS4MV+vJZVWG448UoZJ/nJ384gwyJkGtrvnYqN3WJXz6aXSyYku9J1xkaUKbRJb0Z24oc1vpXtOQ0xDvxWCvvJgZNzq1fU3LkiDAodma7ZJBHaKIFr3rncUdvjWKwawtzXjlyqY71mg+4yj2FGRaJmLDcTCOPI22WFrsgJ7PCxKjapV2il5OcHcZ9iGsuYd84mLyh1V0ee5lCFDw5BCuXYuBIqFcF2PZqaN0pYvhnEOmsNooZgvl94kYmanw5YggZf+1ccfJ+dBJdNh8dY19iWAifIwfO/cTVAKKYpm4u3fhXL1tH0A== 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=3XlJjCR7ke1C4RWtNOrbGGtaFYikb6ZWxEctir3PIuQ=; b=KYbn0ocBBNbfsznFgKRi/yCpNq0fsMadvCuv8yvlGT0xLyraM+EUsXho/qJZQiVNehJI8Y8hncb9fSgnERFov9oh5mZjTITUe25msFRIkV6mcMbzL9um6pkQ2af5UgsLnkp0ShTTf/Il1dyC84e2ctlZa8wUg+NraXvmWSn7kTY= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; Received: from BN6PR11MB1474.namprd11.prod.outlook.com (10.172.22.17) by BN8PR11MB3538.namprd11.prod.outlook.com (20.178.218.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17; Wed, 18 Aug 2021 09:47:43 +0000 Received: from BN6PR11MB1474.namprd11.prod.outlook.com ([fe80::7cde:47ff:b54e:9e11]) by BN6PR11MB1474.namprd11.prod.outlook.com ([fe80::7cde:47ff:b54e:9e11%12]) with mapi id 15.20.4415.024; Wed, 18 Aug 2021 09:47:43 +0000 To: Huisong Li , CC: , References: <1627908397-51565-1-git-send-email-lihuisong@huawei.com> From: "Singh, Aman Deep" Message-ID: <44a1b455-31e8-7909-3011-1643293f3210@intel.com> Date: Wed, 18 Aug 2021 15:17:32 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.12.0 In-Reply-To: <1627908397-51565-1-git-send-email-lihuisong@huawei.com> Content-Language: en-GB X-ClientProxiedBy: PN0PR01CA0004.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:4f::9) To BN6PR11MB1474.namprd11.prod.outlook.com (2603:10b6:405:c::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.1.18] (223.178.212.231) by PN0PR01CA0004.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:4f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Wed, 18 Aug 2021 09:47:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aa29e527-8342-4084-db99-08d9622d39bc X-MS-TrafficTypeDiagnostic: BN8PR11MB3538: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iybS27xy54kdpXoo7bTioKggQgTIKxbZLQuHS+rnyA8HOGl4+LdmQK6ddtmnADyLKXAm6fvuVrBoVDLKpH10n2tTVLzWorjrrRjHATmllo9btzt7K1DDg94DJdv9CxL2NLb2nwSI45LbrerqNHm+HS4OMBmUrB5Aw2iBWJAQlFuNn7pboVvKsJrDlIFyPk7ZUzg+xLzSJefxUbC7l1PhIcrsZNBCHAairTsrnXZZuFq0nn3eJ4GRoaTf7+FVJhZDaAnJ+zuEPw6zI8Ci/CNtF0xYurgu4TtVVGHQ5usRIXSJaRAKIUlfjbMRH9NA8SB2DAZLYA89MEpMHQz5HYNWJuJVG9z62bD4fu4qXK2e4q4HHphP3r31RR6EdMFWpOM8z2pZ70E18TyjzCudQKxApvy3Mz62slj+qd3b2Hdt7wFdpGBuX+hXEUIfGGJHZN/MTj4PVBYdgebxhnw31A/fpR6Wy3i8aGr16GAOgA7UxEYCyY+R0NfjLWAG/0Ja4BXtz1DbjTr+QfhsvD270F0vy+de3Zcr4TchggR1iQuZyvH2YQLQx5d5QME9lTDsbkVXXIrWgPgEJfk3UyTKAwCHYA6smKJuhyGLk1FT6GHA30k4/lfQVZTNTe1JCNt/+sMH+EuJc6TnJrXAqdNuWX0FtIu1Bdkc0k5T2LXr7Ij6m4Kn2BaiINrDfRKzM0ABZ1OPbFPXm+AsIsdBxgTt+Cj4BxK4UPeLX+pOZ92SU81vBvs= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN6PR11MB1474.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(346002)(366004)(396003)(376002)(5660300002)(33964004)(31696002)(36756003)(6486002)(2616005)(478600001)(956004)(4326008)(31686004)(16576012)(6666004)(316002)(38100700002)(83380400001)(66476007)(186003)(66946007)(66556008)(53546011)(107886003)(26005)(8936002)(2906002)(8676002)(86362001)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YjBRcHBKMnJjb3p1NFRrUnZDZkduRVRPQlhjRUNFMExSYlJmMHduWkpPSW1V?= =?utf-8?B?ZTdjOFVjdC9vL0FHU2VLMmlUY1R5NHNRQWNXOXFiWTgwZFRKVEJQVmJscFgw?= =?utf-8?B?VHozc1U0MGMvcEVMdjAzYnNwbGw4ZEZIVWkwLytFY0phWGR2UCtnODl0S1FB?= =?utf-8?B?YktIbUxlVmU5YXlQUWEvSExPNko1eHJaMStRZGhwRVkyc3g4djNTNWl1Smxk?= =?utf-8?B?bDZaUG52WFB0T0MrdUNLQ2hkMWFHMzAyZTlvRzl4Q3BUS0g4bVZ5bFExL05y?= =?utf-8?B?cUFFSjg1OExYNHBwcWhJSUdYYVFZYkU0MmtvRXMrM0QzeGYzNmxISFJZWXdT?= =?utf-8?B?ODJUV2Q3bFM3UWxCL3FvdUo5dWhKVnFYbGxqdnpnOXZLVlZLTkx1OUQ0ZHAy?= =?utf-8?B?MTI3TzRUYmRyaVRIb1doeHdMV3ByaDgzOFgxWUZWS01nMTZ4aWVMTmd6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d2JMb2c2?= =?utf-8?B?VkhwR0FzeENYUHgzVjEwNklvb0YrL0tWNnI4WFRrNFp4YjY3RnNieTFPS1Q0?= =?utf-8?B?T1BhQzEwdFRiOEVTQ2xTMDZMVVpWTG5jUmJEYnNvMTV1djNjRmVKcUZEOWVN?= =?utf-8?B?b1VFN0htVjF0VlVRUERkOXpKV2dYanJaTFEybGhqNzNnZ0VBTDU5eE1pTTVh?= =?utf-8?B?U2p2OExCUlpmdEhza0Z0aG8zdUh0cWlRbFI4VU5oNEVzREdLd2src290cWNO?= =?utf-8?B?cWJzUE02eUc4aVNhOXg3QS85R3hqaHBMWUN6QkpoVVNEYkZUS290VkNsK2Mr?= =?utf-8?B?dTlpTUx3VDhJU3N6TTJmcWlmRWJCYVBRZjkzYXk0YisybHFuNStkTUhDUXlm?= =?utf-8?Q?4+97ZDqkQMAxD7t6yXlfzwlCNHQ8TLS3dc/apvA?= X-MS-Exchange-CrossTenant-Network-Message-Id: aa29e527-8342-4084-db99-08d9622d39bc X-MS-Exchange-CrossTenant-AuthSource: BN6PR11MB1474.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2021 09:47:43.2663 (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: 65eXe4ify6JEMVWFOQqblNvW4XCeSarwZityY2tUMshpMH0VCO3XwJOq1AS0vNpBLLCaPqHXzhep4/kKjDjcjKmwe6OW9APuliBxY4TtHbQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR11MB3538 X-OriginatorOrg: intel.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [dpdk-dev] [RFC V1] ethdev: fix the issue that dev uninit may be called twice 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" Hi Huison, On 8/2/2021 6:16 PM, Huisong Li wrote: > Ethernet devices in DPDK can be released by rte_eth_dev_close() and > rte_dev_remove(). However, these two APIs do not have explicit invocation > restrictions. In other words, at the ethdev layer, calling > rte_eth_dev_close() and then rte_dev_remove() or rte_eal_hotplug_remove() > is allowed. In such a bad scenario, the primary process may be fine, but it > may cause that dev_unint() in the secondary process will be called twice, Shouldn't dev_unint() for Secondary process, simply return with no-action. > and even other serious problems. So this patch fixes it. > > Fixes: 99a2dd955fba ("lib: remove librte_ prefix from directory names") > > Signed-off-by: Huisong Li > --- > lib/ethdev/ethdev_pci.h | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/lib/ethdev/ethdev_pci.h b/lib/ethdev/ethdev_pci.h > index 8edca82..14a0e01 100644 > --- a/lib/ethdev/ethdev_pci.h > +++ b/lib/ethdev/ethdev_pci.h > @@ -151,6 +151,19 @@ rte_eth_dev_pci_generic_remove(struct rte_pci_device *pci_dev, > if (!eth_dev) > return 0; > > + /* > + * The eth_dev->data->name doesn't be cleared by the secondary precess, Can we reprase above sentence "doesn't be cleared " > + * so above "eth_dev" isn't NULL after rte_eth_dev_close() called. > + * Namely, whether "eth_dev" is NULL cannot be used to determine whether > + * an ethdev port has been released. > + * For both primary precess and secondary precess, eth_dev->state is s/ precess / process > + * RTE_ETH_DEV_UNUSED, which means the ethdev port has been released. > + */ > + if (eth_dev->state == RTE_ETH_DEV_UNUSED) { > + RTE_ETHDEV_LOG(INFO, "The ethdev port has been released."); > + return 0; > + } > + > if (dev_uninit) { > ret = dev_uninit(eth_dev); > if (ret)