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 CC97841CA7; Wed, 15 Feb 2023 17:09:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5C5EA40A7D; Wed, 15 Feb 2023 17:09:48 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2050.outbound.protection.outlook.com [40.107.244.50]) by mails.dpdk.org (Postfix) with ESMTP id EB3754067E for ; Wed, 15 Feb 2023 17:09:45 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bhA0yl/IAOmf4u3cMCeC10sMSJghSrRTOT6WIo546EzbfrxdoIxOewDqgmgCeHR2ujG1Dh8P9FoYCJhaMS9wpdc9bM4I/B7zo02FA/xHVI5DV2rEivVrBPA82vmVg/O7RRaTIzF3p7oaEMpNF++Zr7x0WO7XabCO4kSQSXAm77O6zWS8OUi+UrHzOG7puGbVqpFBkdR7i9x0kBBTRF734hh/0UXhY4P642cCYm3PuKo27dgcPaQkkZEfz4Za0NC/yt1ep0881Su91EBxFNrbUvT0ZprkLbNkdWgEDnunH7RGCAuMOZ4eCPed2Nv3UQUgR/NlP7+kgU2xTkdSuCZtXg== 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=E98pfKNvzc5ePe/N4sjAhVsbpS9RX6KMMAXvTvbmMMA=; b=jzDEIuUFnu0Xs+1nY6tgBggrH9K733cBBXs58dk7TUAM6PP1lfgKdwiNImdXL551N8BRDa6isSmdnEE6o0MLjAr2PQnQbKnajk44RtRa9pZwLjZAQM4nqG9jzEb+0D99KIjpjDPgteMMu5xQFWgPNalPS2oZgtLka3yFRVehJ/9hEcX3R730571dM3Efx/4HXOiGGquGeRWVJ5ESfjLnXEBZG8a5AvArFYfjOnfBDmIY6YbLt/K3oM6rsWs97/DeiTxBGDcn50ih+jUrJiOMx0k6VNrIGU/qRClTSpI53Uh4gio5a8pc300nDLGU0Blx3xSaaOVxoi3GHDxxgszKTw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E98pfKNvzc5ePe/N4sjAhVsbpS9RX6KMMAXvTvbmMMA=; b=wI9R5oYoOkjav4mdIGW+232rUKtv9dLyaRA2QjlY785bXmxjiUlJtClynSa3mpBFnVpmYO5u1iEXOL8kV9FuSgekYfa/gBtKYo11S00CRcXpLYu77RBiixzS0RBUWaZOVEtQh7V0NRJ6CixP1wQRs5stBk3JShqdMi1vRQYt15k= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by PH7PR12MB5617.namprd12.prod.outlook.com (2603:10b6:510:133::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Wed, 15 Feb 2023 16:09:43 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::3614:22ed:ed5:5b48]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::3614:22ed:ed5:5b48%8]) with mapi id 15.20.6086.026; Wed, 15 Feb 2023 16:09:43 +0000 Message-ID: <5d06f478-6142-651b-d54b-0a3c75e9e7a0@amd.com> Date: Wed, 15 Feb 2023 16:09:37 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Content-Language: en-US To: "lihuisong (C)" , dev@dpdk.org, andrew.rybchenko@oktetlabs.ru Cc: thomas@monjalon.net, liudongdong3@huawei.com, huangdaode@huawei.com, fengchengwen@huawei.com References: <20220825024425.10534-1-lihuisong@huawei.com> <20221206092649.8287-1-lihuisong@huawei.com> <20221206092649.8287-2-lihuisong@huawei.com> <79192ffa-eb80-e56c-5c64-4a22374c7a1a@amd.com> <461a4536-fbbd-3848-af8d-2aa1ebaf8ccb@huawei.com> From: Ferruh Yigit Subject: Re: [PATCH V4 1/5] drivers/bus: restore driver assignment at front of probing In-Reply-To: <461a4536-fbbd-3848-af8d-2aa1ebaf8ccb@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P265CA0020.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ae::16) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|PH7PR12MB5617:EE_ X-MS-Office365-Filtering-Correlation-Id: 5cf75f4b-d056-40ee-506b-08db0f6f0c82 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4ZnaO4FzXXQk4P286SvdhT3WFBR6G7W43DT9ihokUxVS61zClBzhJnX20Fn0LM+KTjN4UeIeHCZunFkihC8LHztelqE8+jYvIvSzl+SgCUXaaP1388opoWK8L6TdUhSFHBLv/K6P9Wg7TwVcyrKFs/5Qg3BzRsOAapNZUf7cqc/BaKJ3qBPeIsx68Vw9mzxNz+ph9ntynPCUOJXlkewOrw3JKBEeLoIuQ+SHaxmXLJaaMlMb9PGw8u9GYu0RRxy5uAe1UAD4u7WHNzEVtNbsVGOoiVLOa2e9zy8ffYFapHXE28dkyHSPzBDEoZuAX01V9rPCEilEb7ae3KhzbSEsX8uObevIjsaZ7ACZ9jRrRcL+ITZ+kcJ5bkrB7HhkgRxyJ5UpXlpLs6FKmDXj+SFdKxBjW/Od6Cs44uPIkFQcMF0agtgpEyxyhjKm6KNTjrdUW2AB9hFT/qEuDgXoaFtZJ7SV9KONg/RbK2dLFYttiN6MPrVZkslRvdlDPb+WxXhj5xeS0KIXix6vIhWPE3FoWK/PYakfmXc3KvXV6JatKVzULW08dDM+LliFPNYYAQBq64hhqezI4uhx95tkSZWe9oXT9p6d8U15djbXx1ECxWsUZAP0sEMYBCxcs+rTbkhRMxDkesD0AGz4ty1qMdo0eaBrofPKoYoKjcUS/2PRRDfhFpIGsMmAuITe8L/Ph/pLjmN/ZlfNCvgCgsqaOqyt/g4Ej/6bZerS5HgzKnWKWWQ= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(39860400002)(136003)(396003)(366004)(376002)(346002)(451199018)(6512007)(53546011)(6506007)(6486002)(186003)(26005)(31686004)(478600001)(6666004)(316002)(2616005)(44832011)(66556008)(66476007)(66946007)(4326008)(8676002)(41300700001)(83380400001)(2906002)(8936002)(5660300002)(38100700002)(31696002)(86362001)(36756003)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SEZFZmo1WG5ydzN6UXdvM1hWVndkNGdFS3F0cjlUR0RBRTBBZVoxczJqR3Rh?= =?utf-8?B?dWRkZHNGaDRqTUNUUDJVT1BjcWVoVzgzVnlvNW1vczhxM3gxU1RxY0xWU01r?= =?utf-8?B?WjlVUEJKOTdLOXpWVU1lY0ZIWlg2RkdFOUY1c252c3BENVljWlgvMCtWcXI5?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5nekRFTTdKRElpWk9DbHQ4WWVa?= =?utf-8?B?aFpNQ3psUVQ3WENsN1YxYytxbjN3SDM0bGlJajJpTk9ueGFRMWMrbUNDbG1O?= =?utf-8?B?alNSVmJIcHBOTnc5NW16cHhYbjJ0eVVtczMzR21leURORUozV0Y0NXdLM1Q0?= =?utf-8?Q?rJKhlRoLVAndp7quruDABDSzO?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5cf75f4b-d056-40ee-506b-08db0f6f0c82 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2023 16:09:43.3549 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Zi025Xv0UynTsAD4x4YXGCEsZPAiGHtqCWvSyY0h/qPkGPeg3V47qyWJ2cy6ikfR X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5617 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 1/12/2023 2:44 AM, lihuisong (C) wrote: > > 在 2023/1/11 20:51, Ferruh Yigit 写道: >> On 12/6/2022 9:26 AM, Huisong Li wrote: >>> The driver assignment was moved back at the end of the device probing >>> because there is no something to use rte_driver during the phase of >>> probing. See commit 391797f04208 ("drivers/bus: move driver assignment >>> to end of probing") >>> >>> However, it is necessary for probing callback to reference rte_driver >>> before probing. For example, probing callback may call some APIs which >>> access the rte_pci_driver::driver by the device::driver pointer to get >>> driver information. In this case, a segment fault will occur in probing >>> callback if there is not this assignment. >>> >> Probing callback gets driver as parameter, so callback function can >> access it via 'drv->driver', is there a specific usecase that >> 'dev->device->driver' needs to be accessed explicitly? >> >> I assume this is related to coming patches that setting up device in >> testpmd event callback, but can you please clarify exact need. > > For example, rte_eth_dev_info_get is called in this event callback to get > driver name. > Why 'rte_eth_dev_info_get()' is called in the event called at first place? This set updates multiple things to extend 'RTE_ETH_EVENT_NEW' event callback function support, like: - Assign device driver *before* probing completed, so that even callback can run 'rte_eth_dev_info_get()' - Add a new ethdev state so that port can be recognized as valid port in the even callback. - Stop forwarding implicitly in even callback in case event callback run while forwarding is on. All looks to me hack/complexity to make a specific case work, which is make secondary *testmp* application work with attached/detached device. And finally patch 4/5 adds port setup to testpmd event callback for this. I understand the intention, but I disagree with bus and ethdev level changes for this. Event callback may not be only way to share port attach/detach information between primary and secondary, there is a MP socket and 'rte_mp_handle' thread to handle communication between primary and secondary process, this should be able to use carrying device information, as far as I remember this is why it is introduced at first place. Did you consider using MP socket for your use case? Following is a sample usage: Primary: started as: sudo ./build/app/dpdk-testpmd --no-pci --proc-type=auto -l 0-1 --log-level=*:debug -- -i --num-procs=2 --proc-id=0 `` testpmd> show port summary all Number of available ports: 0 Port MAC Address Name Driver Status Link testpmd> port attach net_null0 Attaching a new port... dpaa: rte_dpaa_bus_parse(): Parse device name (net_null0 ) fslmc: rte_fslmc_parse(): Parsing dev=(net_null0 ) fslmc: rte_fslmc_parse(): Unknown or unsupported device (net_null0 ) vdev_probe_all_drivers(): Search driver to probe device net_null0 rte_pmd_null_probe(): Initializing pmd_null for net_null0 rte_pmd_null_probe(): Configure pmd_null: packet size is 64, packet copy is disabled eth_dev_null_create(): Creating null ethdev on numa socket 0 EAL: request: eal_dev_mp_request EAL: msg: bus_vdev_mp vdev_action(): send vdev, net_null0 EAL: sendmsg: bus_vdev_mp EAL: reply: bus_vdev_mp EAL: msg: eal_dev_mp_request Port 0 is attached. Now total ports is 1 Done testpmd> show port summary all Number of available ports: 1 Port MAC Address Name Driver Status Link 0 DE:E5:79:00:A9:68 net_null0 net_null down 10 Gbps testpmd> port detach 0 Port was not closed Removing a device... EAL: request: eal_dev_mp_request EAL: msg: eal_dev_mp_request eth_dev_close(): Closing null ethdev on NUMA socket 0 Port 0 is closed Device is detached Now total ports is 0 Done testpmd> show port summary all Number of available ports: 0 Port MAC Address Name Driver Status Link testpmd> `` Secondary: started as: sudo ./build/app/dpdk-testpmd --no-pci --proc-type=auto -l 2-3 --log-level=*:debug -- -i --num-procs=2 --proc-id=1 `` testpmd> show port summary all Number of available ports: 0 Port MAC Address Name Driver Status Link testpmd> EAL: msg: eal_dev_mp_request dpaa: rte_dpaa_bus_parse(): Parse device name (net_null0 ) fslmc: rte_fslmc_parse(): Parsing dev=(net_null0 ) fslmc: rte_fslmc_parse(): Unknown or unsupported device (net_null0 ) EAL: request: bus_vdev_mp EAL: msg: bus_vdev_mp vdev_action(): receive vdev, net_null0 EAL: msg: bus_vdev_mp vdev_scan(): Received 1 vdevs vdev_probe_all_drivers(): Search driver to probe device net_null0 rte_pmd_null_probe(): Initializing pmd_null for net_null0 EAL: reply: eal_dev_mp_request testpmd> show port summary all Number of available ports: 1 Port MAC Address Name Driver Status Link 0 DE:E5:79:00:A9:68 net_null0 net_null down 10 Gbps testpmd> EAL: msg: eal_dev_mp_request dpaa: rte_dpaa_bus_parse(): Parse device name (net_null0 ) fslmc: rte_fslmc_parse(): Parsing dev=(net_null0 ) fslmc: rte_fslmc_parse(): Unknown or unsupported device (net_null0 ) eth_dev_close(): Closing null ethdev on NUMA socket 4294967295 Port 0 is closed EAL: reply: eal_dev_mp_request testpmd> show port summary all Number of available ports: 0 Port MAC Address Name Driver Status Link testpmd> ``