From 2c0dc9dfd04c8b91a65732a43d4675c5c76b79a4 Mon Sep 17 00:00:00 2001 From: Thomas Vegas Date: Wed, 28 Aug 2024 13:16:49 +0000 Subject: [PATCH] oshmem/shmem: Fix sshmem start address and warn if inside data region --- oshmem/mca/memheap/base/memheap_base_static.c | 9 +++++++++ oshmem/mca/sshmem/base/sshmem_base_open.c | 2 ++ 2 files changed, 11 insertions(+) diff --git a/oshmem/mca/memheap/base/memheap_base_static.c b/oshmem/mca/memheap/base/memheap_base_static.c index 12a05dcbecd..1b3819b87de 100644 --- a/oshmem/mca/memheap/base/memheap_base_static.c +++ b/oshmem/mca/memheap/base/memheap_base_static.c @@ -15,6 +15,7 @@ #include "oshmem/proc/proc.h" #include "oshmem/mca/memheap/memheap.h" #include "oshmem/mca/memheap/base/base.h" +#include "oshmem/mca/sshmem/base/base.h" #include "oshmem/util/oshmem_util.h" #include "opal/util/minmax.h" @@ -53,6 +54,14 @@ int mca_memheap_base_static_init(mca_memheap_map_t *map) return OSHMEM_ERROR; } +#ifdef __linux__ + extern unsigned _end; + if (mca_sshmem_base_start_address < (uintptr_t)&_end) { + MEMHEAP_WARN("sshmem base start address is inside data region" + " (%p < %p)", mca_sshmem_base_start_address, &_end); + } +#endif + while (NULL != fgets(line, sizeof(line), fp)) { if (3 > sscanf(line, "%llx-%llx %s %llx %s %llx %s", diff --git a/oshmem/mca/sshmem/base/sshmem_base_open.c b/oshmem/mca/sshmem/base/sshmem_base_open.c index b02f7e8aad1..4f8fe9832e3 100644 --- a/oshmem/mca/sshmem/base/sshmem_base_open.c +++ b/oshmem/mca/sshmem/base/sshmem_base_open.c @@ -37,6 +37,8 @@ */ #if UINTPTR_MAX == 0xFFFFFFFF void *mca_sshmem_base_start_address = (void*)0; +#elif defined(__aarch64__) +void* mca_sshmem_base_start_address = (void*)0xAB0000000000; #else void* mca_sshmem_base_start_address = (void*)0xFF000000; #endif