From 40ba69271b27beca78eb8e4dbc5b13c05100299a Mon Sep 17 00:00:00 2001 From: Tianyu Li Date: Thu, 26 Aug 2021 10:03:43 +0800 Subject: session: fix prefetch out of struct bound on Arm CLIB_PREFETCH (s->tx_fifo, 2 * CLIB_CACHE_LINE_BYTES, LOAD); sizeof(svm_fifo_t) is 128 bytes Note on 64B cacheline size Arm machine, CLIB_CACHE_LINE_BYTES 128 CLIB_CACHE_PREFETCH_BYTES 6 above CLIB_PREFETCH () macro will be expand to __builtin_prefetch(s->tx_fifo) __builtin_prefetch(s->tx_fifo + 64) __builtin_prefetch(s->tx_fifo + 128) << prefetch out of range __builtin_prefetch(s->tx_fifo + 192) << the same here Solution: Change to CLIB_PREFETCH (s->tx_fifo, sizeof (*(s->tx_fifo)), LOAD); Type: fix Signed-off-by: Tianyu Li Reviewed-by: Lijian Zhang Change-Id: I745cbce3dbe5afcab53c39189d18392f569df5aa --- src/vnet/session/session_node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vnet/session/session_node.c') diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index 969f88c7e36..18fb61d25e9 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -1580,7 +1580,7 @@ session_event_dispatch_io (session_worker_t * wrk, vlib_node_runtime_t * node, s = session_event_get_session (wrk, e); if (PREDICT_FALSE (!s)) break; - CLIB_PREFETCH (s->tx_fifo, 2 * CLIB_CACHE_LINE_BYTES, LOAD); + CLIB_PREFETCH (s->tx_fifo, sizeof (*(s->tx_fifo)), LOAD); wrk->ctx.s = s; /* Spray packets in per session type frames, since they go to * different nodes */ -- cgit 1.2.3-korg