Skip to content

Failed reinitializing mtl #1341

@protoism

Description

@protoism

Hi! Thank you for submitting the bug.
Please provide more details below:

Describe the bug
mtl_init after mtl_init / mtl_uninit does not work

To Reproduce
Compile and execute this (adjusting to your interfaces)

#include <mtl/mtl_api.h>

void init_deinit(const char* port) {
mtl_handle mtlHandle = 0;
int result = 0;
struct mtl_init_params params;
memset(&params, 0, sizeof(struct mtl_init_params));
params.flags = MTL_FLAG_BIND_NUMA;
params.log_level = MTL_LOG_LEVEL_DEBUG;
params.rx_queues_cnt[0] = 1;
params.pmd[0] = mtl_pmd_by_port_name(port);
strncpy(params.port[0], port, MTL_PORT_MAX_LEN);
params.num_ports = 1;
mtlHandle = mtl_init(&params);
fprintf(stderr, "***** mtl_init: %p\n", mtlHandle);
result = mtl_uninit(mtlHandle);
fprintf(stderr, "***** mtl_uninit: %d\n", result);
}

int main() {
init_deinit("kernel:eno49");
init_deinit("kernel:eno50");
}

Expected behavior
I expect that mtl_init can be called more than once with no problems.

Configuration and command-line
Checked out at cae46cf

Status report
Create dir: mtl_system_status_20251204103815 for the report
Collect dmesg:
Collect system info:
Collect kernel cmdline:
Collect HugePages info:
Collect status of dpdk-devbind:
Collect iommu_groups:
Collect cpu info:
Collect ethernet interface info:
status_report.sh: 43: [[: not found
status_report.sh: 43: lo: not found
Collect ethtool info for lo
Cannot get driver information: Operation not supported
status_report.sh: 43: [[: not found
status_report.sh: 43: eno1: not found
Collect ethtool info for eno1
status_report.sh: 43: [[: not found
status_report.sh: 43: eno49: not found
Collect ethtool info for eno49
status_report.sh: 43: [[: not found
status_report.sh: 43: eno2: not found
Collect ethtool info for eno2
status_report.sh: 43: [[: not found
status_report.sh: 43: eno3: not found
Collect ethtool info for eno3
status_report.sh: 43: [[: not found
status_report.sh: 43: eno4: not found
Collect ethtool info for eno4
status_report.sh: 43: [[: not found
status_report.sh: 43: eno50: not found
Collect ethtool info for eno50
status_report.sh: 43: [[: not found
status_report.sh: 43: ens2f0: not found
Collect ethtool info for ens2f0
status_report.sh: 43: [[: not found
status_report.sh: 43: ens2f1: not found
Collect ethtool info for ens2f1
Collect ethernet lspci info:
Collect lspci info for 02:00.0
Collect lspci info for 02:00.1
Collect lspci info for 02:00.2
Collect lspci info for 02:00.3
Collect lspci info for 04:00.0
Collect lspci info for 04:00.1
Collect lspci info for 05:00.0
Collect lspci info for 05:00.1
Create mtl_system_status_20251204103815.tar
mtl_system_status_20251204103815/
mtl_system_status_20251204103815/kernel_log.txt
mtl_system_status_20251204103815/system_info.txt
All finished, share mtl_system_status_20251204103815.tar for the setup issues report.

Logs
Ehm... DEBUG mode
luca@iptester:~$ ./a.out
MTL: 2025-12-04 10:38:58, dev_eal_init, wait eal_init_thread done
EAL: Detected CPU lcores: 40
EAL: Detected NUMA nodes: 2
EAL: Detected shared linkage of DPDK
EAL: Selected IOVA mode 'VA'
EAL: No free 1048576 kB hugepages reported on node 0
EAL: No free 1048576 kB hugepages reported on node 1
MTL: 2025-12-04 10:38:58, mtl_init, MTL version: 25.2.0.DEV Tue Nov 18 18:53:34 2025 cae46cf-dirty gcc-13.3.0, dpdk version: DPDK 25.07.0
MTL: 2025-12-04 10:38:58, mtl_init, MTL_HAS_USDT is defined for this build
MTL: 2025-12-04 10:38:58, mtl_init, bind to socket 0, numa_nodes 2
MTL: 2025-12-04 10:38:58, Warn: mt_instance_init, connect to manager fail, assume single instance mode
MTL: 2025-12-04 10:38:58, mtl_init(0), socket_id 0 port kernel:eno49
MTL: 2025-12-04 10:38:58, stat_thread, start
MTL: 2025-12-04 10:38:58, mt_stat_init, stat period 10s
MTL: 2025-12-04 10:38:58, mt_dev_if_init(0), use mt ptp source
MTL: 2025-12-04 10:38:58, mt_dev_if_init(0), user request queues tx 0 rx 1
MTL: 2025-12-04 10:38:58, dev_config_port(0), not dpdk based tx_q(0 with 512 desc) rx_q (1 with 2048 desc)
MTL: 2025-12-04 10:38:58, mt_mempool_create_by_ops(0), succ at 0x22002664c0 size 4.310394m n 2047 d 2048 for T_P0_SYS_0
MTL: 2025-12-04 10:38:58, mt_mempool_create_by_ops(0), succ at 0x220041da80 size 6.623383m n 4095 d 1536 for R_P0Q0_MBUF_1
MTL: 2025-12-04 10:38:58, dev_if_init_rx_queues(0), rx_queues 1 malloc succ
MTL: 2025-12-04 10:38:58, mt_dev_if_init(0), port_id 0 port_type 5 drv_type 11
MTL: 2025-12-04 10:38:58, mt_dev_if_init(0), dev_capa 0x0, offload 0x0:0x0 queue offload 0x0:0x0, rss : 0x0
MTL: 2025-12-04 10:38:58, mt_dev_if_init(0), system_rx_queues_end 0 hdr_split_rx_queues_end 0
MTL: 2025-12-04 10:38:58, mt_dev_if_init(0), sip: 172.16.6.66
MTL: 2025-12-04 10:38:58, mt_dev_if_init(0), netmask: 255.255.255.0
MTL: 2025-12-04 10:38:58, mt_dev_if_init(0), gateway: 0.0.0.0
MTL: 2025-12-04 10:38:58, mt_dev_if_init(0), mac: 5c:b9:01:9c:51:3c
MTL: 2025-12-04 10:38:58, dev_start_port(0), not dpdk based
MTL: 2025-12-04 10:38:58, dev_if_init_pacing(0), use tsc as default
MTL: 2025-12-04 10:38:58, mt_dev_create(0), feature 0x0, tx pacing tsc
MTL: 2025-12-04 10:38:58, sch_lcore_shm_init, clear shm as we are the first user
MTL: 2025-12-04 10:38:58, sch_lcore_shm_init, shared memory attached at 0x752c90ef2000 nattch 1 shm_id 262153 key 0x15050005
MTL: 2025-12-04 10:38:58, mt_sch_mrg_init, succ with data quota 31068 M
MTL: 2025-12-04 10:38:58, sch_request(0), name sch_0 with 16 tasklets, type 0 socket 0
MTL: 2025-12-04 10:38:58, mt_sch_add_quota(0:0), quota 0 total now 0
MTL: 2025-12-04 10:38:58, tx_socket_init_thread_data(0), fd 173 for thread 0
MTL: 2025-12-04 10:38:58, mt_tx_socket_get(0), fd 173 ip 0.0.0.0, port 0, threads 1 gso_sz 0
MTL: 2025-12-04 10:38:58, mt_cni_init, no cni for all ports
MTL: 2025-12-04 10:38:58, st_plugins_init, succ
MTL: 2025-12-04 10:38:58, admin_thread, start
MTL: 2025-12-04 10:38:58, Warn: config_parse_json, open json file kahawai.json fail
MTL: 2025-12-04 10:38:58, mt_ptp_port_id(0), port_number: 0000, clk_id: 5c:b9:01:ff:fe:9c:51:3c
MTL: 2025-12-04 10:38:58, mt_main_create, succ
MTL: 2025-12-04 10:38:58, mtl_init, succ, tsc_hz 2297300000
MTL: 2025-12-04 10:38:58, mtl_init, simd level avx2, flags 0x1
***** mtl_init: 0x2200368700
MTL: 2025-12-04 10:38:59, mt_calibrate_tsc, tscHz 2297345124
MTL: 2025-12-04 10:38:59, admin_thread, stop
MTL: 2025-12-04 10:38:59, mt_cni_uinit, no cni for all ports
MTL: 2025-12-04 10:38:59, sch_free_quota(0), quota 0 total now 0
MTL: 2025-12-04 10:38:59, mt_sch_put(0), ref_cnt now zero
MTL: 2025-12-04 10:38:59, Warn: sch_stop(0), not started
MTL: 2025-12-04 10:38:59, sch_free(0), start to free sch: sch_0
MTL: 2025-12-04 10:38:59, tx_socket_stat_dump(0,173), tx pkt 0 gso 0 try 0 on thread 0
MTL: 2025-12-04 10:38:59, mt_tx_socket_put(0,173), succ
MTL: 2025-12-04 10:38:59, sch_lcore_shm_uinit, remove shared memory as we are the last user
MTL: 2025-12-04 10:38:59, dev_stop_port(0), succ
MTL: 2025-12-04 10:38:59, mt_dev_free, succ
MTL: 2025-12-04 10:38:59, mt_main_free, succ
MTL: 2025-12-04 10:38:59, mt_mempool_free, free mempool R_P0Q0_MBUF_1
MTL: 2025-12-04 10:38:59, mt_mempool_free, free mempool T_P0_SYS_0
MTL: 2025-12-04 10:38:59, dev_close_port(0), succ
MTL: 2025-12-04 10:38:59, stat_thread, stop
MTL: 2025-12-04 10:38:59, mt_dev_uinit, succ
MTL: 2025-12-04 10:38:59, mtl_uninit, succ
***** mtl_uninit: 0
MTL: 2025-12-04 10:38:59, dev_eal_init, eal not support re-init
MTL: 2025-12-04 10:38:59, Error: mt_dev_init, dev_eal_init fail -5
MTL: 2025-12-04 10:38:59, Error: mtl_init, mt_dev_eal_init fail -5
***** mtl_init: (nil)
MTL: 2025-12-04 10:38:59, Error: mtl_uninit, null handle
***** mtl_uninit: -22

HW specification (please complete the following information):

  • MTL commit hash cae46cf
  • OS: Ubuntu 24.04

Additional context
No problem in 25.02, as far as I know (the app was working beautifully, but audio packets were being lost

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions