Skip to content

Commit

Permalink
oshmem/shmem: Fix sshmem start address and warn if inside data region
Browse files Browse the repository at this point in the history
  • Loading branch information
tvegas1 committed Aug 28, 2024
1 parent 247cfb6 commit 2c0dc9d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions oshmem/mca/memheap/base/memheap_base_static.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions oshmem/mca/sshmem/base/sshmem_base_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2c0dc9d

Please sign in to comment.