1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

config: compile time detection of cache line size for aarch64 (fixes #214)

This commit is contained in:
Steffen Vogel 2018-11-14 21:14:52 +01:00
parent b4e467d634
commit 38be4ef255
3 changed files with 10 additions and 4 deletions

View file

@ -57,6 +57,13 @@ extern "C" {
#define USER_AGENT "VILLASnode (" BUILDID ")"
/* Hard-coded cache line size */
#if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__)
#define CACHELINE_SIZE 64
#else
#error "Unsupported architecture"
#endif
/* Required kernel version */
#define KERNEL_VERSION_MAJ 3
#define KERNEL_VERSION_MIN 6

View file

@ -39,6 +39,7 @@
#include <villas/atomic.h>
#include <villas/common.h>
#include <villas/config.h>
#ifdef __cplusplus
extern "C" {
@ -47,7 +48,6 @@ extern "C" {
/* Forward declarations */
struct memory_type;
#define CACHELINE_SIZE 64
typedef char cacheline_pad_t[CACHELINE_SIZE];
struct queue_cell {

View file

@ -299,14 +299,13 @@ int kernel_get_version(struct version *v)
return 0;
}
/** @todo Do not rely on hard-coded sizes */
int kernel_get_cacheline_size()
{
#if defined(__linux__) && defined(__x86_64__)
return sysconf(_SC_LEVEL1_ICACHE_LINESIZE);
#elif defined(__x86_64__) || defined(__i386__)
return 64; /** @todo fixme */
#else
#error "Unsupported architecture"
return CACHELINE_SIZE;
#endif
}