From c6b6816bed8a4fa2baa396bc0af56e4ac373d713 Mon Sep 17 00:00:00 2001 From: Tianyu Li Date: Thu, 26 Aug 2021 09:43:42 +0800 Subject: [PATCH] acl: fix prefetch out of struct bound on Arm fa_session_t *sess; CLIB_PREFETCH (sess, 2 * CLIB_CACHE_LINE_BYTES, STORE); sizeof(fa_session_t) is 128 bytes i) on 64B cacheline size Arm machine, above CLIB_PREFETCH () macro will be expand to __builtin_prefetch(sess) __builtin_prefetch(sess + 64) __builtin_prefetch(sess + 128) << prefetch is out of range of *sess. __builtin_prefetch(sess + 192) << ii) on 128B cacheline size Arm machine, CLIB_PREFETCH () expands to __builtin_prefetch(sess) __builtin_prefetch(sess + 128) << still out of bound Solution: Change to CLIB_PREFETCH (sess, sizeof(*sess), STORE); Type: fix Signed-off-by: Tianyu Li Reviewed-by: Lijian Zhang Change-Id: I4b3d4fc55747f3d9ad1bcf24f8834601a03ef55e --- src/plugins/acl/dataplane_node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/acl/dataplane_node.c b/src/plugins/acl/dataplane_node.c index 1a050f54b14..4bef8f07770 100644 --- a/src/plugins/acl/dataplane_node.c +++ b/src/plugins/acl/dataplane_node.c @@ -176,7 +176,7 @@ prefetch_session_entry (acl_main_t * am, fa_full_session_id_t f_sess_id) { fa_session_t *sess = get_session_ptr_no_check (am, f_sess_id.thread_index, f_sess_id.session_index); - CLIB_PREFETCH (sess, 2 * CLIB_CACHE_LINE_BYTES, STORE); + CLIB_PREFETCH (sess, sizeof (*sess), STORE); } always_inline u8 -- 2.16.6