From: Ashok Kaladi <ashok.k.kaladi@intel.com>
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 [thread overview]
Message-ID: <20230220060839.1267349-1-ashok.k.kaladi@intel.com> (raw)
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 <ashok.k.kaladi@intel.com>
diff --git a/.mailmap b/.mailmap
index 5015494210..bbf6744278 100644
--- a/.mailmap
+++ b/.mailmap
@@ -132,6 +132,7 @@ Ashish Jain <ashish.jain@nxp.com>
Ashish Paul <apaul@juniper.net>
Ashish Sadanandan <ashish.sadanandan@gmail.com>
Ashish Shah <ashish.n.shah@intel.com>
+Ashok Kaladi <ashok.k.kaladi@intel.com>
Ashwin Sekhar T K <asekhar@marvell.com> <ashwin.sekhar@caviumnetworks.com>
Asim Jamshed <asim.jamshed@gmail.com>
Aviad Yehezkel <aviadye@mellanox.com>
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;
}
--
2.25.1
next reply other threads:[~2023-02-20 6:08 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-20 6:08 Ashok Kaladi [this message]
2023-02-20 6:08 ` [PATCH 2/2] ethdev: fix race condition in fast-path ops setup Ashok Kaladi
2023-02-20 6:57 ` fengchengwen
2023-02-21 7:24 ` Ruifeng Wang
2023-02-21 17:00 ` Stephen Hemminger
2023-02-22 1:07 ` fengchengwen
2023-02-22 9:41 ` Ruifeng Wang
2023-02-22 10:41 ` Konstantin Ananyev
2023-02-22 22:48 ` Honnappa Nagarahalli
2023-02-23 1:15 ` Stephen Hemminger
2023-02-23 4:47 ` Honnappa Nagarahalli
2023-02-23 4:40 ` Honnappa Nagarahalli
2023-02-23 8:23 ` fengchengwen
2023-02-23 13:31 ` Konstantin Ananyev
2023-02-25 1:32 ` fengchengwen
2023-02-26 17:22 ` Konstantin Ananyev
2023-02-27 2:56 ` fengchengwen
2023-02-27 19:08 ` Konstantin Ananyev
2023-03-03 17:19 ` Ferruh Yigit
2023-03-06 1:57 ` fengchengwen
2023-03-06 6:13 ` Ruifeng Wang
2023-03-06 10:32 ` Konstantin Ananyev
2023-03-06 11:17 ` Ajit Khaparde
2023-03-06 11:57 ` Ferruh Yigit
2023-03-06 12:36 ` Konstantin Ananyev
2023-02-28 23:57 ` Honnappa Nagarahalli
2023-02-20 7:01 ` fengchengwen
2023-02-20 9:44 ` Konstantin Ananyev
2023-03-03 16:49 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230220060839.1267349-1-ashok.k.kaladi@intel.com \
--to=ashok.k.kaladi@intel.com \
--cc=abhinandan.gujjar@intel.com \
--cc=dev@dpdk.org \
--cc=erik.g.carrillo@intel.com \
--cc=jerinj@marvell.com \
--cc=s.v.naga.harish.k@intel.com \
--cc=stable@dpdk.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).