session: fix prefetch out of struct bound on Arm 99/33599/2
authorTianyu Li <tianyu.li@arm.com>
Thu, 26 Aug 2021 02:03:43 +0000 (10:03 +0800)
committerFlorin Coras <florin.coras@gmail.com>
Mon, 30 Aug 2021 18:53:14 +0000 (18:53 +0000)
commit40ba69271b27beca78eb8e4dbc5b13c05100299a
treec45233560427e64cbff14059631771ec004eaa50
parent276675e2a3907cf38ac097a070fada82be1c2d5a
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 <tianyu.li@arm.com>
Reviewed-by: Lijian Zhang <lijian.zhang@arm.com>
Change-Id: I745cbce3dbe5afcab53c39189d18392f569df5aa
src/vnet/session/session_node.c