ionic: add missing dma_rmb() after the completion publish check

Each completion service routine tests a device-written publish flag and
then reads the rest of the descriptor with nothing ordering those loads.
A control dependency does not order loads, so a weakly ordered CPU may
satisfy the payload reads from a cache line state observed before the
flag became valid. Add the barrier to all four completion paths.

Fixes: 1d062b7b6f ("ionic: Add basic adminq support")
Fixes: 0f3154e6bc ("ionic: Add Tx and Rx handling")
Fixes: 77ceb68e29 ("ionic: Add notifyq support")
Signed-off-by: Eric Joyner <eric.joyner@amd.com>
Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260811195039.1315045-2-eric.joyner@amd.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Eric Joyner 2026-08-11 12:50:38 -07:00 committed by Jakub Kicinski
parent 273480bb83
commit 621f44af8c
2 changed files with 8 additions and 0 deletions

View File

@ -269,6 +269,8 @@ bool ionic_notifyq_service(struct ionic_cq *cq)
if ((s64)(eid - lif->last_eid) <= 0)
return false;
dma_rmb();
lif->last_eid = eid;
dev_dbg(lif->ionic->dev, "notifyq event:\n");
@ -314,6 +316,8 @@ bool ionic_adminq_service(struct ionic_cq *cq)
if (!color_match(comp->color, cq->done_color))
return false;
dma_rmb();
/* check for empty queue */
if (q->tail_idx == q->head_idx)
return false;

View File

@ -734,6 +734,8 @@ static bool __ionic_rx_service(struct ionic_cq *cq, struct bpf_prog *xdp_prog)
if (!color_match(comp->pkt_type_color, cq->done_color))
return false;
dma_rmb();
/* check for empty queue */
if (q->tail_idx == q->head_idx)
return false;
@ -1249,6 +1251,8 @@ static bool ionic_tx_service(struct ionic_cq *cq,
if (!color_match(comp->color, cq->done_color))
return false;
dma_rmb();
/* clean the related q entries, there could be
* several q entries completed for each cq completion
*/