Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shmem: use unified mount path #1473

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/app/fdctl/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ static int parse_key_value( config_t * config,
ENTRY_UINT ( ., layout, bank_tile_count );
ENTRY_UINT ( ., layout, shred_tile_count );

ENTRY_STR ( ., hugetlbfs, gigantic_page_mount_path );
ENTRY_STR ( ., hugetlbfs, huge_page_mount_path );
ENTRY_STR ( ., hugetlbfs, mount_path );

ENTRY_STR ( ., tiles.net, interface );
ENTRY_STR ( ., tiles.net, xdp_mode );
Expand Down Expand Up @@ -921,6 +920,19 @@ config_parse( int * pargc,
if( FD_UNLIKELY( getgid() != 0 && config->gid != getgid() ) )
FD_LOG_ERR(( "running as gid %i, but config specifies gid %i", getgid(), config->gid ));

ulong len = strlen( config->hugetlbfs.mount_path );
anwayde marked this conversation as resolved.
Show resolved Hide resolved
if( FD_UNLIKELY( !len ) ) FD_LOG_ERR(( "[hugetlbfs.mount_path] must be non-empty in your configuration file" ));
FD_TEST( fd_cstr_printf_check( config->hugetlbfs.gigantic_page_mount_path,
sizeof(config->hugetlbfs.gigantic_page_mount_path),
NULL,
"%s/.gigantic",
config->hugetlbfs.mount_path ) );
FD_TEST( fd_cstr_printf_check( config->hugetlbfs.huge_page_mount_path,
sizeof(config->hugetlbfs.huge_page_mount_path),
NULL,
"%s/.huge",
config->hugetlbfs.mount_path ) );

replace( config->log.path, "{user}", config->user );
replace( config->log.path, "{name}", config->name );
if( FD_LIKELY( !strcmp( "auto", config->log.colorize ) ) ) config->log.colorize1 = 2;
Expand Down
1 change: 1 addition & 0 deletions src/app/fdctl/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ typedef struct {
struct {
char gigantic_page_mount_path[ PATH_MAX ];
char huge_page_mount_path[ PATH_MAX ];
char mount_path[ PATH_MAX ];
} hugetlbfs;

struct {
Expand Down
18 changes: 8 additions & 10 deletions src/app/fdctl/config/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -578,16 +578,14 @@ dynamic_port_range = "8900-9000"
# +-- scratch2.wksp
[hugetlbfs]
# The absolute path to a directory in the filesystem. Firedancer
# will mount the hugetlbfs filesystem for gigantic pages at this
# path, or if the path already exists, will use it as-is. If the
# mount already exists it should be writable by the Firedancer user.
gigantic_page_mount_path = "/mnt/.fd/.gigantic"

# The absolute path to a directory in the filesystem. Firedancer
# will mount the hugetlbfs filesystem for huge pages at this path,
# or if the path already exists, will use it as-is. If the mount
# already exists it should be writable by the Firedancer user.
huge_page_mount_path = "/mnt/.fd/.huge"
# will mount the hugetlbfs filesystem for gigantic pages at a
# subdirectory named .gigantic under this path, or if the entire
# path already exists, will use it as-is. Firedancer will also
# mount the hugetlbfs filesystem for huge pages at a subdirectory
# named .huge under this path, or if the entire path already exists,
# will use it as-is. If the mount already exists it should be
# writable by the Firedancer user.
mount_path = "/mnt/.fd"

# Tiles are described in detail in the layout section above. While the
# layout configuration determines how many of each tile to place on
Expand Down
10 changes: 9 additions & 1 deletion src/app/fdctl/main1.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ fdctl_boot( int * pargc,
strncpy( config->log.path, log_path, sizeof( config->log.path ) - 1 );
}

char * shmem_args[ 3 ];
/* pass in --shmem-path value from the config */
shmem_args[ 0 ] = "--shmem-path";
shmem_args[ 1 ] = config->hugetlbfs.mount_path;
shmem_args[ 2 ] = NULL;
char ** argv = shmem_args;
int argc = 2;

int * log_lock = map_log_memfd( config->log.lock_fd );
ulong pid = fd_sandbox_getpid(); /* Need to read /proc since we might be in a PID namespace now */;

Expand Down Expand Up @@ -199,7 +207,7 @@ fdctl_boot( int * pargc,
config->log.log_fd,
log_path );
config->log.log_fd = fd_log_private_logfile_fd();
fd_shmem_private_boot( pargc, pargv );;
fd_shmem_private_boot( &argc, &argv );
fd_tile_private_boot( 0, NULL );

/* Kind of a hack but initializing NUMA config depends on shmem, which
Expand Down