From 65506d511672fb8ab06230634f2cc70fea7dc7f2 Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Mon, 9 Dec 2019 21:13:29 -0500 Subject: [PATCH] util: add SPDK_CACHE_LINE_SIZE macro definition For now we don't provide #ifdef to users, SPDK_CACHE_LINE_SIZE is defined with 64 bytes. Change-Id: I8ddb01a382008a3e333967650200c5aa8b93e09e Signed-off-by: Changpeng Liu Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477385 Tested-by: SPDK CI Jenkins Community-CI: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker Reviewed-by: Paul Luse --- include/spdk/util.h | 2 ++ lib/event/reactor.c | 2 +- lib/vhost/vhost_internal.h | 3 +-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/spdk/util.h b/include/spdk/util.h index 8b52dc358..993d10ac1 100644 --- a/include/spdk/util.h +++ b/include/spdk/util.h @@ -44,6 +44,8 @@ extern "C" { #endif +#define SPDK_CACHE_LINE_SIZE 64 + #define spdk_min(a,b) (((a)<(b))?(a):(b)) #define spdk_max(a,b) (((a)>(b))?(a):(b)) diff --git a/lib/event/reactor.c b/lib/event/reactor.c index 3695c93e6..05adadb5b 100644 --- a/lib/event/reactor.c +++ b/lib/event/reactor.c @@ -81,7 +81,7 @@ struct spdk_reactor { /* The last known rusage values */ struct rusage rusage; -} __attribute__((aligned(64))); +} __attribute__((aligned(SPDK_CACHE_LINE_SIZE))); static struct spdk_reactor *g_reactors; static struct spdk_cpuset *g_reactor_core_mask; diff --git a/lib/vhost/vhost_internal.h b/lib/vhost/vhost_internal.h index 6d15249bb..c81409e55 100644 --- a/lib/vhost/vhost_internal.h +++ b/lib/vhost/vhost_internal.h @@ -42,11 +42,10 @@ #include "spdk_internal/vhost_user.h" #include "spdk_internal/log.h" #include "spdk/event.h" +#include "spdk/util.h" #include "spdk/rpc.h" #include "spdk/config.h" -#define SPDK_CACHE_LINE_SIZE RTE_CACHE_LINE_SIZE - #define SPDK_VHOST_MAX_VQUEUES 256 #define SPDK_VHOST_MAX_VQ_SIZE 1024