From patchwork Mon Feb 20 06:08:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashok Kaladi X-Patchwork-Id: 124165 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5BDE841CF4; Mon, 20 Feb 2023 07:08:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 021FD42F84; Mon, 20 Feb 2023 07:08:45 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 4AF1040691; Mon, 20 Feb 2023 07:08:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676873323; x=1708409323; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=wJFDS5XXDsLIgj7qmKaSPDR89CXCSWj0utBHxTZrS1w=; b=jzbmM9gXBc0pm/E3DMuNrg7SqAN3v9TxDQ+jYq0KIbRI4aUNMGvc6liX iOAU3jBBiCo8hFfWINsiJADnXR4CAV3CFbHtBPq9bz9aQKf5L4XWQqc3E yOUiN4nBJoRJ2SxXZf9Klr9dEGcacJQ6t2YeE+RDt7bsoE8crmyfrwxgn ztJwqRo8QSTbxhU9Z3CI98lq6E4MrolYkqsIkhshWid3MqgPbjIOmwBQC orZluJhwnFZdRFOg8nlVAzByCIlWafZE9DawrWvmcJmYiAW7/HrJWodPk CuuHhlSX0W1l/LTRjPZxjUqj7O1z6hhr6vN4YSTvsd7aN/C+VjY4igZ2p w==; X-IronPort-AV: E=McAfee;i="6500,9779,10626"; a="334532123" X-IronPort-AV: E=Sophos;i="5.97,311,1669104000"; d="scan'208";a="334532123" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2023 22:08:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10626"; a="648722850" X-IronPort-AV: E=Sophos;i="5.97,311,1669104000"; d="scan'208";a="648722850" Received: from txandevlnx321.an.intel.com ([10.123.117.43]) by orsmga006.jf.intel.com with ESMTP; 19 Feb 2023 22:08:41 -0800 From: Ashok Kaladi To: 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 Subject: [PATCH 1/2] eventdev: fix race condition in fast-path set function Date: Mon, 20 Feb 2023 00:08:38 -0600 Message-Id: <20230220060839.1267349-1-ashok.k.kaladi@intel.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 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 If eventdev enqueue or dequeue function is called during event_dev_fp_ops_set(), 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 data element to the beginning of event_dev_fp_ops_set() function. Fixes: d35e61322de5 ("eventdev: move inline APIs into separate structure") Cc: stable@dpdk.org Signed-off-by: Ashok Kaladi diff --git a/.mailmap b/.mailmap index 5015494210..bbf6744278 100644 --- a/.mailmap +++ b/.mailmap @@ -132,6 +132,7 @@ Ashish Jain Ashish Paul Ashish Sadanandan Ashish Shah +Ashok Kaladi Ashwin Sekhar T K Asim Jamshed Aviad Yehezkel diff --git a/lib/eventdev/eventdev_private.c b/lib/eventdev/eventdev_private.c index 1d3d9d357e..539aade780 100644 --- a/lib/eventdev/eventdev_private.c +++ b/lib/eventdev/eventdev_private.c @@ -107,6 +107,7 @@ void event_dev_fp_ops_set(struct rte_event_fp_ops *fp_op, const struct rte_eventdev *dev) { + fp_op->data = dev->data->ports; fp_op->enqueue = dev->enqueue; fp_op->enqueue_burst = dev->enqueue_burst; fp_op->enqueue_new_burst = dev->enqueue_new_burst; @@ -117,5 +118,4 @@ event_dev_fp_ops_set(struct rte_event_fp_ops *fp_op, fp_op->txa_enqueue = dev->txa_enqueue; fp_op->txa_enqueue_same_dest = dev->txa_enqueue_same_dest; fp_op->ca_enqueue = dev->ca_enqueue; - fp_op->data = dev->data->ports; }