Skip to content

Commit

Permalink
fdctl: log steps taken by configure
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcgee-jump committed Jun 11, 2024
1 parent 30b8f16 commit e244670
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion book/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ user = "firedancer"
]
```

::: note LEDGER
::: tip LEDGER

The Firedancer blockstore in the ledger directory is compatible with the
one for the Agave validator, and it is possible to switch between
Expand Down
4 changes: 2 additions & 2 deletions src/app/fdctl/config/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -569,10 +569,10 @@ dynamic_port_range = "8900-9000"
# A typical layout of the mounts looks as follows,
#
# /mnt/.fd [Mount parent directory specified below]
# +-- .gigantic [Files created in this mount use 1GB
# +-- .gigantic [Files created in this mount use 1GiB
# pages]
# +-- firedancer1.wksp
# +-- .huge [Files created in this mount use 4MB
# +-- .huge [Files created in this mount use 2MiB
# pages]
# +-- scratch1.wksp
# +-- scratch2.wksp
Expand Down
1 change: 1 addition & 0 deletions src/app/fdctl/configure/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ init_device( const char * device,
channels.combined_count = combined_channel_count;
channels.cmd = ETHTOOL_SCHANNELS;

FD_LOG_NOTICE(( "RUN: `ethtool --set-channels %s combined %u`", device, combined_channel_count ));
if( FD_UNLIKELY( ioctl( sock, SIOCETHTOOL, &ifr ) ) ) {
if( FD_LIKELY( errno == EBUSY ) )
FD_LOG_ERR(( "error configuring network device, ioctl(SIOCETHTOOL,ETHTOOL_SCHANNELS) failed (%i-%s). "
Expand Down
12 changes: 9 additions & 3 deletions src/app/fdctl/configure/hugetlbfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ static void
init_perm( fd_caps_ctx_t * caps,
config_t * const config ) {
(void)config;
fd_caps_check_root( caps, "hugetlbfs", "increase `/proc/sys/vm/nr_hugepages`, mount hugetblfs filesystem at `/mnt`" );
fd_caps_check_root( caps, "hugetlbfs", "increase `/proc/sys/vm/nr_hugepages` and mount hugetblfs filesystems" );
}

static void
Expand Down Expand Up @@ -76,8 +76,9 @@ init( config_t * const config ) {
char total_page_path[ PATH_MAX ];
FD_TEST( fd_cstr_printf_check( total_page_path, PATH_MAX, NULL, TOTAL_HUGE_PAGE_PATH[ j ], i ) );
ulong total_pages = read_uint_file( total_page_path, ERR_MSG );

ulong additional_pages_needed = required_pages[ j ]-free_pages;

FD_LOG_NOTICE(( "RUN: `echo \"%u\" > %s`", (uint)(total_pages+additional_pages_needed), total_page_path ));
write_uint_file( total_page_path, (uint)(total_pages+additional_pages_needed) );
if( FD_UNLIKELY( read_uint_file( total_page_path, ERR_MSG )<total_pages+additional_pages_needed ) )
FD_LOG_ERR(( "ENOMEM-Out of memory when trying to reserve %s pages for Firedancer on NUMA node %lu. Your Firedancer "
Expand Down Expand Up @@ -119,9 +120,11 @@ init( config_t * const config ) {
}

for( ulong i=0UL; i<2UL; i++ ) {
FD_LOG_NOTICE(( "RUN: `mkdir -p %s`", mount_path[ i ] ));
mkdir_all( mount_path[ i ], config->uid, config->gid );
char options[ 256 ];
FD_TEST( fd_cstr_printf_check( options, sizeof(options), NULL, "pagesize=%lu,min_size=%lu", PAGE_SIZE[ i ], min_size[ i ] ) );
FD_LOG_NOTICE(( "RUN: `mount -t hugetlbfs none %s -o %s`", mount_path[ i ], options ));
if( FD_UNLIKELY( mount( "none", mount_path[ i ], "hugetlbfs", 0, options) ) )
FD_LOG_ERR(( "mount of hugetlbfs at `%s` failed (%i-%s)", mount_path[ i ], errno, fd_io_strerror( errno ) ));
if( FD_UNLIKELY( chown( mount_path[ i ], config->uid, config->gid ) ) )
Expand Down Expand Up @@ -206,6 +209,7 @@ fini( config_t * const config,
while( FD_LIKELY( fgets( line, 4096UL, fp ) ) ) {
if( FD_UNLIKELY( strlen( line )==4095UL ) ) FD_LOG_ERR(( "line too long in `/proc/self/mounts`" ));
if( FD_UNLIKELY( strstr( line, mount_path[ i ] ) ) ) {
FD_LOG_NOTICE(( "RUN: `umount %s`", mount_path[ i ] ));
if( FD_UNLIKELY( umount( mount_path[ i ] ) ) ) {
if( FD_LIKELY( errno==EBUSY ) ) {
warn_mount_users( mount_path[ i ] );
Expand All @@ -226,10 +230,12 @@ fini( config_t * const config,
if( FD_LIKELY( fclose( fp ) ) )
FD_LOG_ERR(( "error closing `/proc/self/mounts` (%i-%s)", errno, fd_io_strerror( errno ) ));

FD_LOG_NOTICE(( "RUN: `rmdir %s`", mount_path[ i ] ));
if( FD_UNLIKELY( rmdir( mount_path[ i ] ) && errno!=ENOENT ) )
FD_LOG_ERR(( "error removing hugetlbfs mount at `%s` (%i-%s)", mount_path[ i ], errno, fd_io_strerror( errno ) ));
}

FD_LOG_NOTICE(( "RUN: `rmdir %s`", config->hugetlbfs.mount_path ));
if( FD_UNLIKELY( rmdir( config->hugetlbfs.mount_path ) && errno!=ENOENT ) )
FD_LOG_ERR(( "error removing hugetlbfs directory at `%s` (%i-%s)", config->hugetlbfs.mount_path, errno, fd_io_strerror( errno ) ));
}
Expand Down Expand Up @@ -344,7 +350,7 @@ check( config_t * const config ) {

char * _min_size = strtok_r( NULL, ",", &saveptr2 );
if( FD_UNLIKELY( !_min_size ) ) FD_LOG_ERR(( "error parsing `/proc/self/mounts`, line `%s`", line ));
if( FD_UNLIKELY( strncmp( "min_size=", _min_size, 9 ) ) ) {
if( FD_UNLIKELY( strncmp( "min_size=", _min_size, 9UL ) ) ) {
if( FD_UNLIKELY( fclose( fp ) ) )
FD_LOG_ERR(( "error closing `/proc/self/mounts` (%i-%s)", errno, fd_io_strerror( errno ) ));
PARTIALLY_CONFIGURED( "mount `%s` has unrecognized min_size, expected at least `min_size=%lu`", mount_path[ i ], required_min_size[ i ] );
Expand Down

0 comments on commit e244670

Please sign in to comment.