From 0740281fe1f22777a0e267be0ff36617daa1f0e9 Mon Sep 17 00:00:00 2001 From: Ishan Bhatt Date: Thu, 20 Nov 2025 20:56:44 +0000 Subject: [PATCH 1/2] firedancer: add tile memory coredump dumping option --- src/app/fdctl/config/default.toml | 8 + src/app/fdctl/topology.c | 90 +++---- src/app/firedancer-dev/commands/backtest.c | 68 +++--- .../firedancer-dev/commands/core_subtopo.h | 6 +- src/app/firedancer-dev/commands/gossip.c | 20 +- .../firedancer-dev/commands/ipecho_server.c | 2 +- src/app/firedancer-dev/commands/repair.c | 36 +-- .../commands/send_test/send_test.c | 16 +- src/app/firedancer-dev/commands/sim.c | 36 +-- .../firedancer-dev/commands/snapshot_load.c | 48 ++-- src/app/firedancer/config/default.toml | 8 + src/app/firedancer/topology.c | 220 +++++++++--------- src/app/shared/fd_config.h | 1 + src/app/shared/fd_config_parse.c | 1 + src/app/shared_dev/commands/bench/bench.c | 2 +- src/app/shared_dev/commands/bundle_client.c | 8 +- src/app/shared_dev/commands/pktgen/pktgen.c | 6 +- src/app/shared_dev/commands/udpecho/udpecho.c | 6 +- src/disco/net/fd_net_tile_topo.c | 12 +- src/disco/net/xdp/test_xdp_tile.c | 2 +- src/disco/pack/test_pack_tile.c | 2 +- src/disco/topo/fd_topo.c | 4 +- src/disco/topo/fd_topo.h | 2 + src/disco/topo/fd_topo_run.c | 2 +- src/disco/topo/fd_topob.c | 4 +- src/disco/topo/fd_topob.h | 3 +- src/disco/verify/test_verify_tile.c | 2 +- src/discof/replay/fd_replay_tile.c | 2 + src/groove/test_groove_data.c | 2 +- src/groove/test_groove_volume.c | 2 +- src/util/shmem/fd_shmem.h | 7 +- src/util/shmem/fd_shmem_user.c | 15 +- src/util/shmem/test_shmem.c | 8 +- src/util/wksp/fd_wksp_helper.c | 6 +- src/vinyl/data/test_vinyl_data.c | 2 +- src/vinyl/fd_vinyl_ctl.c | 2 +- 36 files changed, 343 insertions(+), 318 deletions(-) diff --git a/src/app/fdctl/config/default.toml b/src/app/fdctl/config/default.toml index 68e432bf467..f39d2512d8c 100644 --- a/src/app/fdctl/config/default.toml +++ b/src/app/fdctl/config/default.toml @@ -1494,6 +1494,14 @@ dynamic_port_range = "8900-9000" # enabled during routine running of the validator. core_dump = false + # By default, if core_dump is set to true, the workspace memory is + # not included in the dump. This is done via a call to + # madvise( shmem, sz, MADV_DONTDUMP ) which effectively sets it so + # the shared memory region that corresponds to the wksp's memory is + # not included in the dump. This flag is currently a no-op in the + # Frankedancer validator. + dump_wksp_mem = false + # Firedancer currently hosts a Agave client as a child process # when it starts up, to provide functionality that has not yet been # implemented. For development sometimes it is desirable to not diff --git a/src/app/fdctl/topology.c b/src/app/fdctl/topology.c index b10ba36f896..e9ea1ed393a 100644 --- a/src/app/fdctl/topology.c +++ b/src/app/fdctl/topology.c @@ -47,40 +47,40 @@ fd_topo_initialize( config_t * config ) { topo->max_page_size = fd_cstr_to_shmem_page_sz( config->hugetlbfs.max_page_size ); topo->gigantic_page_threshold = config->hugetlbfs.gigantic_page_threshold_mib << 20; - /* topo, name */ - fd_topob_wksp( topo, "metric_in" ); - fd_topob_wksp( topo, "net_quic" ); - fd_topob_wksp( topo, "net_shred" ); - fd_topob_wksp( topo, "quic_verify" ); - fd_topob_wksp( topo, "verify_dedup" ); - fd_topob_wksp( topo, "dedup_resolv" ); - fd_topob_wksp( topo, "resolv_pack" ); - fd_topob_wksp( topo, "pack_bank" ); - fd_topob_wksp( topo, "pack_poh" ); - fd_topob_wksp( topo, "bank_pack" ); - fd_topob_wksp( topo, "bank_poh" ); - fd_topob_wksp( topo, "bank_busy" ); - fd_topob_wksp( topo, "poh_shred" ); - fd_topob_wksp( topo, "gossip_dedup" ); - fd_topob_wksp( topo, "shred_store" ); - fd_topob_wksp( topo, "stake_out" ); - fd_topob_wksp( topo, "executed_txn" ); - - fd_topob_wksp( topo, "shred_sign" ); - fd_topob_wksp( topo, "sign_shred" ); - - fd_topob_wksp( topo, "quic" ); - fd_topob_wksp( topo, "verify" ); - fd_topob_wksp( topo, "dedup" ); - fd_topob_wksp( topo, "resolv" ); - fd_topob_wksp( topo, "pack" ); - fd_topob_wksp( topo, "bank" ); - fd_topob_wksp( topo, "poh" ); - fd_topob_wksp( topo, "shred" ); - fd_topob_wksp( topo, "store" ); - fd_topob_wksp( topo, "sign" ); - fd_topob_wksp( topo, "metric" ); - fd_topob_wksp( topo, "cswtch" ); + /* topo, name, dumpable */ + fd_topob_wksp( topo, "metric_in", 0 ); + fd_topob_wksp( topo, "net_quic", 0 ); + fd_topob_wksp( topo, "net_shred", 0 ); + fd_topob_wksp( topo, "quic_verify", 0 ); + fd_topob_wksp( topo, "verify_dedup", 0 ); + fd_topob_wksp( topo, "dedup_resolv", 0 ); + fd_topob_wksp( topo, "resolv_pack", 0 ); + fd_topob_wksp( topo, "pack_bank", 0 ); + fd_topob_wksp( topo, "pack_poh", 0 ); + fd_topob_wksp( topo, "bank_pack", 0 ); + fd_topob_wksp( topo, "bank_poh", 0 ); + fd_topob_wksp( topo, "bank_busy", 0 ); + fd_topob_wksp( topo, "poh_shred", 0 ); + fd_topob_wksp( topo, "gossip_dedup", 0 ); + fd_topob_wksp( topo, "shred_store", 0 ); + fd_topob_wksp( topo, "stake_out", 0 ); + fd_topob_wksp( topo, "executed_txn", 0 ); + + fd_topob_wksp( topo, "shred_sign", 0 ); + fd_topob_wksp( topo, "sign_shred", 0 ); + + fd_topob_wksp( topo, "quic", 0 ); + fd_topob_wksp( topo, "verify", 0 ); + fd_topob_wksp( topo, "dedup", 0 ); + fd_topob_wksp( topo, "resolv", 0 ); + fd_topob_wksp( topo, "pack", 0 ); + fd_topob_wksp( topo, "bank", 0 ); + fd_topob_wksp( topo, "poh", 0 ); + fd_topob_wksp( topo, "shred", 0 ); + fd_topob_wksp( topo, "store", 0 ); + fd_topob_wksp( topo, "sign", 0 ); + fd_topob_wksp( topo, "metric", 0 ); + fd_topob_wksp( topo, "cswtch", 0 ); #define FOR(cnt) for( ulong i=0UL; itiles.gui.enabled; if( FD_LIKELY( plugins_enabled ) ) { - fd_topob_wksp( topo, "plugin_in" ); - fd_topob_wksp( topo, "plugin_out" ); - fd_topob_wksp( topo, "plugin" ); + fd_topob_wksp( topo, "plugin_in", 0 ); + fd_topob_wksp( topo, "plugin_out", 0 ); + fd_topob_wksp( topo, "plugin", 0 ); /**/ fd_topob_link( topo, "plugin_out", "plugin_out", 128UL, 8UL+40200UL*(58UL+12UL*34UL), 1UL ); /**/ fd_topob_link( topo, "replay_plugi", "plugin_in", 128UL, 4098*8UL, 1UL ); @@ -270,7 +270,7 @@ fd_topo_initialize( config_t * config ) { } if( FD_LIKELY( config->tiles.gui.enabled ) ) { - fd_topob_wksp( topo, "gui" ); + fd_topob_wksp( topo, "gui", 0 ); /**/ fd_topob_tile( topo, "gui", "gui", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 ); /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "plugin_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED ); /**/ fd_topob_tile_in( topo, "gui", 0UL, "metric_in", "poh_pack", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED ); @@ -280,12 +280,12 @@ fd_topo_initialize( config_t * config ) { } if( FD_UNLIKELY( config->tiles.bundle.enabled ) ) { - fd_topob_wksp( topo, "bundle_verif" ); - fd_topob_wksp( topo, "bundle_sign" ); - fd_topob_wksp( topo, "sign_bundle" ); - fd_topob_wksp( topo, "pack_sign" ); - fd_topob_wksp( topo, "sign_pack" ); - fd_topob_wksp( topo, "bundle" ); + fd_topob_wksp( topo, "bundle_verif", 0 ); + fd_topob_wksp( topo, "bundle_sign", 0 ); + fd_topob_wksp( topo, "sign_bundle", 0 ); + fd_topob_wksp( topo, "pack_sign", 0 ); + fd_topob_wksp( topo, "sign_pack", 0 ); + fd_topob_wksp( topo, "bundle", 0 ); /**/ fd_topob_link( topo, "bundle_verif", "bundle_verif", config->tiles.verify.receive_buffer_size, FD_TPU_PARSED_MTU, 1UL ); /**/ fd_topob_link( topo, "bundle_sign", "bundle_sign", 65536UL, 9UL, 1UL ); @@ -309,7 +309,7 @@ fd_topo_initialize( config_t * config ) { /**/ fd_topob_tile_out( topo, "sign", 0UL, "sign_pack", 0UL ); if( plugins_enabled ) { - fd_topob_wksp( topo, "bundle_plugi" ); + fd_topob_wksp( topo, "bundle_plugi", 0 ); /* bundle_plugi must be kind of deep, to prevent exhausting shared flow control credits when publishing many packets at once. */ fd_topob_link( topo, "bundle_plugi", "bundle_plugi", 65536UL, sizeof(fd_plugin_msg_block_engine_update_t), 1UL ); diff --git a/src/app/firedancer-dev/commands/backtest.c b/src/app/firedancer-dev/commands/backtest.c index 559a5be68d0..7a9dab26695 100644 --- a/src/app/firedancer-dev/commands/backtest.c +++ b/src/app/firedancer-dev/commands/backtest.c @@ -60,30 +60,30 @@ backtest_topo( config_t * config ) { ulong cpu_idx = 0; - fd_topob_wksp( topo, "metric_in" ); + fd_topob_wksp( topo, "metric_in", 0 ); /**********************************************************************/ /* Add the backtest tile to topo */ /**********************************************************************/ - fd_topob_wksp( topo, "backt" ); + fd_topob_wksp( topo, "backt", 0 ); fd_topo_tile_t * backt_tile = fd_topob_tile( topo, "backt", "backt", "metric_in", cpu_idx++, 0, 0 ); /**********************************************************************/ /* Add the replay tile to topo */ /**********************************************************************/ - fd_topob_wksp( topo, "replay" ); + fd_topob_wksp( topo, "replay", 0 ); fd_topo_tile_t * replay_tile = fd_topob_tile( topo, "replay", "replay", "metric_in", cpu_idx++, 0, 0 ); /* specified by [tiles.replay] */ - fd_topob_wksp( topo, "funk" ); + fd_topob_wksp( topo, "funk", 0 ); fd_topo_obj_t * funk_obj = setup_topo_funk( topo, "funk", config->firedancer.funk.max_account_records, config->firedancer.funk.max_database_transactions, config->firedancer.funk.heap_size_gib ); fd_topob_tile_uses( topo, replay_tile, funk_obj, FD_SHMEM_JOIN_MODE_READ_WRITE ); - fd_topob_wksp( topo, "progcache" ); + fd_topob_wksp( topo, "progcache", 0 ); fd_topo_obj_t * progcache_obj = setup_topo_progcache( topo, "progcache", fd_progcache_est_rec_max( config->firedancer.runtime.program_cache.heap_size_mib<<20, config->firedancer.runtime.program_cache.mean_cache_entry_size ), @@ -98,7 +98,7 @@ backtest_topo( config_t * config ) { /**********************************************************************/ /* Add the executor tiles to topo */ /**********************************************************************/ - fd_topob_wksp( topo, "exec" ); + fd_topob_wksp( topo, "exec", 0 ); #define FOR(cnt) for( ulong i=0UL; iallow_shutdown = 1; snapin_tile->allow_shutdown = 1; } else { - fd_topob_wksp( topo, "genesi" ); + fd_topob_wksp( topo, "genesi", 0 ); fd_topob_tile( topo, "genesi", "genesi", "metric_in", cpu_idx++, 0, 0 )->allow_shutdown = 1; } @@ -143,7 +143,7 @@ backtest_topo( config_t * config ) { which is provided by the backtest tile, which reads in the entry batches from the CLI-specified source (eg. RocksDB). */ - fd_topob_wksp( topo, "shred_out" ); + fd_topob_wksp( topo, "shred_out", 0 ); fd_topob_link( topo, "shred_out", "shred_out", 65536UL, FD_SHRED_OUT_MTU, 1UL ); fd_topob_tile_in( topo, "replay", 0UL, "metric_in", "shred_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED ); fd_topob_tile_out( topo, "backt", 0UL, "shred_out", 0UL ); @@ -152,21 +152,21 @@ backtest_topo( config_t * config ) { /* Setup snapshot links in topo */ /**********************************************************************/ if( FD_LIKELY( !disable_snap_loader ) ) { - fd_topob_wksp( topo, "snapct_ld" ); - fd_topob_wksp( topo, "snapld_dc" ); - fd_topob_wksp( topo, "snapdc_in" ); + fd_topob_wksp( topo, "snapct_ld", 0 ); + fd_topob_wksp( topo, "snapld_dc", 0 ); + fd_topob_wksp( topo, "snapdc_in", 0 ); if( FD_UNLIKELY( snapshot_lthash_disabled ) ) { - fd_topob_wksp( topo, "snapin_ct" ); + fd_topob_wksp( topo, "snapin_ct", 0 ); } else { - fd_topob_wksp( topo, "snapls_ct" ); + fd_topob_wksp( topo, "snapls_ct", 0 ); } - fd_topob_wksp( topo, "snapin_manif" ); - fd_topob_wksp( topo, "snapct_repr" ); + fd_topob_wksp( topo, "snapin_manif", 0 ); + fd_topob_wksp( topo, "snapct_repr", 0 ); if( FD_LIKELY( !snapshot_lthash_disabled ) ) { - fd_topob_wksp( topo, "snapla_ls" ); - fd_topob_wksp( topo, "snapin_ls" ); + fd_topob_wksp( topo, "snapla_ls", 0 ); + fd_topob_wksp( topo, "snapin_ls", 0 ); } fd_topob_link( topo, "snapct_ld", "snapct_ld", 128UL, sizeof(fd_ssctrl_init_t), 1UL ); @@ -214,7 +214,7 @@ backtest_topo( config_t * config ) { /**/ fd_topob_tile_out( topo, "snapls", 0UL, "snapls_ct", 0UL ); } } else { - fd_topob_wksp( topo, "genesi_out" ); + fd_topob_wksp( topo, "genesi_out", 0 ); fd_topob_link( topo, "genesi_out", "genesi_out", 2UL, 10UL*1024UL*1024UL+32UL+sizeof(fd_lthash_value_t), 1UL ); fd_topob_tile_out( topo, "genesi", 0UL, "genesi_out", 0UL ); fd_topob_tile_in ( topo, "replay", 0UL, "metric_in", "genesi_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED ); @@ -231,7 +231,7 @@ backtest_topo( config_t * config ) { This allows the replay tile to advance its watermark, and publish various data structures. This is an oversimplified barebones mock of the tower tile. */ - fd_topob_wksp( topo, "tower_out" ); + fd_topob_wksp( topo, "tower_out", 0 ); fd_topob_link( topo, "tower_out", "tower_out", 1024UL, sizeof(fd_tower_slot_done_t), 1UL ); fd_topob_tile_in( topo, "replay", 0UL, "metric_in", "tower_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED ); fd_topob_tile_out( topo, "backt", 0UL, "tower_out", 0UL ); @@ -239,8 +239,8 @@ backtest_topo( config_t * config ) { /**********************************************************************/ /* Setup replay->stake/send/poh links in topo w/o consumers */ /**********************************************************************/ - fd_topob_wksp( topo, "replay_stake" ); - fd_topob_wksp( topo, "replay_poh" ); + fd_topob_wksp( topo, "replay_stake", 0 ); + fd_topob_wksp( topo, "replay_poh", 0 ); fd_topob_link( topo, "replay_stake", "replay_stake", 128UL, 40UL + 40200UL * 40UL, 1UL ); ulong bank_tile_cnt = config->layout.bank_tile_count; @@ -256,7 +256,7 @@ backtest_topo( config_t * config ) { /* Setup replay->backtest link (replay_notif) in topo */ /**********************************************************************/ - fd_topob_wksp( topo, "replay_out" ); + fd_topob_wksp( topo, "replay_out", 0 ); fd_topob_link( topo, "replay_out", "replay_out", 8192UL, sizeof( fd_replay_message_t ), 1UL ); fd_topob_tile_out( topo, "replay", 0UL, "replay_out", 0UL ); fd_topob_tile_in ( topo, "backt", 0UL, "metric_in", "replay_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED ); @@ -269,7 +269,7 @@ backtest_topo( config_t * config ) { /**********************************************************************/ /* Setup replay->exec link in topo */ /**********************************************************************/ - fd_topob_wksp( topo, "replay_exec" ); + fd_topob_wksp( topo, "replay_exec", 0 ); fd_topob_link( topo, "replay_exec", "replay_exec", 16384UL, 2240UL, 1UL ); fd_topob_tile_out( topo, "replay", 0UL, "replay_exec", 0UL ); for( ulong i=0UL; ifiredancer.store.max_completed_shred_sets, 1 ); fd_topob_tile_uses( topo, backt_tile, store_obj, FD_SHMEM_JOIN_MODE_READ_WRITE ); fd_topob_tile_uses( topo, replay_tile, store_obj, FD_SHMEM_JOIN_MODE_READ_WRITE ); FD_TEST( fd_pod_insertf_ulong( topo->props, store_obj->id, "store" ) ); /* banks_obj shared by replay and exec tiles */ - fd_topob_wksp( topo, "banks" ); + fd_topob_wksp( topo, "banks", 0 ); fd_topo_obj_t * banks_obj = setup_topo_banks( topo, "banks", config->firedancer.runtime.max_live_slots, config->firedancer.runtime.max_fork_width, 0 ); fd_topob_tile_uses( topo, replay_tile, banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE ); FOR(exec_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "exec", i ) ], banks_obj, FD_SHMEM_JOIN_MODE_READ_WRITE ); FD_TEST( fd_pod_insertf_ulong( topo->props, banks_obj->id, "banks" ) ); /* txncache_obj, busy_obj and poh_slot_obj only by replay tile */ - fd_topob_wksp( topo, "txncache" ); - fd_topob_wksp( topo, "bank_busy" ); + fd_topob_wksp( topo, "txncache", 0 ); + fd_topob_wksp( topo, "bank_busy", 0 ); fd_topo_obj_t * txncache_obj = setup_topo_txncache( topo, "txncache", config->firedancer.runtime.max_live_slots, fd_ulong_pow2_up( FD_PACK_MAX_TXNCACHE_TXN_PER_SLOT ) ); diff --git a/src/app/firedancer-dev/commands/core_subtopo.h b/src/app/firedancer-dev/commands/core_subtopo.h index 9d4bc9e3c6b..dc1d5a438d0 100644 --- a/src/app/firedancer-dev/commands/core_subtopo.h +++ b/src/app/firedancer-dev/commands/core_subtopo.h @@ -27,8 +27,8 @@ fd_core_subtopo( config_t * config, ulong tile_to_cpu[ FD_TILE_MAX ] ) { ulong net_tile_cnt = config->layout.net_tile_count; ulong sign_tile_cnt = config->firedancer.layout.sign_tile_count; - fd_topob_wksp( topo, "metric" ); - fd_topob_wksp( topo, "metric_in" ); + fd_topob_wksp( topo, "metric", 0 ); + fd_topob_wksp( topo, "metric_in", 0 ); fd_topo_tile_t * metric_tile = fd_topob_tile( topo, "metric", "metric", "metric_in", ULONG_MAX, 0, 0 ); if( FD_UNLIKELY( !fd_cstr_to_ip4_addr( config->tiles.metric.prometheus_listen_address, &metric_tile->metric.prometheus_listen_addr ) ) ) FD_LOG_ERR(( "failed to parse prometheus listen address `%s`", config->tiles.metric.prometheus_listen_address )); @@ -43,7 +43,7 @@ fd_core_subtopo( config_t * config, ulong tile_to_cpu[ FD_TILE_MAX ] ) { net_tile->net.gossip_listen_port = config->gossip.port; } - fd_topob_wksp( topo, "sign" ); + fd_topob_wksp( topo, "sign", 0 ); for( ulong i=0UL; itile_cnt ], 0, 1 ); strncpy( sign_tile->sign.identity_key_path, config->paths.identity_key, sizeof(sign_tile->sign.identity_key_path) ); diff --git a/src/app/firedancer-dev/commands/gossip.c b/src/app/firedancer-dev/commands/gossip.c index 0994792f8bc..8808de6bb79 100644 --- a/src/app/firedancer-dev/commands/gossip.c +++ b/src/app/firedancer-dev/commands/gossip.c @@ -66,7 +66,7 @@ fd_gossip_subtopo( config_t * config, ulong tile_to_cpu[ FD_TILE_MAX ] FD_PARAM_ }; for( int i=0; i<3; ++i) FD_TEST( fd_topo_find_tile( topo, tiles_to_add[i], 0UL ) == ULONG_MAX ); - fd_topob_wksp( topo, "gossip" ); + fd_topob_wksp( topo, "gossip", 0 ); fd_topo_tile_t * gossip_tile = fd_topob_tile( topo, "gossip", "gossip", "metric_in", 0UL, 0, 1 /* uses_keyswitch */ ); strncpy( gossip_tile->gossip.identity_key_path, config->paths.identity_key, sizeof(gossip_tile->gossip.identity_key_path) ); gossip_tile->gossip.entrypoints_cnt = config->gossip.entrypoints_cnt; @@ -84,7 +84,7 @@ fd_gossip_subtopo( config_t * config, ulong tile_to_cpu[ FD_TILE_MAX ] FD_PARAM_ gossip_tile->gossip.ports.tvu_quic = 0; gossip_tile->gossip.boot_timestamp_nanos = config->boot_timestamp_nanos; - fd_topob_wksp( topo, "gossvf" ); + fd_topob_wksp( topo, "gossvf", 0 ); for( ulong i=0UL; igossvf.identity_key_path, config->paths.identity_key, sizeof(gossvf_tile->gossvf.identity_key_path) ); @@ -106,12 +106,12 @@ fd_gossip_subtopo( config_t * config, ulong tile_to_cpu[ FD_TILE_MAX ] FD_PARAM_ } } - fd_topob_wksp( topo, "gossip_net" ); + fd_topob_wksp( topo, "gossip_net", 0 ); fd_topob_link( topo, "gossip_net", "gossip_net", 65536*4UL, FD_NET_MTU, 1UL ); fd_topos_tile_in_net( topo, "metric_in", "gossip_net", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); fd_topob_tile_out( topo, "gossip", 0UL, "gossip_net", 0UL ); - fd_topob_wksp( topo, "ipecho" ); + fd_topob_wksp( topo, "ipecho", 0 ); fd_topo_tile_t * ipecho_tile = fd_topob_tile( topo, "ipecho", "ipecho", "metric_in", 0UL, 0, 0 ); ipecho_tile->ipecho.expected_shred_version = config->consensus.expected_shred_version; ipecho_tile->ipecho.bind_address = config->net.ip_addr; @@ -121,7 +121,7 @@ fd_gossip_subtopo( config_t * config, ulong tile_to_cpu[ FD_TILE_MAX ] FD_PARAM_ ipecho_tile->ipecho.entrypoints[ i ] = config->gossip.resolved_entrypoints[ i ]; } - fd_topob_wksp( topo, "ipecho_out" ); + fd_topob_wksp( topo, "ipecho_out", 0 ); fd_topob_link( topo, "ipecho_out", "ipecho_out", 4UL, 0UL, 1UL ); fd_topob_tile_out( topo, "ipecho", 0UL, "ipecho_out", 0UL ); @@ -130,9 +130,9 @@ fd_gossip_subtopo( config_t * config, ulong tile_to_cpu[ FD_TILE_MAX ] FD_PARAM_ } fd_topob_tile_in( topo, "gossip", 0UL, "metric_in", "ipecho_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED ); - fd_topob_wksp( topo, "gossvf_gossi" ); - fd_topob_wksp( topo, "gossip_gossv" ); - fd_topob_wksp( topo, "gossip_out" ); + fd_topob_wksp( topo, "gossvf_gossi", 0 ); + fd_topob_wksp( topo, "gossip_gossv", 0 ); + fd_topob_wksp( topo, "gossip_out", 0 ); fd_topob_link( topo, "gossip_gossv", "gossip_gossv", 65536UL*4, sizeof(fd_gossip_ping_update_t), 1UL ); fd_topob_tile_out( topo, "gossip", 0UL, "gossip_gossv", 0UL ); @@ -149,10 +149,10 @@ fd_gossip_subtopo( config_t * config, ulong tile_to_cpu[ FD_TILE_MAX ] FD_PARAM_ fd_topob_tile_in( topo, "gossvf", i, "metric_in", "gossip_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED ); } - fd_topob_wksp( topo, "gossip_sign" ); + fd_topob_wksp( topo, "gossip_sign", 0 ); fd_topob_link( topo, "gossip_sign", "gossip_sign", 128UL, 2048UL, 1UL ); fd_topob_tile_in( topo, "sign", 0UL, "metric_in", "gossip_sign", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED ); - fd_topob_wksp( topo, "sign_gossip" ); + fd_topob_wksp( topo, "sign_gossip", 0 ); fd_topob_link( topo, "sign_gossip", "sign_gossip", 128UL, 64UL, 1UL ); fd_topob_tile_out( topo, "sign", 0UL, "sign_gossip", 0UL ); fd_topob_tile_out( topo, "gossip", 0UL, "gossip_sign", 0UL ); diff --git a/src/app/firedancer-dev/commands/ipecho_server.c b/src/app/firedancer-dev/commands/ipecho_server.c index 2f00ea2fd5e..7c28dd4f05e 100644 --- a/src/app/firedancer-dev/commands/ipecho_server.c +++ b/src/app/firedancer-dev/commands/ipecho_server.c @@ -21,7 +21,7 @@ ipecho_topo( fd_topo_t * topo, fd_topob_new( topo, name ); topo->max_page_size = 1UL<<21UL; - fd_topob_wksp( topo, "all" ); + fd_topob_wksp( topo, "all", 0 ); fd_topo_link_t * link = fd_topob_link( topo, "ipecho_out", "all", 4UL, 0UL, 1UL ); link->permit_no_consumers = 1; fd_topo_tile_t * tile = fd_topob_tile( topo, "ipecho", "all", "all", 0UL, 0, 0 ); diff --git a/src/app/firedancer-dev/commands/repair.c b/src/app/firedancer-dev/commands/repair.c index 3f888ef254f..30b0ac0fe23 100644 --- a/src/app/firedancer-dev/commands/repair.c +++ b/src/app/firedancer-dev/commands/repair.c @@ -109,30 +109,30 @@ repair_topo( config_t * config ) { fd_gossip_subtopo( config, tile_to_cpu ); /* topo, name */ - fd_topob_wksp( topo, "net_shred" ); - fd_topob_wksp( topo, "net_repair" ); - fd_topob_wksp( topo, "net_quic" ); + fd_topob_wksp( topo, "net_shred", 0 ); + fd_topob_wksp( topo, "net_repair", 0 ); + fd_topob_wksp( topo, "net_quic", 0 ); - fd_topob_wksp( topo, "shred_out" ); - fd_topob_wksp( topo, "replay_stake" ); + fd_topob_wksp( topo, "shred_out", 0 ); + fd_topob_wksp( topo, "replay_stake", 0 ); - fd_topob_wksp( topo, "poh_shred" ); + fd_topob_wksp( topo, "poh_shred", 0 ); - fd_topob_wksp( topo, "shred_sign" ); - fd_topob_wksp( topo, "sign_shred" ); + fd_topob_wksp( topo, "shred_sign", 0 ); + fd_topob_wksp( topo, "sign_shred", 0 ); - fd_topob_wksp( topo, "repair_sign" ); - fd_topob_wksp( topo, "sign_repair" ); + fd_topob_wksp( topo, "repair_sign", 0 ); + fd_topob_wksp( topo, "sign_repair", 0 ); - fd_topob_wksp( topo, "send_out" ); + fd_topob_wksp( topo, "send_out", 0 ); - fd_topob_wksp( topo, "shred" ); - fd_topob_wksp( topo, "repair" ); - fd_topob_wksp( topo, "fec_sets" ); - fd_topob_wksp( topo, "snapin_manif" ); + fd_topob_wksp( topo, "shred", 0 ); + fd_topob_wksp( topo, "repair", 0 ); + fd_topob_wksp( topo, "fec_sets", 0 ); + fd_topob_wksp( topo, "snapin_manif", 0 ); - fd_topob_wksp( topo, "slot_fseqs" ); /* fseqs for marked slots eg. turbine slot */ - fd_topob_wksp( topo, "genesi_out" ); /* mock genesi_out for ipecho */ + fd_topob_wksp( topo, "slot_fseqs", 0 ); /* fseqs for marked slots eg. turbine slot */ + fd_topob_wksp( topo, "genesi_out", 0 ); /* mock genesi_out for ipecho */ #define FOR(cnt) for( ulong i=0UL; itile_cnt ], 0, 0 ); diff --git a/src/app/firedancer-dev/commands/send_test/send_test.c b/src/app/firedancer-dev/commands/send_test/send_test.c index f1a0b83c83d..204e898282d 100644 --- a/src/app/firedancer-dev/commands/send_test/send_test.c +++ b/src/app/firedancer-dev/commands/send_test/send_test.c @@ -81,13 +81,13 @@ send_test_topo( config_t * config ) { #define FOR(cnt) for( ulong i=0UL; itile_cnt ], 0, 0 ); /* wksps for send links */ - fd_topob_wksp( topo, "send_net" ); - fd_topob_wksp( topo, "sign_send" ); - fd_topob_wksp( topo, "send_sign" ); + fd_topob_wksp( topo, "send_net", 0 ); + fd_topob_wksp( topo, "sign_send", 0 ); + fd_topob_wksp( topo, "send_sign", 0 ); /* real links for send */ FOR(net_tile_cnt) fd_topos_net_rx_link( topo, "net_send", i, ingress_buf_sz ); @@ -98,10 +98,10 @@ send_test_topo( config_t * config ) { /* mock links */ /* braces shut up clang's 'misleading identation' warning */ - if( !use_live_gossip ) {fd_topob_wksp( topo, "gossip_out" ); } - /**/ fd_topob_wksp( topo, "replay_stake" ); - /**/ fd_topob_wksp( topo, "tower_out" ); - /**/ fd_topob_wksp( topo, "send_out" ); + if( !use_live_gossip ) {fd_topob_wksp( topo, "gossip_out", 0 ); } + /**/ fd_topob_wksp( topo, "replay_stake", 0 ); + /**/ fd_topob_wksp( topo, "tower_out", 0 ); + /**/ fd_topob_wksp( topo, "send_out", 0 ); if( !use_live_gossip ) {fd_topob_link( topo, "gossip_out", "gossip_out", 65536UL*4UL, sizeof(fd_gossip_update_message_t), 1UL ); } /**/ fd_topob_link( topo, "replay_stake", "replay_stake", 128UL, FD_STAKE_OUT_MTU, 1UL ); diff --git a/src/app/firedancer-dev/commands/sim.c b/src/app/firedancer-dev/commands/sim.c index 4338bb1dece..4bf78ea3782 100644 --- a/src/app/firedancer-dev/commands/sim.c +++ b/src/app/firedancer-dev/commands/sim.c @@ -47,33 +47,33 @@ sim_topo( config_t * config ) { static_end_idx, }; - fd_topob_wksp( topo, "metric" ); - fd_topob_wksp( topo, "metric_in" ); + fd_topob_wksp( topo, "metric", 0 ); + fd_topob_wksp( topo, "metric_in", 0 ); fd_topob_tile( topo, "metric", "metric", "metric_in", metric_cpu_idx, 0, 0 ); - fd_topob_wksp( topo, "playback" ); + fd_topob_wksp( topo, "playback", 0 ); fd_topob_tile( topo, "arch_p", "playback", "metric_in", playback_cpu_idx, 0, 0 ); - fd_topob_wksp( topo, "storei" ); + fd_topob_wksp( topo, "storei", 0 ); fd_topo_tile_t * storei_tile = fd_topob_tile( topo, "storei", "storei", "metric_in", storei_cpu_idx, 0, 0 ); - fd_topob_wksp( topo, "replay" ); + fd_topob_wksp( topo, "replay", 0 ); fd_topo_tile_t * replay_tile = fd_topob_tile( topo, "replay", "replay", "metric_in", replay_cpu_idx, 0, 0 ); #define FOR(cnt) for( ulong i=0UL; ifiredancer.layout.exec_tile_count; FOR(exec_tile_cnt) fd_topob_tile( topo, "exec", "exec", "metric_in", static_end_idx+i, 0, 0 ); /**********************************************************************/ /* Setup playback<->storei and storei<->replay links in topo */ /**********************************************************************/ - fd_topob_wksp( topo, "shred_storei" ); - fd_topob_wksp( topo, "repair_store" ); - fd_topob_wksp( topo, "storei_notif" ); - fd_topob_wksp( topo, "replay_stake" ); - fd_topob_wksp( topo, "store_replay" ); + fd_topob_wksp( topo, "shred_storei", 0 ); + fd_topob_wksp( topo, "repair_store", 0 ); + fd_topob_wksp( topo, "storei_notif", 0 ); + fd_topob_wksp( topo, "replay_stake", 0 ); + fd_topob_wksp( topo, "store_replay", 0 ); /* topo, link_name, wksp_name, depth, mtu, burst */ fd_topob_link( topo, "shred_storei", "shred_storei", 65536UL, 4UL*FD_SHRED_STORE_MTU, 4UL+config->tiles.shred.max_pending_shred_sets ); fd_topob_link( topo, "repair_store", "repair_store", 1024UL*1024UL, FD_SHRED_MAX_SZ, 128UL ); @@ -104,7 +104,7 @@ sim_topo( config_t * config ) { /**********************************************************************/ /* Setup replay-->exec links in topo */ /**********************************************************************/ - fd_topob_wksp( topo, "replay_exec" ); + fd_topob_wksp( topo, "replay_exec", 0 ); fd_topob_link( topo, "replay_exec", "replay_exec", 16384UL, 2240UL, 1UL ); fd_topob_tile_out( topo, "replay", 0UL, "replay_exec", 0UL ); for( ulong i=0; ifiredancer.layout.exec_tile_count; i++ ) { @@ -114,12 +114,12 @@ sim_topo( config_t * config ) { /**********************************************************************/ /* Setup the shared objs used by storei, replay and exec tiles */ /**********************************************************************/ - fd_topob_wksp( topo, "bstore" ); - fd_topob_wksp( topo, "poh_shred" ); - fd_topob_wksp( topo, "root_slot" ); - fd_topob_wksp( topo, "txncache" ); - fd_topob_wksp( topo, "poh_slot" ); - fd_topob_wksp( topo, "bank_busy" ); + fd_topob_wksp( topo, "bstore", 0 ); + fd_topob_wksp( topo, "poh_shred", 0 ); + fd_topob_wksp( topo, "root_slot", 0 ); + fd_topob_wksp( topo, "txncache", 0 ); + fd_topob_wksp( topo, "poh_slot", 0 ); + fd_topob_wksp( topo, "bank_busy", 0 ); fd_topo_obj_t * poh_shred_obj = fd_topob_obj( topo, "fseq", "poh_shred" ); fd_topo_obj_t * root_slot_obj = fd_topob_obj( topo, "fseq", "root_slot" ); fd_topo_obj_t * txncache_obj = setup_topo_txncache( topo, "txncache", diff --git a/src/app/firedancer-dev/commands/snapshot_load.c b/src/app/firedancer-dev/commands/snapshot_load.c index 492f9636d8d..a575763b623 100644 --- a/src/app/firedancer-dev/commands/snapshot_load.c +++ b/src/app/firedancer-dev/commands/snapshot_load.c @@ -37,13 +37,13 @@ snapshot_load_topo( config_t * config, fd_topob_new( &config->topo, config->name ); topo->max_page_size = fd_cstr_to_shmem_page_sz( config->hugetlbfs.max_page_size ); - fd_topob_wksp( topo, "txncache" ); + fd_topob_wksp( topo, "txncache", 0 ); fd_topo_obj_t * txncache_obj = setup_topo_txncache( topo, "txncache", config->firedancer.runtime.max_live_slots, fd_ulong_pow2_up( FD_PACK_MAX_TXNCACHE_TXN_PER_SLOT ) ); FD_TEST( fd_pod_insertf_ulong( topo->props, txncache_obj->id, "txncache" ) ); - fd_topob_wksp( topo, "funk" ); + fd_topob_wksp( topo, "funk", 0 ); fd_topo_obj_t * funk_obj = setup_topo_funk( topo, "funk", config->firedancer.funk.max_account_records, config->firedancer.funk.max_database_transactions, @@ -59,33 +59,33 @@ snapshot_load_topo( config_t * config, if( vinyl_server ) { /* Create a workspace with 512 MiB of free space for clients to create objects in. */ - fd_topo_wksp_t * server_wksp = fd_topob_wksp( topo, "vinyl_server" ); + fd_topo_wksp_t * server_wksp = fd_topob_wksp( topo, "vinyl_server", 0 ); server_wksp->min_part_max = 64UL; server_wksp->min_loose_sz = 64UL<<20; } /* metrics tile *****************************************************/ - fd_topob_wksp( topo, "metric_in" ); - fd_topob_wksp( topo, "metric" ); + fd_topob_wksp( topo, "metric_in", 0 ); + fd_topob_wksp( topo, "metric", 0 ); fd_topob_tile( topo, "metric", "metric", "metric_in", ULONG_MAX, 0, 0 ); /* read() tile */ - fd_topob_wksp( topo, "snapct" ); + fd_topob_wksp( topo, "snapct", 0 ); fd_topo_tile_t * snapct_tile = fd_topob_tile( topo, "snapct", "snapct", "metric_in", ULONG_MAX, 0, 0 ); snapct_tile->allow_shutdown = 1; /* load tile */ - fd_topob_wksp( topo, "snapld" ); + fd_topob_wksp( topo, "snapld", 0 ); fd_topo_tile_t * snapld_tile = fd_topob_tile( topo, "snapld", "snapld", "metric_in", ULONG_MAX, 0, 0 ); snapld_tile->allow_shutdown = 1; /* "snapdc": Zstandard decompress tile */ - fd_topob_wksp( topo, "snapdc" ); + fd_topob_wksp( topo, "snapdc", 0 ); fd_topo_tile_t * snapdc_tile = fd_topob_tile( topo, "snapdc", "snapdc", "metric_in", ULONG_MAX, 0, 0 ); snapdc_tile->allow_shutdown = 1; /* "snapin": Snapshot parser tile */ - fd_topob_wksp( topo, "snapin" ); + fd_topob_wksp( topo, "snapin", 0 ); fd_topo_tile_t * snapin_tile = fd_topob_tile( topo, "snapin", "snapin", "metric_in", ULONG_MAX, 0, 0 ); snapin_tile->allow_shutdown = 1; @@ -93,33 +93,33 @@ snapshot_load_topo( config_t * config, int vinyl_enabled = config->firedancer.vinyl.enabled; fd_topo_tile_t * snapwr_tile = NULL; if( vinyl_enabled ) { - fd_topob_wksp( topo, "snapwh" ); + fd_topob_wksp( topo, "snapwh", 0 ); fd_topo_tile_t * snapwh_tile = fd_topob_tile( topo, "snapwh", "snapwh", "metric_in", ULONG_MAX, 0, 0 ); snapwh_tile->allow_shutdown = 1; - fd_topob_wksp( topo, "snapwr" ); + fd_topob_wksp( topo, "snapwr", 0 ); snapwr_tile = fd_topob_tile( topo, "snapwr", "snapwr", "metric_in", ULONG_MAX, 0, 0 ); snapwr_tile->allow_shutdown = 1; } - fd_topob_wksp( topo, "snapct_ld" ); - fd_topob_wksp( topo, "snapld_dc" ); - fd_topob_wksp( topo, "snapdc_in" ); + fd_topob_wksp( topo, "snapct_ld", 0 ); + fd_topob_wksp( topo, "snapld_dc", 0 ); + fd_topob_wksp( topo, "snapdc_in", 0 ); if( FD_UNLIKELY( snapshot_lthash_disabled ) ) { - fd_topob_wksp( topo, "snapin_ct" ); + fd_topob_wksp( topo, "snapin_ct", 0 ); } - fd_topob_wksp( topo, "snapin_manif" ); - fd_topob_wksp( topo, "snapct_repr" ); + fd_topob_wksp( topo, "snapin_manif", 0 ); + fd_topob_wksp( topo, "snapct_repr", 0 ); if( vinyl_enabled ) { - fd_topob_wksp( topo, "snapin_wr" ); + fd_topob_wksp( topo, "snapin_wr", 0 ); } if( FD_LIKELY( !snapshot_lthash_disabled ) ) { - fd_topob_wksp( topo, "snapla" ); - fd_topob_wksp( topo, "snapls" ); - fd_topob_wksp( topo, "snapla_ls" ); - fd_topob_wksp( topo, "snapin_ls" ); - fd_topob_wksp( topo, "snapls_ct" ); + fd_topob_wksp( topo, "snapla", 0 ); + fd_topob_wksp( topo, "snapls", 0 ); + fd_topob_wksp( topo, "snapla_ls", 0 ); + fd_topob_wksp( topo, "snapin_ls", 0 ); + fd_topob_wksp( topo, "snapls_ct", 0 ); } #define FOR(cnt) for( ulong i=0UL; ifiredancer ); - fd_topob_wksp( topo, "vinyl_exec" ); + fd_topob_wksp( topo, "vinyl_exec", 0 ); fd_topo_tile_t * vinyl_tile = fd_topob_tile( topo, "vinyl", "vinyl_exec", "metric_in", ULONG_MAX, 0, 0 ); fd_topob_tile_uses( topo, vinyl_tile, vinyl_cnc, FD_SHMEM_JOIN_MODE_READ_WRITE ); diff --git a/src/app/firedancer/config/default.toml b/src/app/firedancer/config/default.toml index a4abc88f327..ae325031ed4 100644 --- a/src/app/firedancer/config/default.toml +++ b/src/app/firedancer/config/default.toml @@ -1545,6 +1545,14 @@ user = "" # enabled during routine running of the validator. core_dump = true + # By default, if core_dump is set to true, the workspace memory is + # not included in the dump. This is done via a call to + # madvise( shmem, sz, MADV_DONTDUMP ) which effectively sets it so + # the shared memory region that corresponds to the wksp's memory is + # not included in the dump. If dump_wksp_mem is true, core runtime + # wksp's memory will be included in the dump. + dump_wksp_mem = false + # A hard fork occurs when our validator has some implementation # difference in consensus rules and gets a different blockhash for # a given slot than the rest of the cluster. diff --git a/src/app/firedancer/topology.c b/src/app/firedancer/topology.c index d1485b7423b..a1dc1b4115f 100644 --- a/src/app/firedancer/topology.c +++ b/src/app/firedancer/topology.c @@ -156,7 +156,7 @@ setup_topo_txncache( fd_topo_t * topo, void setup_topo_vinyl_meta( fd_topo_t * topo, fd_configf_t * config ) { - fd_topob_wksp( topo, "vinyl_meta" ); + fd_topob_wksp( topo, "vinyl_meta", 0 ); fd_topo_obj_t * map_obj = fd_topob_obj( topo, "vinyl_meta", "vinyl_meta" ); ulong const meta_max = fd_ulong_pow2_up( config->vinyl.max_account_records ); @@ -177,7 +177,7 @@ setup_topo_vinyl_meta( fd_topo_t * topo, fd_topo_obj_t * setup_topo_vinyl_cache( fd_topo_t * topo, fd_configf_t * config ) { - fd_topob_wksp( topo, "vinyl_data" ); + fd_topob_wksp( topo, "vinyl_data", 0 ); fd_topo_obj_t * line_obj = fd_topob_obj( topo, "vinyl_data", "vinyl_data" ); ulong const heap_max = config->vinyl.cache_size_gib<<30; fd_pod_insertf_ulong( topo->props, heap_max, "obj.%lu.data_sz", line_obj->id ); @@ -285,121 +285,109 @@ fd_topo_initialize( config_t * config ) { topo->max_page_size = fd_cstr_to_shmem_page_sz( config->hugetlbfs.max_page_size ); topo->gigantic_page_threshold = config->hugetlbfs.gigantic_page_threshold_mib << 20; + int runtime_wksp_dumpable = config->development.dump_wksp_mem; + /* topo, name */ - fd_topob_wksp( topo, "metric" ); - fd_topob_wksp( topo, "genesi" ); - fd_topob_wksp( topo, "ipecho" ); - fd_topob_wksp( topo, "gossvf" ); - fd_topob_wksp( topo, "gossip" ); - fd_topob_wksp( topo, "shred" ); - fd_topob_wksp( topo, "repair" ); - fd_topob_wksp( topo, "replay" ); - fd_topob_wksp( topo, "exec" ); - fd_topob_wksp( topo, "tower" ); - fd_topob_wksp( topo, "send" ); - - fd_topob_wksp( topo, "quic" ); - fd_topob_wksp( topo, "verify" ); - fd_topob_wksp( topo, "dedup" ); - fd_topob_wksp( topo, "resolv" ); - fd_topob_wksp( topo, "pack" ); - fd_topob_wksp( topo, "bank" ); - fd_topob_wksp( topo, "poh" ); - fd_topob_wksp( topo, "sign" ); - - fd_topob_wksp( topo, "metric_in" ); - - fd_topob_wksp( topo, "net_gossip" ); - fd_topob_wksp( topo, "net_shred" ); - fd_topob_wksp( topo, "net_repair" ); - fd_topob_wksp( topo, "net_send" ); - fd_topob_wksp( topo, "net_quic" ); - - fd_topob_wksp( topo, "genesi_out" ); - fd_topob_wksp( topo, "ipecho_out" ); - fd_topob_wksp( topo, "gossvf_gossi" ); - fd_topob_wksp( topo, "gossip_gossv" ); - fd_topob_wksp( topo, "gossip_out" ); - - fd_topob_wksp( topo, "shred_out" ); - fd_topob_wksp( topo, "replay_stake" ); - fd_topob_wksp( topo, "replay_exec" ); - fd_topob_wksp( topo, "replay_out" ); - fd_topob_wksp( topo, "tower_out" ); - fd_topob_wksp( topo, "send_out" ); - - fd_topob_wksp( topo, "quic_verify" ); - fd_topob_wksp( topo, "verify_dedup" ); - fd_topob_wksp( topo, "dedup_resolv" ); - fd_topob_wksp( topo, "resolv_pack" ); - fd_topob_wksp( topo, "pack_poh" ); - fd_topob_wksp( topo, "pack_bank" ); - fd_topob_wksp( topo, "resolv_repla" ); + fd_topob_wksp( topo, "metric", 0 ); + fd_topob_wksp( topo, "genesi", 0 ); + fd_topob_wksp( topo, "ipecho", 0 ); + fd_topob_wksp( topo, "gossvf", 0 ); + fd_topob_wksp( topo, "gossip", 0 ); + fd_topob_wksp( topo, "shred", 0 ); + fd_topob_wksp( topo, "repair", 0 ); + fd_topob_wksp( topo, "replay", runtime_wksp_dumpable ); + fd_topob_wksp( topo, "exec", 0 ); + fd_topob_wksp( topo, "tower", runtime_wksp_dumpable ); + fd_topob_wksp( topo, "send", 0 ); + fd_topob_wksp( topo, "quic", 0 ); + fd_topob_wksp( topo, "verify", 0 ); + fd_topob_wksp( topo, "dedup", 0 ); + fd_topob_wksp( topo, "resolv", 0 ); + fd_topob_wksp( topo, "pack", 0 ); + fd_topob_wksp( topo, "bank", 0 ); + fd_topob_wksp( topo, "poh", 0 ); + fd_topob_wksp( topo, "sign", 0 ); + fd_topob_wksp( topo, "metric_in", 0 ); + fd_topob_wksp( topo, "net_gossip", 0 ); + fd_topob_wksp( topo, "net_shred", 0 ); + fd_topob_wksp( topo, "net_repair", 0 ); + fd_topob_wksp( topo, "net_send", 0 ); + fd_topob_wksp( topo, "net_quic", 0 ); + fd_topob_wksp( topo, "genesi_out", 0 ); + fd_topob_wksp( topo, "ipecho_out", 0 ); + fd_topob_wksp( topo, "gossvf_gossi", 0 ); + fd_topob_wksp( topo, "gossip_gossv", 0 ); + fd_topob_wksp( topo, "gossip_out", 0 ); + fd_topob_wksp( topo, "shred_out", 0 ); + fd_topob_wksp( topo, "replay_stake", 0 ); + fd_topob_wksp( topo, "replay_exec", 0 ); + fd_topob_wksp( topo, "replay_out", 0 ); + fd_topob_wksp( topo, "tower_out", 0 ); + fd_topob_wksp( topo, "send_out", 0 ); + fd_topob_wksp( topo, "quic_verify", 0 ); + fd_topob_wksp( topo, "verify_dedup", 0 ); + fd_topob_wksp( topo, "dedup_resolv", 0 ); + fd_topob_wksp( topo, "resolv_pack", 0 ); + fd_topob_wksp( topo, "pack_poh", 0 ); + fd_topob_wksp( topo, "pack_bank", 0 ); + fd_topob_wksp( topo, "resolv_repla", 0 ); if( FD_LIKELY( config->tiles.pack.use_consumed_cus ) ) { - fd_topob_wksp( topo, "bank_pack" ); + fd_topob_wksp( topo, "bank_pack", 0 ); } - fd_topob_wksp( topo, "bank_poh" ); - fd_topob_wksp( topo, "bank_busy" ); - fd_topob_wksp( topo, "poh_shred" ); - fd_topob_wksp( topo, "poh_replay" ); - - fd_topob_wksp( topo, "funk" ); - fd_topob_wksp( topo, "progcache" ); - fd_topob_wksp( topo, "fec_sets" ); - fd_topob_wksp( topo, "txncache" ); - fd_topob_wksp( topo, "banks" ); - fd_topob_wksp( topo, "store" ); - fd_topob_wksp( topo, "executed_txn" ); - - fd_topob_wksp( topo, "gossip_sign" ); - fd_topob_wksp( topo, "sign_gossip" ); - - fd_topob_wksp( topo, "shred_sign" ); - fd_topob_wksp( topo, "sign_shred" ); - - fd_topob_wksp( topo, "repair_sign" ); - fd_topob_wksp( topo, "sign_repair" ); - - fd_topob_wksp( topo, "send_sign" ); - fd_topob_wksp( topo, "sign_send" ); - - fd_topob_wksp( topo, "exec_sig" ); - - fd_topob_wksp( topo, "cswtch" ); - - fd_topob_wksp( topo, "exec_replay" ); + fd_topob_wksp( topo, "bank_poh", 0 ); + fd_topob_wksp( topo, "bank_busy", 0 ); + fd_topob_wksp( topo, "poh_shred", 0 ); + fd_topob_wksp( topo, "poh_replay", 0 ); + fd_topob_wksp( topo, "funk", 0 ); + fd_topob_wksp( topo, "progcache", 0 ); + fd_topob_wksp( topo, "fec_sets", 0 ); + fd_topob_wksp( topo, "txncache", 0 ); + fd_topob_wksp( topo, "banks", 0 ); + fd_topob_wksp( topo, "store", 0 ); + fd_topob_wksp( topo, "executed_txn", 0 ); + fd_topob_wksp( topo, "gossip_sign", 0 ); + fd_topob_wksp( topo, "sign_gossip", 0 ); + fd_topob_wksp( topo, "shred_sign", 0 ); + fd_topob_wksp( topo, "sign_shred", 0 ); + fd_topob_wksp( topo, "repair_sign", 0 ); + fd_topob_wksp( topo, "sign_repair", 0 ); + fd_topob_wksp( topo, "send_sign", 0 ); + fd_topob_wksp( topo, "sign_send", 0 ); + fd_topob_wksp( topo, "exec_sig", 0 ); + fd_topob_wksp( topo, "cswtch", 0 ); + fd_topob_wksp( topo, "exec_replay", 0 ); if( FD_LIKELY( snapshots_enabled ) ) { - fd_topob_wksp( topo, "snapct" ); - fd_topob_wksp( topo, "snapld" ); - fd_topob_wksp( topo, "snapdc" ); - fd_topob_wksp( topo, "snapin" ); + fd_topob_wksp( topo, "snapct", 0 ); + fd_topob_wksp( topo, "snapld", 0 ); + fd_topob_wksp( topo, "snapdc", 0 ); + fd_topob_wksp( topo, "snapin", 0 ); if( vinyl_enabled ) { - fd_topob_wksp( topo, "snapwh" ); - fd_topob_wksp( topo, "snapwr" ); + fd_topob_wksp( topo, "snapwh", 0 ); + fd_topob_wksp( topo, "snapwr", 0 ); } - fd_topob_wksp( topo, "snapct_ld" ); - fd_topob_wksp( topo, "snapld_dc" ); - fd_topob_wksp( topo, "snapdc_in" ); - if( vinyl_enabled ) fd_topob_wksp( topo, "snapin_wr" ); + fd_topob_wksp( topo, "snapct_ld", 0 ); + fd_topob_wksp( topo, "snapld_dc", 0 ); + fd_topob_wksp( topo, "snapdc_in", 0 ); + if( vinyl_enabled ) fd_topob_wksp( topo, "snapin_wr", 0 ); if( FD_UNLIKELY( snapshot_lthash_disabled ) ) { - fd_topob_wksp( topo, "snapin_ct" ); + fd_topob_wksp( topo, "snapin_ct", 0 ); } else { - fd_topob_wksp( topo, "snapls_ct" ); + fd_topob_wksp( topo, "snapls_ct", 0 ); } - if( FD_LIKELY( config->tiles.gui.enabled ) ) fd_topob_wksp( topo, "snapct_gui" ); - if( FD_LIKELY( config->tiles.gui.enabled ) ) fd_topob_wksp( topo, "snapin_gui" ); - fd_topob_wksp( topo, "snapin_manif" ); - fd_topob_wksp( topo, "snapct_repr" ); + if( FD_LIKELY( config->tiles.gui.enabled ) ) fd_topob_wksp( topo, "snapct_gui", 0 ); + if( FD_LIKELY( config->tiles.gui.enabled ) ) fd_topob_wksp( topo, "snapin_gui", 0 ); + fd_topob_wksp( topo, "snapin_manif", 0 ); + fd_topob_wksp( topo, "snapct_repr", 0 ); if( FD_LIKELY( !snapshot_lthash_disabled ) ) { - fd_topob_wksp( topo, "snapla" ); - fd_topob_wksp( topo, "snapls" ); - fd_topob_wksp( topo, "snapla_ls" ); - fd_topob_wksp( topo, "snapin_ls" ); + fd_topob_wksp( topo, "snapla", 0 ); + fd_topob_wksp( topo, "snapls", 0 ); + fd_topob_wksp( topo, "snapla_ls", 0 ); + fd_topob_wksp( topo, "snapin_ls", 0 ); } } @@ -729,12 +717,12 @@ fd_topo_initialize( config_t * config ) { if( FD_UNLIKELY( config->tiles.bundle.enabled ) ) { - fd_topob_wksp( topo, "bundle_verif" ); - fd_topob_wksp( topo, "bundle_sign" ); - fd_topob_wksp( topo, "sign_bundle" ); - fd_topob_wksp( topo, "pack_sign" ); - fd_topob_wksp( topo, "sign_pack" ); - fd_topob_wksp( topo, "bundle" ); + fd_topob_wksp( topo, "bundle_verif", 0 ); + fd_topob_wksp( topo, "bundle_sign", 0 ); + fd_topob_wksp( topo, "sign_bundle", 0 ); + fd_topob_wksp( topo, "pack_sign", 0 ); + fd_topob_wksp( topo, "sign_pack", 0 ); + fd_topob_wksp( topo, "bundle", 0 ); /**/ fd_topob_link( topo, "bundle_verif", "bundle_verif", config->tiles.verify.receive_buffer_size, FD_TPU_PARSED_MTU, 1UL ); /**/ fd_topob_link( topo, "bundle_sign", "bundle_sign", 65536UL, 9UL, 1UL ); @@ -790,10 +778,10 @@ fd_topo_initialize( config_t * config ) { /**/ fd_topob_tile_out( topo, "sign", 0UL, "sign_send", 0UL ); if( FD_UNLIKELY( config->tiles.archiver.enabled ) ) { - fd_topob_wksp( topo, "arch_f" ); - fd_topob_wksp( topo, "arch_w" ); - fd_topob_wksp( topo, "feeder" ); - fd_topob_wksp( topo, "arch_f2w" ); + fd_topob_wksp( topo, "arch_f", 0 ); + fd_topob_wksp( topo, "arch_w", 0 ); + fd_topob_wksp( topo, "feeder", 0 ); + fd_topob_wksp( topo, "arch_f2w", 0 ); fd_topob_link( topo, "feeder", "feeder", 65536UL, 4UL*FD_SHRED_STORE_MTU, 4UL+config->tiles.shred.max_pending_shred_sets ); fd_topob_link( topo, "arch_f2w", "arch_f2w", 128UL, 4UL*FD_SHRED_STORE_MTU, 1UL ); @@ -809,7 +797,7 @@ fd_topo_initialize( config_t * config ) { } if( FD_UNLIKELY( config->tiles.shredcap.enabled ) ) { - fd_topob_wksp( topo, "scap" ); + fd_topob_wksp( topo, "scap", 0 ); fd_topob_tile( topo, "scap", "scap", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 ); @@ -829,8 +817,8 @@ fd_topo_initialize( config_t * config ) { int rpc_enabled = config->tiles.rpc.enabled; if( FD_UNLIKELY( rpc_enabled ) ) { - fd_topob_wksp( topo, "rpc" ); - fd_topob_wksp( topo, "rpc_replay" ); + fd_topob_wksp( topo, "rpc", 0 ); + fd_topob_wksp( topo, "rpc_replay", 0 ); fd_topob_link( topo, "rpc_replay", "rpc_replay", 4UL, 0UL, 1UL ); fd_topob_tile( topo, "rpc", "rpc", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 ); fd_topob_tile_out( topo, "rpc", 0UL, "rpc_replay", 0UL ); @@ -898,7 +886,7 @@ fd_topo_initialize( config_t * config ) { FOR(bank_tile_cnt) fd_topob_tile_uses( topo, &topo->tiles[ fd_topo_find_tile( topo, "bank", i ) ], progcache_obj, FD_SHMEM_JOIN_MODE_READ_WRITE ); if( FD_LIKELY( config->tiles.gui.enabled ) ) { - fd_topob_wksp( topo, "gui" ); + fd_topob_wksp( topo, "gui", 0 ); /**/ fd_topob_tile( topo, "gui", "gui", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 ); diff --git a/src/app/shared/fd_config.h b/src/app/shared/fd_config.h index fd9f0747e2b..3960951cc66 100644 --- a/src/app/shared/fd_config.h +++ b/src/app/shared/fd_config.h @@ -294,6 +294,7 @@ struct fd_config { int sandbox; int no_clone; int core_dump; + int dump_wksp_mem; int no_agave; int bootstrap; uint debug_tile; diff --git a/src/app/shared/fd_config_parse.c b/src/app/shared/fd_config_parse.c index 5bd860659e2..2de2e5a377c 100644 --- a/src/app/shared/fd_config_parse.c +++ b/src/app/shared/fd_config_parse.c @@ -278,6 +278,7 @@ fd_config_extract_pod( uchar * pod, CFG_POP ( bool, development.sandbox ); CFG_POP ( bool, development.no_clone ); CFG_POP ( bool, development.core_dump ); + CFG_POP ( bool, development.dump_wksp_mem ); CFG_POP ( bool, development.no_agave ); CFG_POP ( bool, development.bootstrap ); diff --git a/src/app/shared_dev/commands/bench/bench.c b/src/app/shared_dev/commands/bench/bench.c index 1642aed922a..e9c6e3fe816 100644 --- a/src/app/shared_dev/commands/bench/bench.c +++ b/src/app/shared_dev/commands/bench/bench.c @@ -52,7 +52,7 @@ add_bench_topo( fd_topo_t * topo, int no_quic, int reserve_agave_cores ) { - fd_topob_wksp( topo, "bench" ); + fd_topob_wksp( topo, "bench", 0 ); fd_topob_link( topo, "bencho_out", "bench", 128UL, 64UL, 1UL ); for( ulong i=0UL; itopo, config->name ); topo->max_page_size = fd_cstr_to_shmem_page_sz( config->hugetlbfs.max_page_size ); - fd_topob_wksp( topo, "metric_in" ); + fd_topob_wksp( topo, "metric_in", 0 ); /* Tiles */ - fd_topob_wksp( topo, "bundle" ); + fd_topob_wksp( topo, "bundle", 0 ); fd_topo_tile_t * bundle_tile = fd_topob_tile( topo, "bundle", "bundle", "metric_in", ULONG_MAX, 0, 1 ); - fd_topob_wksp( topo, "sign" ); + fd_topob_wksp( topo, "sign", 0 ); fd_topo_tile_t * sign_tile = fd_topob_tile( topo, "sign", "sign", "metric_in", ULONG_MAX, 0, 1 ); - fd_topob_wksp( topo, "metric" ); + fd_topob_wksp( topo, "metric", 0 ); fd_topo_tile_t * metric_tile = fd_topob_tile( topo, "metric", "metric", "metric_in", ULONG_MAX, 0, 0 ); /* Links */ diff --git a/src/app/shared_dev/commands/pktgen/pktgen.c b/src/app/shared_dev/commands/pktgen/pktgen.c index 1156b899a18..74121f8b224 100644 --- a/src/app/shared_dev/commands/pktgen/pktgen.c +++ b/src/app/shared_dev/commands/pktgen/pktgen.c @@ -51,12 +51,12 @@ pktgen_topo( config_t * config ) { fd_topob_new( &config->topo, config->name ); topo->max_page_size = fd_cstr_to_shmem_page_sz( config->hugetlbfs.max_page_size ); - fd_topob_wksp( topo, "metric" ); - fd_topob_wksp( topo, "metric_in" ); + fd_topob_wksp( topo, "metric", 0 ); + fd_topob_wksp( topo, "metric_in", 0 ); fd_topos_net_tiles( topo, config->layout.net_tile_count, &config->net, config->tiles.netlink.max_routes, config->tiles.netlink.max_peer_routes, config->tiles.netlink.max_neighbors, tile_to_cpu ); fd_topob_tile( topo, "metric", "metric", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 ); - fd_topob_wksp( topo, "pktgen" ); + fd_topob_wksp( topo, "pktgen", 0 ); fd_topo_tile_t * pktgen_tile = fd_topob_tile( topo, "pktgen", "pktgen", "pktgen", tile_to_cpu[ topo->tile_cnt ], 0, 0 ); if( FD_UNLIKELY( !fd_cstr_to_ip4_addr( config->development.pktgen.fake_dst_ip, &pktgen_tile->pktgen.fake_dst_ip ) ) ) { FD_LOG_ERR(( "Invalid [development.pktgen.fake_dst_ip]" )); diff --git a/src/app/shared_dev/commands/udpecho/udpecho.c b/src/app/shared_dev/commands/udpecho/udpecho.c index ca8e5b309fc..cb6e5f9eacd 100644 --- a/src/app/shared_dev/commands/udpecho/udpecho.c +++ b/src/app/shared_dev/commands/udpecho/udpecho.c @@ -47,12 +47,12 @@ udpecho_topo( config_t * config ) { fd_topob_new( &config->topo, config->name ); topo->max_page_size = fd_cstr_to_shmem_page_sz( config->hugetlbfs.max_page_size ); - fd_topob_wksp( topo, "metric" ); - fd_topob_wksp( topo, "metric_in" ); + fd_topob_wksp( topo, "metric", 0 ); + fd_topob_wksp( topo, "metric_in", 0 ); fd_topos_net_tiles( topo, config->layout.net_tile_count, &config->net, config->tiles.netlink.max_routes, config->tiles.netlink.max_peer_routes, config->tiles.netlink.max_neighbors, tile_to_cpu ); fd_topob_tile( topo, "metric", "metric", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 ); - fd_topob_wksp( topo, "l4swap" ); + fd_topob_wksp( topo, "l4swap", 0 ); fd_topob_tile( topo, "l4swap", "l4swap", "l4swap", tile_to_cpu[ topo->tile_cnt ], 0, 0 ); fd_topob_link( topo, "quic_net", "l4swap", 2048UL, FD_NET_MTU, 1UL ); diff --git a/src/disco/net/fd_net_tile_topo.c b/src/disco/net/fd_net_tile_topo.c index 279a2b0be44..017e22345b9 100644 --- a/src/disco/net/fd_net_tile_topo.c +++ b/src/disco/net/fd_net_tile_topo.c @@ -81,20 +81,20 @@ fd_topos_net_tiles( fd_topo_t * topo, ulong netlnk_max_neighbors, ulong const tile_to_cpu[ FD_TILE_MAX ] ) { /* net_umem: Packet buffers */ - fd_topob_wksp( topo, "net_umem" ); + fd_topob_wksp( topo, "net_umem", 0 ); /* Create workspaces */ if( 0==strcmp( net_cfg->provider, "xdp" ) ) { /* net: private working memory of the net tiles */ - fd_topob_wksp( topo, "net" ); + fd_topob_wksp( topo, "net", 0 ); /* netlnk: private working memory of the netlnk tile */ - fd_topob_wksp( topo, "netlnk" ); + fd_topob_wksp( topo, "netlnk", 0 ); /* netbase: shared network config (config plane) */ - fd_topob_wksp( topo, "netbase" ); + fd_topob_wksp( topo, "netbase", 0 ); /* net_netlnk: net->netlnk ARP requests */ - fd_topob_wksp( topo, "net_netlnk" ); + fd_topob_wksp( topo, "net_netlnk", 0 ); fd_topo_tile_t * netlink_tile = fd_topob_tile( topo, "netlnk", "netlnk", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 ); fd_netlink_topo_create( netlink_tile, topo, netlnk_max_routes, netlnk_max_peer_routes, netlnk_max_neighbors, net_cfg->interface ); @@ -145,7 +145,7 @@ fd_topos_net_tiles( fd_topo_t * topo, } else if( 0==strcmp( net_cfg->provider, "socket" ) ) { /* sock: private working memory of the sock tiles */ - fd_topob_wksp( topo, "sock" ); + fd_topob_wksp( topo, "sock", 0 ); for( ulong i=0UL; ixdp.xdp_rx_queue_size = (uint)rxq_depth; topo_tile->xdp.xdp_tx_queue_size = (uint)txq_depth; diff --git a/src/disco/pack/test_pack_tile.c b/src/disco/pack/test_pack_tile.c index 1c5036207b7..b2afadf550d 100644 --- a/src/disco/pack/test_pack_tile.c +++ b/src/disco/pack/test_pack_tile.c @@ -937,7 +937,7 @@ mock_privileged_init( fd_topo_t * topo, FD_TEST( CRANK_WKSP_SIZE > fd_wksp_footprint( part_max, 1UL ) ); fd_wksp_t * crank_wksp = fd_wksp_join( fd_wksp_new( (void *)crank_scratch, "crank_wksp", 1234U, part_max, data_max ) ); fd_shmem_join_anonymous( "crank_wksp", FD_SHMEM_JOIN_MODE_READ_WRITE, crank_wksp, crank_scratch, FD_SHMEM_NORMAL_PAGE_SZ, sizeof(crank_scratch)>>FD_SHMEM_NORMAL_LG_PAGE_SZ ); - fd_topob_wksp( topo, "crank_wksp" ); + fd_topob_wksp( topo, "crank_wksp", 0 ); /* Sign in link */ fd_topo_link_t * sign_in_link = fd_topob_link( topo, "sign_pack", "crank_wksp", 128, 0, 1UL ); diff --git a/src/disco/topo/fd_topo.c b/src/disco/topo/fd_topo.c index df951ffaa5f..a93a1bd4455 100644 --- a/src/disco/topo/fd_topo.c +++ b/src/disco/topo/fd_topo.c @@ -28,7 +28,7 @@ fd_topo_join_workspace( fd_topo_t * topo, char name[ PATH_MAX ]; FD_TEST( fd_cstr_printf_check( name, PATH_MAX, NULL, "%s_%s.wksp", topo->app_name, wksp->name ) ); - wksp->wksp = fd_wksp_join( fd_shmem_join( name, mode, NULL, NULL, NULL ) ); + wksp->wksp = fd_wksp_join( fd_shmem_join( name, mode, NULL, NULL, NULL, wksp->dumpable ) ); if( FD_UNLIKELY( !wksp->wksp ) ) FD_LOG_ERR(( "fd_wksp_join failed" )); } @@ -101,7 +101,7 @@ fd_topo_create_workspace( fd_topo_t * topo, if( FD_UNLIKELY( err && errno==ENOMEM ) ) return -1; else if( FD_UNLIKELY( err ) ) FD_LOG_ERR(( "fd_shmem_create_multi failed" )); - void * shmem = fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, NULL ); /* logs details */ + void * shmem = fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, NULL, 0 ); /* logs details */ void * wkspmem = fd_wksp_new( shmem, name, 0U, wksp->part_max, wksp->total_footprint ); /* logs details */ if( FD_UNLIKELY( !wkspmem ) ) FD_LOG_ERR(( "fd_wksp_new failed" )); diff --git a/src/disco/topo/fd_topo.h b/src/disco/topo/fd_topo.h index bcdee8ffba6..c658b9fb62e 100644 --- a/src/disco/topo/fd_topo.h +++ b/src/disco/topo/fd_topo.h @@ -42,6 +42,8 @@ typedef struct { ulong min_part_max; /* Artificially raise part_max */ ulong min_loose_sz; /* Artificially raise loose footprint */ + int dumpable; /* If the workspace's memory should be included in coredumps. */ + /* Computed fields. These are not supplied as configuration but calculated as needed. */ struct { ulong page_sz; /* The size of the pages that this workspace is backed by. One of FD_PAGE_SIZE_*. */ diff --git a/src/disco/topo/fd_topo_run.c b/src/disco/topo/fd_topo_run.c index 18320a86900..686b45ee37e 100644 --- a/src/disco/topo/fd_topo_run.c +++ b/src/disco/topo/fd_topo_run.c @@ -235,7 +235,7 @@ fd_topo_tile_stack_join( char const * app_name, char name[ PATH_MAX ]; FD_TEST( fd_cstr_printf_check( name, PATH_MAX, NULL, "%s_stack_%s%lu", app_name, tile_name, tile_kind_id ) ); - uchar * stack = fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, NULL ); + uchar * stack = fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, NULL, 0 ); if( FD_UNLIKELY( !stack ) ) FD_LOG_ERR(( "fd_shmem_join failed" )); /* Make space for guard lo and guard hi */ diff --git a/src/disco/topo/fd_topob.c b/src/disco/topo/fd_topob.c index 956a802c430..300e37f5dfe 100644 --- a/src/disco/topo/fd_topob.c +++ b/src/disco/topo/fd_topob.c @@ -33,7 +33,8 @@ fd_topob_new( void * mem, fd_topo_wksp_t * fd_topob_wksp( fd_topo_t * topo, - char const * name ) { + char const * name, + int dumpable ) { if( FD_UNLIKELY( !topo || !name || !strlen( name ) ) ) FD_LOG_ERR(( "NULL args" )); if( FD_UNLIKELY( strlen( name )>=sizeof(topo->workspaces[ topo->wksp_cnt ].name ) ) ) FD_LOG_ERR(( "wksp name too long: %s", name )); if( FD_UNLIKELY( topo->wksp_cnt>=FD_TOPO_MAX_WKSPS ) ) FD_LOG_ERR(( "too many workspaces" )); @@ -41,6 +42,7 @@ fd_topob_wksp( fd_topo_t * topo, fd_topo_wksp_t * wksp = &topo->workspaces[ topo->wksp_cnt ]; strncpy( wksp->name, name, sizeof(wksp->name) ); wksp->id = topo->wksp_cnt; + wksp->dumpable = dumpable; topo->wksp_cnt++; return wksp; } diff --git a/src/disco/topo/fd_topob.h b/src/disco/topo/fd_topob.h index b5d9941b5b4..7cad159498d 100644 --- a/src/disco/topo/fd_topob.h +++ b/src/disco/topo/fd_topob.h @@ -38,7 +38,8 @@ fd_topob_new( void * mem, fd_topo_wksp_t * fd_topob_wksp( fd_topo_t * topo, - char const * name ); + char const * name, + int dumpable ); /* Add an object with the given name to the toplogy. An object is something that takes up space in memory, in a workspace. diff --git a/src/disco/verify/test_verify_tile.c b/src/disco/verify/test_verify_tile.c index 9fb4d9a7590..e1782276307 100644 --- a/src/disco/verify/test_verify_tile.c +++ b/src/disco/verify/test_verify_tile.c @@ -56,7 +56,7 @@ static fd_topo_t * mock_topo_create( void ) { fd_topo_t * topo = fd_topob_new( test_malloc( alignof(fd_topo_t), sizeof(fd_topo_t) ), "verify-test" ); - fd_topo_wksp_t * wksp = fd_topob_wksp( topo, "wksp" ); + fd_topo_wksp_t * wksp = fd_topob_wksp( topo, "wksp", 0 ); wksp->wksp = NULL; fd_topo_tile_t * verify = fd_topob_tile( topo, "verify", "wksp", "wksp", 0UL, 0, 0 ); diff --git a/src/discof/replay/fd_replay_tile.c b/src/discof/replay/fd_replay_tile.c index 7979232f043..97c7db87b4c 100644 --- a/src/discof/replay/fd_replay_tile.c +++ b/src/discof/replay/fd_replay_tile.c @@ -1030,6 +1030,8 @@ init_after_snapshot( fd_replay_tile_t * ctx ) { } if( FD_UNLIKELY( ctx->capture_ctx ) ) fd_solcap_writer_flush( ctx->capture_ctx->capture ); + + FD_LOG_CRIT(("ASDF")); } static inline int diff --git a/src/groove/test_groove_data.c b/src/groove/test_groove_data.c index 7b66b5c64cb..66ed701766c 100644 --- a/src/groove/test_groove_data.c +++ b/src/groove/test_groove_data.c @@ -264,7 +264,7 @@ main( int argc, FD_LOG_NOTICE(( "Joining to --name %s", name )); fd_shmem_join_info_t info[1]; - volume = (fd_groove_volume_t *)fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, info ); /* logs details */ + volume = (fd_groove_volume_t *)fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, info, 0 ); /* logs details */ if( FD_UNLIKELY( !volume ) ) FD_LOG_ERR(( "fd_shmem_join failed" )); page_sz = info->page_sz; page_cnt = info->page_cnt; diff --git a/src/groove/test_groove_volume.c b/src/groove/test_groove_volume.c index e14df83d7d3..6794b1d9822 100644 --- a/src/groove/test_groove_volume.c +++ b/src/groove/test_groove_volume.c @@ -43,7 +43,7 @@ main( int argc, FD_LOG_NOTICE(( "Joining to --name %s", name )); fd_shmem_join_info_t info[1]; - volume = (fd_groove_volume_t *)fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, info ); /* logs details */ + volume = (fd_groove_volume_t *)fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, info, 0 ); /* logs details */ if( FD_UNLIKELY( !volume ) ) FD_LOG_ERR(( "fd_shmem_join failed" )); page_sz = info->page_sz; page_cnt = info->page_cnt; diff --git a/src/util/shmem/fd_shmem.h b/src/util/shmem/fd_shmem.h index 3b651f6e9dd..2ed3c1199e7 100644 --- a/src/util/shmem/fd_shmem.h +++ b/src/util/shmem/fd_shmem.h @@ -156,6 +156,10 @@ FD_PROTOTYPES_BEGIN IT will log extensive details if there is any wonkiness under the hood. The caller may wish to proceed even if it fails. + If dumpable is set to a non-zero value, the shared memory region's + memory will be dumped along with a coredump. This is a debugging + feature and should not be used in a production environment. + IMPORTANT! It is safe to have join/leave functions themselves call fd_shmem_join/fd_shmem_leave to join additional regions as necessary. This allows very complex interdependent shared memory topologies to @@ -172,7 +176,8 @@ fd_shmem_join( char const * name, int mode, fd_shmem_joinleave_func_t join_func, void * context, - fd_shmem_join_info_t * opt_info ); + fd_shmem_join_info_t * opt_info, + int dumpable ); int fd_shmem_leave( void * join, diff --git a/src/util/shmem/fd_shmem_user.c b/src/util/shmem/fd_shmem_user.c index 34175e2b362..4fdb9eb213e 100644 --- a/src/util/shmem/fd_shmem_user.c +++ b/src/util/shmem/fd_shmem_user.c @@ -132,7 +132,10 @@ fd_shmem_join( char const * name, int mode, fd_shmem_joinleave_func_t join_func, void * context, - fd_shmem_join_info_t * opt_info ) { + fd_shmem_join_info_t * opt_info, + int dumpable ) { + + (void)dumpable; /* Check input args */ @@ -241,9 +244,13 @@ fd_shmem_join( char const * name, FD_LOG_WARNING(( "fd_numa_mlock(\"%s\",%lu KiB) failed (%i-%s); attempting to continue", path, sz>>10, errno, fd_io_strerror( errno ) )); - if( FD_UNLIKELY( madvise( shmem, sz, MADV_DONTDUMP ) ) ) - FD_LOG_WARNING(( "madvise(\"%s\",%lu KiB) failed (%i-%s); attempting to continue", - path, sz>>10, errno, fd_io_strerror( errno ) )); + if( !dumpable ) { + if( FD_UNLIKELY( madvise( shmem, sz, MADV_DONTDUMP ) ) ) + FD_LOG_WARNING(( "madvise(\"%s\",%lu KiB) failed (%i-%s); attempting to continue", + path, sz>>10, errno, fd_io_strerror( errno ) )); + } else { + FD_LOG_WARNING(("DUMPABLE %s", path)); + } /* We have mapped the region. Try to complete the join. Note: map_query above and map_insert could be combined to improve diff --git a/src/util/shmem/test_shmem.c b/src/util/shmem/test_shmem.c index abfe1346959..d58ee98fb56 100644 --- a/src/util/shmem/test_shmem.c +++ b/src/util/shmem/test_shmem.c @@ -172,7 +172,7 @@ main( int argc, FD_TEST( fd_shmem_join_query_by_name( name, NULL )==ENOENT ); FD_TEST( fd_shmem_join_query_by_name( name, info )==ENOENT ); - void * join = fd_shmem_join( name, mode, NULL, NULL, NULL ); + void * join = fd_shmem_join( name, mode, NULL, NULL, NULL, 0 ); FD_TEST( join ); FD_TEST( !fd_shmem_join_query_by_name( name, NULL ) ); @@ -232,7 +232,7 @@ main( int argc, FD_TEST( !fd_shmem_join_query_by_addr( ((uchar *)shmem) + off, 1UL, info ) ); FD_TEST( !memcmp( info, ref, sizeof(fd_shmem_join_info_t) ) ); - FD_TEST( fd_shmem_join( name, mode, NULL, NULL, NULL )==join ); + FD_TEST( fd_shmem_join( name, mode, NULL, NULL, NULL, 0 )==join ); ref_info[idx].ref_cnt++; fd_memset( info, 0, sizeof(fd_shmem_join_info_t) ); @@ -371,11 +371,11 @@ main( int argc, FD_TEST( !fd_shmem_join_query_by_addr( page, 1UL, info ) ); FD_TEST( !memcmp( info, ref, sizeof(fd_shmem_join_info_t) ) ); memset( nop, fd_rng_int( rng ), sizeof(fd_shmem_join_info_t) ); *info = *nop; - FD_TEST( fd_shmem_join( name, fd_rng_int( rng ) & 1, NULL, NULL, info )==join ); ref->ref_cnt++; + FD_TEST( fd_shmem_join( name, fd_rng_int( rng ) & 1, NULL, NULL, info, 0 )==join ); ref->ref_cnt++; FD_TEST( !memcmp( info, ref, sizeof(fd_shmem_join_info_t) ) ); memset( nop, fd_rng_int( rng ), sizeof(fd_shmem_join_info_t) ); *info = *nop; - FD_TEST( fd_shmem_join( name, fd_rng_int( rng ) & 1, NULL, NULL, info )==join ); ref->ref_cnt++; + FD_TEST( fd_shmem_join( name, fd_rng_int( rng ) & 1, NULL, NULL, info, 0 )==join ); ref->ref_cnt++; FD_TEST( !memcmp( info, ref, sizeof(fd_shmem_join_info_t) ) ); memset( nop, fd_rng_int( rng ), sizeof(fd_shmem_join_info_t) ); *info = *nop; diff --git a/src/util/wksp/fd_wksp_helper.c b/src/util/wksp/fd_wksp_helper.c index c4a1508c1a3..66fadc410c1 100644 --- a/src/util/wksp/fd_wksp_helper.c +++ b/src/util/wksp/fd_wksp_helper.c @@ -147,7 +147,7 @@ fd_wksp_new_named( char const * name, /* Join the memory region */ - void * shmem = fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, NULL ); /* logs details */ + void * shmem = fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, NULL, 0 ); /* logs details */ if( FD_UNLIKELY( !shmem ) ) { fd_shmem_unlink( name, page_sz ); /* logs details */ return FD_WKSP_ERR_FAIL; @@ -172,7 +172,7 @@ fd_wksp_delete_named( char const * name ) { /* Join the region and get the page size */ fd_shmem_join_info_t info[1]; - void * shwksp = fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, info ); /* logs details */ + void * shwksp = fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, info, 0 ); /* logs details */ if( FD_UNLIKELY( !shwksp ) ) return FD_WKSP_ERR_FAIL; ulong page_sz = info->page_sz; @@ -273,7 +273,7 @@ fd_wksp_delete_anon( fd_wksp_t * wksp ) { fd_wksp_t * fd_wksp_attach( char const * name ) { return (fd_wksp_t *) - fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, fd_wksp_private_join_func, NULL, NULL ); /* logs details */ + fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, fd_wksp_private_join_func, NULL, NULL, 0 ); /* logs details */ } int diff --git a/src/vinyl/data/test_vinyl_data.c b/src/vinyl/data/test_vinyl_data.c index 8eed7aaab48..7e1dc684df0 100644 --- a/src/vinyl/data/test_vinyl_data.c +++ b/src/vinyl/data/test_vinyl_data.c @@ -142,7 +142,7 @@ main( int argc, FD_LOG_NOTICE(( "Joining to --name %s", name )); fd_shmem_join_info_t info[1]; - shmem = fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, info ); /* logs details */ + shmem = fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, info, 0 ); /* logs details */ if( FD_UNLIKELY( !shmem ) ) FD_LOG_ERR(( "fd_shmem_join failed" )); page_cnt = info->page_cnt; page_sz = info->page_sz; diff --git a/src/vinyl/fd_vinyl_ctl.c b/src/vinyl/fd_vinyl_ctl.c index 01bf061bb49..a190d3d8ac0 100644 --- a/src/vinyl/fd_vinyl_ctl.c +++ b/src/vinyl/fd_vinyl_ctl.c @@ -153,7 +153,7 @@ fd_vinyl_main( int argc, bstream_type = 1; fd_shmem_join_info_t info[1]; - mmio = fd_shmem_join( path, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, info ); + mmio = fd_shmem_join( path, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, info, 0 ); TEST( mmio, "fd_shmem_join failed" ); mmio_sz = info->page_sz * info->page_cnt; From 3aa976d0d2e6e9e761f56545ef159668b7fda78e Mon Sep 17 00:00:00 2001 From: Ishan Bhatt Date: Thu, 20 Nov 2025 23:39:52 +0000 Subject: [PATCH 2/2] wip --- src/disco/topo/fd_topo_run.c | 2 +- src/discof/replay/fd_replay_tile.c | 1 - src/util/shmem/fd_shmem_user.c | 4 ++++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/disco/topo/fd_topo_run.c b/src/disco/topo/fd_topo_run.c index 686b45ee37e..3cb0097587c 100644 --- a/src/disco/topo/fd_topo_run.c +++ b/src/disco/topo/fd_topo_run.c @@ -235,7 +235,7 @@ fd_topo_tile_stack_join( char const * app_name, char name[ PATH_MAX ]; FD_TEST( fd_cstr_printf_check( name, PATH_MAX, NULL, "%s_stack_%s%lu", app_name, tile_name, tile_kind_id ) ); - uchar * stack = fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, NULL, 0 ); + uchar * stack = fd_shmem_join( name, FD_SHMEM_JOIN_MODE_READ_WRITE, NULL, NULL, NULL, 1 ); if( FD_UNLIKELY( !stack ) ) FD_LOG_ERR(( "fd_shmem_join failed" )); /* Make space for guard lo and guard hi */ diff --git a/src/discof/replay/fd_replay_tile.c b/src/discof/replay/fd_replay_tile.c index 97c7db87b4c..5fc4a411dd5 100644 --- a/src/discof/replay/fd_replay_tile.c +++ b/src/discof/replay/fd_replay_tile.c @@ -1030,7 +1030,6 @@ init_after_snapshot( fd_replay_tile_t * ctx ) { } if( FD_UNLIKELY( ctx->capture_ctx ) ) fd_solcap_writer_flush( ctx->capture_ctx->capture ); - FD_LOG_CRIT(("ASDF")); } diff --git a/src/util/shmem/fd_shmem_user.c b/src/util/shmem/fd_shmem_user.c index 4fdb9eb213e..3a795e59422 100644 --- a/src/util/shmem/fd_shmem_user.c +++ b/src/util/shmem/fd_shmem_user.c @@ -245,11 +245,15 @@ fd_shmem_join( char const * name, path, sz>>10, errno, fd_io_strerror( errno ) )); if( !dumpable ) { + FD_LOG_NOTICE(("NON-DUMPABLE %s", path)); if( FD_UNLIKELY( madvise( shmem, sz, MADV_DONTDUMP ) ) ) FD_LOG_WARNING(( "madvise(\"%s\",%lu KiB) failed (%i-%s); attempting to continue", path, sz>>10, errno, fd_io_strerror( errno ) )); } else { FD_LOG_WARNING(("DUMPABLE %s", path)); + if( FD_UNLIKELY( madvise( shmem, sz, MADV_DODUMP ) ) ) + FD_LOG_WARNING(( "madvise(\"%s\",%lu KiB) failed (%i-%s); attempting to continue", + path, sz>>10, errno, fd_io_strerror( errno ) )); } /* We have mapped the region. Try to complete the join. Note: