[PATCH 2/2] event/sw: fix ordering corruption with op release
Bruce Richardson
bruce.richardson at intel.com
Mon Sep 4 18:37:34 CEST 2023
On Thu, Aug 31, 2023 at 05:47:36PM +0100, Harry van Haaren wrote:
> This commit changes the logic in the scheduler to always
> reset reorder-buffer entries in the QE_FLAG_COMPLETE path,
> and not just the QE_FLAG_VALID path.
>
> A release event is a COMPLETE but not VALID (no new event).
> As a result, release events previously left the history-list
> in an inconsistent state, and future events with op type of
> forward could be incorrectly reordered.
>
> Signed-off-by: Harry van Haaren <harry.van.haaren at intel.com>
> ---
> drivers/event/sw/sw_evdev_scheduler.c | 45 ++++++++++++++++-----------
> 1 file changed, 27 insertions(+), 18 deletions(-)
>
Hi Harry,
wondering if this fix might work as well, and offer a simpler alternative.
We can instead zero all unspecified hist-list entries on write.
/Bruce
--- a/drivers/event/sw/sw_evdev_scheduler.c
+++ b/drivers/event/sw/sw_evdev_scheduler.c
@@ -90,8 +90,7 @@ sw_schedule_atomic_to_cq(struct sw_evdev *sw, struct sw_qid * const qid,
sw->cq_ring_space[cq]--;
int head = (p->hist_head++ & (SW_PORT_HIST_LIST-1));
- p->hist_list[head].fid = flow_id;
- p->hist_list[head].qid = qid_id;
+ p->hist_list[head] = (struct sw_hist_list_entry){ .qid = qid_id, .fid = flow_id };
p->stats.tx_pkts++;
qid->stats.tx_pkts++;
@@ -162,8 +161,8 @@ sw_schedule_parallel_to_cq(struct sw_evdev *sw, struct sw_qid * const qid,
qid->stats.tx_pkts++;
const int head = (p->hist_head & (SW_PORT_HIST_LIST-1));
- p->hist_list[head].fid = SW_HASH_FLOWID(qe->flow_id);
- p->hist_list[head].qid = qid_id;
+ const uint32_t fid = SW_HASH_FLOWID(qe->flow_id);
+ p->hist_list[head] = (struct sw_hist_list_entry){ .qid = qid_id, .fid = fid };
if (keep_order)
rob_ring_dequeue(qid->reorder_buffer_freelist,
More information about the dev
mailing list