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 BE05641DC9; Fri, 3 Mar 2023 17:49:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 27F324114B; Fri, 3 Mar 2023 17:49:44 +0100 (CET) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2076.outbound.protection.outlook.com [40.107.101.76]) by mails.dpdk.org (Postfix) with ESMTP id 89E1040ED9; Fri, 3 Mar 2023 17:49:42 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H36ZCTv60oPPPt6w6B3FgGyKUQTVAOIq2pV+0jVF39f2XHbVVvFePBSrwCYnJ9x1uDHOzs1YoCQOpYT1HEqyH1y+ZwLJCEWKxfle6Et4ECBpsPMxY5B0QYKBJ3W1TJo21movCvSSfX5MFHixhIa/oUgexhCM/6ZkKnqpTnmnsMWqX8FgbAY+KTcur7783Lp6Ahk8SOpzvzdDi8OvvGhdXIciF3eUi+Q6AVp0Sot3nnHw8xg40rmOPFHrYMY7VkE9ofJYgon8Rax4YMCrlRPr8zV7iiTtNYjUm17lRsvCR7fJpEhYTaDt9kbfMnbH7AZrulZ7NdeOIE0TCZaoTUyH4Q== 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=zH0yi/p7uXD/r0eKcXjIfVSrOUgtNo7aZx0dEnx43X0=; b=V7xM5TnMPdkMC3XJqgoBq4+fHLN2O9XTJGk7O5aWbbBm8sxVvDF9jgHX9w0yFVv34aHgXJ1LiWHBFnf5ILWSYA39Acz348Sr2197sF4mee+HWuWNecfSTaXlAUqCjN9dXQaCstHjxkobxLZP5Gaw8iBxcnRCfSL7y76j0uIqP/wqM3IIFFioJUQIQ1xL3t1PsdFe6TNP42HOkVQxiio3BQPrNoUbrYz+TOh0CrMvHNkVeV58G0vq2jWNoqi778fvHGa+m1sWCnRRgGlSC+2QfU/XvT3QdN4Yql0KzUwcLLqHj9CX7EtyTYTuAW+1bERDpka4KqZPabDXpxetpWpRvA== 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=zH0yi/p7uXD/r0eKcXjIfVSrOUgtNo7aZx0dEnx43X0=; b=e48LQKjyBGdHzsJwVr5/mVzAWPKcy/TlgxsQdD3L3U37t0M00YxLIk9SsZ5fmYopL5urI0z5TUWxRc076hdVd8GXoVurQcXoGs5RUeAqtRXfxex/E9ZnzWq8zOY21fwm4rnNuiryjDjpcNVYvzhuXQr8/7rcfOSWWBV5UegVY8w= 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 DM6PR12MB4879.namprd12.prod.outlook.com (2603:10b6:5:1b5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.29; Fri, 3 Mar 2023 16:49:39 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::dd5a:8a5c:f493:9640]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::dd5a:8a5c:f493:9640%4]) with mapi id 15.20.6156.022; Fri, 3 Mar 2023 16:49:39 +0000 Message-ID: <25d89c52-8e35-d9b8-f5f0-2796070f3198@amd.com> Date: Fri, 3 Mar 2023 16:49:33 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 2/2] ethdev: fix race condition in fast-path ops setup Content-Language: en-US To: Ashok Kaladi , jerinj@marvell.com, thomas@monjalon.net Cc: dev@dpdk.org, s.v.naga.harish.k@intel.com, erik.g.carrillo@intel.com, abhinandan.gujjar@intel.com, stable@dpdk.org, Konstantin Ananyev References: <20230220060839.1267349-1-ashok.k.kaladi@intel.com> <20230220060839.1267349-2-ashok.k.kaladi@intel.com> From: Ferruh Yigit In-Reply-To: <20230220060839.1267349-2-ashok.k.kaladi@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0475.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a8::12) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|DM6PR12MB4879:EE_ X-MS-Office365-Filtering-Correlation-Id: ef44a6b1-06ec-4f5f-0fcd-08db1c07479f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fyagRY0j9K3s7B5gJa+UKs17cvFZEtrjDI1QOAsgLgpVUM+/KXski7iOWtQNIkeTIrM7C+lrxJahIMj6EpFmEelR7eUOP88VMHHpLcRzLV9Cb5KsDmSOurTHzU1stkQg9AqdT8QRUhwg1oFyIZrbz+Dge27QwEy3KsDV3c2dzJXBGSRZSP2QUiZddhUxyJ0GXicUxn3ZVDYW/3feeOXxLL6X+drGwB0pq78at+IRC1nL/bIIeoZazV4VuYA8fKPo7L36QSZli96ntaegICWkZ97T853QN933sCqGMq63nWf1XywSfVguQE0bQygCiMDGrrBmi7g1FTYgBQ35hDhOsdZJfsB4K0LF88k1NLqncKFrKCctbM5HkQ+J2QjrS6GSjZnkk3+f3DN8wY9y1mRdHrKcc6jUXoTXXiTfuBdv4yGA5iYuh2CWVZreeteYvHEp/n1ef7JS0R/Pb5NuvxPdku1giJYmjt04WBXxvGlniU0DBOzj3aUEmYukm7sCmcW9qHC05yzCUXLaJ0V+DWvmFDilNgTQcI/j7EVlTHIXJVimoRByBqDRsIEJ/F4ELI0AnsuM3lnMW7X5e73qlI++SRAK0km5uvlH1eDA+FL9i3ghV1QQkxfID8owDCUozn99oCWAS6TQslKLyVVmVp3WCIcPOtE2Z810piu0OpY/hmSD8E2g8QHvH2bm/Z1JMZ8udZXesA1DHu+9wCtyLxYpg25gw5qQcmuC/Is4+N0XjqM= 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)(136003)(376002)(366004)(39860400002)(346002)(396003)(451199018)(6512007)(66476007)(186003)(31686004)(26005)(38100700002)(8936002)(8676002)(4326008)(41300700001)(66946007)(2906002)(44832011)(66556008)(478600001)(2616005)(6666004)(53546011)(6506007)(316002)(31696002)(36756003)(86362001)(5660300002)(6486002)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OHJlRFcrSUcrNFN1UmlteThINjRaaWNLaTFkUThpakpjMHVIekhreXpyYmp1?= =?utf-8?B?U0xaV1BWLytZb3ZaUU1aL2JLZHZsRWVzeUQ2VC9kNFpZT2xaYXpkNGp3OG02?= =?utf-8?B?OU9qeEQvM3JJKzlYNzBHL3IyNFJ3UnRic0Jza25JZlkva3F4VWdUSHZubTJV?= =?utf-8?B?bkhjVU9peFI0Wkd0WXN5NjdKampqNlBubEh6WEZQbnpGWTIvT0NqSCtTVldl?= =?utf-8?B?SWNrWFlF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3hScGMzM2NmQ1lLTlp4TXFS?= =?utf-8?B?QTF1VE0xdlRYaUF3RHAzaGVLc0RUU2hxWDIvTEZCZnlLcTZpenJGbWJ3N0Mz?= =?utf-8?Q?O+ZbO8x+ZhsX8oxvuif82QlyM?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef44a6b1-06ec-4f5f-0fcd-08db1c07479f X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2023 16:49:39.7824 (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: lRdqabb9C7UFx+WCu3KJ6lCRcWuTHIrcA/VaP2D6bqMawL6da/VgOP6myo1FZwZo X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4879 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 2/20/2023 6:08 AM, Ashok Kaladi wrote: > If ethdev enqueue or dequeue function is called during > eth_dev_fp_ops_setup(), it may get pre-empted after setting > the function pointers, but before setting the pointer to port data. > In this case the newly registered enqueue/dequeue function will use > dummy port data and end up in seg fault. > > This patch moves the updation of each data pointers before updating > corresponding function pointers. > > Fixes: c87d435a4d79 ("ethdev: copy fast-path API into separate structure") > Cc: stable@dpdk.org > > Signed-off-by: Ashok Kaladi > > diff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c > index 48090c879a..a0232c669f 100644 > --- a/lib/ethdev/ethdev_private.c > +++ b/lib/ethdev/ethdev_private.c > @@ -270,17 +270,17 @@ void > eth_dev_fp_ops_setup(struct rte_eth_fp_ops *fpo, > const struct rte_eth_dev *dev) > { > + fpo->rxq.data = dev->data->rx_queues; > fpo->rx_pkt_burst = dev->rx_pkt_burst; > + fpo->txq.data = dev->data->tx_queues; > fpo->tx_pkt_burst = dev->tx_pkt_burst; > fpo->tx_pkt_prepare = dev->tx_pkt_prepare; > fpo->rx_queue_count = dev->rx_queue_count; > fpo->rx_descriptor_status = dev->rx_descriptor_status; > fpo->tx_descriptor_status = dev->tx_descriptor_status; > > - fpo->rxq.data = dev->data->rx_queues; > fpo->rxq.clbk = (void **)(uintptr_t)dev->post_rx_burst_cbs; > > - fpo->txq.data = dev->data->tx_queues; > fpo->txq.clbk = (void **)(uintptr_t)dev->pre_tx_burst_cbs; > } > Hi Ashok, The discussion evolved to proactive recovery, but I wonder if that was your concern or use case? If not can you please describe your use case more?