* [PATCH 1/2] eventdev: fix race condition in fast-path set function
@ 2023-02-20 6:06 Ashok Kaladi
2023-02-20 6:06 ` [PATCH 2/2] ethdev: fix race condition in fast-path ops setup Ashok Kaladi
0 siblings, 1 reply; 3+ messages in thread
From: Ashok Kaladi @ 2023-02-20 6:06 UTC (permalink / raw)
To: s.v.naga.harish.k; +Cc: stable
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] ethdev: fix race condition in fast-path ops setup
2023-02-20 6:06 [PATCH 1/2] eventdev: fix race condition in fast-path set function Ashok Kaladi
@ 2023-02-20 6:06 ` Ashok Kaladi
0 siblings, 0 replies; 3+ messages in thread
From: Ashok Kaladi @ 2023-02-20 6:06 UTC (permalink / raw)
To: s.v.naga.harish.k; +Cc: stable
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 <ashok.k.kaladi@intel.com>
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;
}
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] eventdev: fix race condition in fast-path set function
@ 2023-02-20 6:08 Ashok Kaladi
0 siblings, 0 replies; 3+ messages in thread
From: Ashok Kaladi @ 2023-02-20 6:08 UTC (permalink / raw)
To: jerinj, thomas
Cc: dev, s.v.naga.harish.k, erik.g.carrillo, abhinandan.gujjar, stable
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-20 6:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-20 6:06 [PATCH 1/2] eventdev: fix race condition in fast-path set function Ashok Kaladi
2023-02-20 6:06 ` [PATCH 2/2] ethdev: fix race condition in fast-path ops setup Ashok Kaladi
2023-02-20 6:08 [PATCH 1/2] eventdev: fix race condition in fast-path set function Ashok Kaladi
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).