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 73C8DA00BE; Mon, 23 May 2022 14:33:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0CD234014F; Mon, 23 May 2022 14:33:41 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2067.outbound.protection.outlook.com [40.107.243.67]) by mails.dpdk.org (Postfix) with ESMTP id 87EB640141; Mon, 23 May 2022 14:33:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nFKgI68KhEBwbCFOqsyk/s/ge7YSpMAqUpXq1I3S94ShtBPcNf4pj94KLkg8/lyk2HAUcOUHEIx9JcT9eTYrOeui7lJgEjGlfvW9TPaLZ5nfTvnFJ5GiHcS4LnPqRd0zz91xB9ud5vV/M7Ox5LrBO2lfxB9ETEADJzUVGvtAOPbZkiZ6uHEP0FRxyosIjtRRRafwEnjBChhVU62j4l1V7Q0P0b+hC9Mc2EqbIjRT91L2YVBN709OggC1Wv+taKAjth8Q/J0r9+L30QHFbIfG2gQpxJPG3P1/Ak73y1i7uXORxL8SX1V0exOFjj/Ryynt37jHfA77FhzhRF9EdZxcIQ== 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=KfAij2vyxlm/04j4Smsx9y2iKAkPocqJpEIjLk3CAKo=; b=mn3i/QI/RlAXvrq0Mh1+pWCZSGk7Gx39dSO3XbOtIdLH0Pi4Grvt7eN/xht2I20liIPISOOVT4r8xW5ce76Sm19ymmESaXUnukU3pcXS0lb1WLZl5i6ug00QQUIVJQA7N+C9CrLXb4py2CNHJ48PJ0D3n3S472QCpghSHAU9QHBombjZYXXoDDgKd8Cv0rQmrP3tcxGcLQ/6gRaDhaQab5AKBjMI9HFTUDmt4sxysXant3FLu9h3YnZGDG04lIDU6vIzsyablNOmc54qBEJFOqm2gEMUgjbYIru7PB+/R2AdqX844xuQ+WaMbIdj5ux1Rcc402YJgS22fTIxhV1ieQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=softfail (sender ip is 149.199.80.198) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=fail (p=quarantine sp=quarantine pct=100) action=quarantine header.from=amd.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=KfAij2vyxlm/04j4Smsx9y2iKAkPocqJpEIjLk3CAKo=; b=PTvdct+TmZ/VZvkg7MLe/c5oCPYswY/oDI6CaG6a2ZbQoE8ysoiIdMtec38srszoOXZ6nfC1kTuoOrYtqVNItk8Mza+zIuq8uu7s2dyyI4BL4pUj0RHMG/EnhXkDziSpt86Ge4CsrpoTsJRzXClX8pBZjKVQW3WnjsC2Y7aIRTc= Received: from BN0PR10CA0022.namprd10.prod.outlook.com (2603:10b6:408:143::30) by CH2PR02MB6982.namprd02.prod.outlook.com (2603:10b6:610:8a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.16; Mon, 23 May 2022 12:33:37 +0000 Received: from BN1NAM02FT062.eop-nam02.prod.protection.outlook.com (2603:10b6:408:143:cafe::eb) by BN0PR10CA0022.outlook.office365.com (2603:10b6:408:143::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.13 via Frontend Transport; Mon, 23 May 2022 12:33:37 +0000 X-MS-Exchange-Authentication-Results: spf=softfail (sender IP is 149.199.80.198) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=fail action=quarantine header.from=amd.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning amd.com discourages use of 149.199.80.198 as permitted sender) Received: from xir-pvapexch01.xlnx.xilinx.com (149.199.80.198) by BN1NAM02FT062.mail.protection.outlook.com (10.13.2.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5273.14 via Frontend Transport; Mon, 23 May 2022 12:33:36 +0000 Received: from xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Mon, 23 May 2022 13:33:35 +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; Mon, 23 May 2022 13:33:35 +0100 Envelope-to: david.marchand@redhat.com, humin29@huawei.com, thomas@monjalon.net, andrew.rybchenko@oktetlabs.ru, dev@dpdk.org, lihuisong@huawei.com, stable@dpdk.org, bruce.richardson@intel.com Received: from [10.71.117.102] (port=26641) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nt7Ff-0004t0-Ao; Mon, 23 May 2022 13:33:35 +0100 Message-ID: Date: Mon, 23 May 2022 13:33:34 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH] ethdev: fix push new event Content-Language: en-US To: David Marchand , "Min Hu (Connor)" , Thomas Monjalon , Andrew Rybchenko CC: dev , Huisong Li , dpdk stable , Bruce Richardson References: <20220521065549.33451-1-humin29@huawei.com> From: Ferruh Yigit In-Reply-To: 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: b3c0e11a-9e8a-4c32-9c6b-08da3cb875a2 X-MS-TrafficTypeDiagnostic: CH2PR02MB6982:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 2 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Yq8eHRIqpf/JeimBBkSc+6QEtpvUIU0DpouwQCvGe4DvccFkiGQj3cEu42fyIHcO7LdBJWO1J7DSMVmyscTtXsFATk6xJaC++S9BmyjJdiuMoCd/Z4jDp29Jwxrd2zAUZay7fbkBKTsvr//7MYG/X3XTc+ZvVYDMI1Dr91MsfWwicSo1QlwtyVpcaDMHBpwc4JrIJvctflnkbP/7bRZSN8USzCDkgJM3TEXY6QOjODC4hvIHde67RURQB7UuQkznA9nMsI7CWJx4Yq13EH6oK0Wc3mlVZAs7UbBuXnmSThvzEdKgilDCCt0v0Pw9m3lRvpJrcAsS6goTVMX9hPAr6CVy+In0c7to0KRvIOnNyh0ZCNjofjuQOWpc9CLqQV9Fy0FtuHqwE5P6Sbg07SFUPBvN/ztVDLglgfnNsW2VcDkvSOpgs6NabY/RShOwhkAT2RuHOTAX6BbDMRiyWTFrqAqd1XLm9Tys9aA5v5NaSpT3EaErQJmYtZWZQ0iMDK5NROFWcGYB5KGVA2Y4akLDONQSDvhs5/OxRiHpG33awjFw6+Txg3tqQs/YU8Loo3v/RWHAH3156QnMtA5cMlOsTOyrjDzQprnPHsaFHnu2MLrBIYLnMVPCyq1erJaK9+zWCWOBQzu9vYUMG2mfjIyGD1X1ifA1MLOKjzGSGmVhfTlAbG28/O0UPZ4HsKn4B0PfD5wlG0oir5jBP5W/wFmhAFxUgUjH4WQkc2hWwLfl+Mk= X-Forefront-Antispam-Report: CIP:149.199.80.198; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:xir-pvapexch01.xlnx.xilinx.com; PTR:unknown-80-198.xilinx.com; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(36756003)(47076005)(336012)(35950700001)(5660300002)(83380400001)(2616005)(44832011)(8936002)(31686004)(26005)(9786002)(53546011)(8676002)(70206006)(54906003)(4326008)(110136005)(70586007)(7636003)(508600001)(356005)(40460700003)(2906002)(86362001)(31696002)(82310400005)(316002)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2022 12:33:36.9711 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b3c0e11a-9e8a-4c32-9c6b-08da3cb875a2 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-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BN1NAM02FT062.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR02MB6982 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 5/23/2022 10:51 AM, David Marchand wrote: > [CAUTION: External Email] > > On Sat, May 21, 2022 at 8:57 AM Min Hu (Connor) wrote: >> >> From: Huisong Li >> >> The 'state' in struct rte_eth_dev may be used to update some information >> when app receive these events. For example, when app receives a new event, >> app may get the socket id of this port by calling rte_eth_dev_socket_id to >> setup the attached port. The 'state' is used in rte_eth_dev_socket_id. >> >> If the state isn't modified to RTE_ETH_DEV_ATTACHED before pushing the new >> event, app will get the socket id failed. So this patch moves pushing event >> operation after the state updated. >> >> Fixes: 99a2dd955fba ("lib: remove librte_ prefix from directory names") > > A patch moving code is unlikely to be at fault. > > > Looking at the patch which moved those notifications in this point of > the code, the state update was pushed after the notification on > purpose. > See be8cd210379a ("ethdev: fix port probing notification") > > ethdev: fix port probing notification > > The new device was notified as soon as it was allocated. > It leads to use a device which is not yet initialized. > > The notification must be published after the initialization is done > by the PMD, but before the state is changed, in order to let > notified entities taking ownership before general availability. > > > Do we need an intermediate state during probing? > As David highlight above commit, sending event before setting state to 'RTE_ETH_DEV_ATTACHED' seems done intentionally. I guess this is done mainly because of failsafe PMD, which registers the 'RTE_ETH_EVENT_NEW' event and take sub-device ownership. The ethdev iterate macros, like 'RTE_ETH_FOREACH_DEV', uses the condition that device is NOT owned and device state is NOT UNUSED. Sending event before device state set to 'ATTACHED' lets failsafe to own the device so that it won't be visible to application at all via mentioned macros. But I think the need for the libraries and application can be different, unlike failsafe PMD application may want notification on fully probed device, as the commit log of this patch mentions. Perhaps solution can be as David mentioned, to create two events, one for libraries (failsafe) and other for applications.