Skip to content

Prints out socket that is in use whenever core is also printed out. Also outputs socket ID to CSV. #308

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

Merged
merged 1 commit into from
Sep 2, 2021
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
38 changes: 19 additions & 19 deletions onvm/onvm_mgr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ master_thread_main(void) {
const uint64_t start_time = rte_get_tsc_cycles();
uint64_t total_rx_pkts;

RTE_LOG(INFO, APP, "Core %d: Running master thread\n", rte_lcore_id());
RTE_LOG(INFO, APP, "Socket %d, Core %d: Running master thread\n", rte_socket_id(), rte_lcore_id());

if (stats_destination == ONVM_STATS_WEB) {
RTE_LOG(INFO, APP, "ONVM stats can be viewed through the web console\n");
Expand Down Expand Up @@ -130,7 +130,7 @@ master_thread_main(void) {
rte_pdump_uninit();
#endif

RTE_LOG(INFO, APP, "Core %d: Initiating shutdown sequence\n", rte_lcore_id());
RTE_LOG(INFO, APP, "Socket %d, Core %d: Initiating shutdown sequence\n", rte_socket_id(), rte_lcore_id());

/* Stop all RX and TX threads */
worker_keep_running = 0;
Expand All @@ -140,7 +140,7 @@ master_thread_main(void) {
if (nfs[i].status != NF_RUNNING)
continue;

RTE_LOG(INFO, APP, "Core %d: Notifying NF %" PRIu16 " to shut down\n", rte_lcore_id(), i);
RTE_LOG(INFO, APP, "Socket %d, Core %d: Notifying NF %" PRIu16 " to shut down\n", rte_socket_id(), rte_lcore_id(), i);
onvm_nf_send_msg(i, MSG_STOP, NULL);

/* If in shared core mode NFs might be sleeping */
Expand All @@ -154,13 +154,13 @@ master_thread_main(void) {
/* Wait to process all exits */
for (shutdown_iter_count = 0; shutdown_iter_count < MAX_SHUTDOWN_ITERS && num_nfs > 0; shutdown_iter_count++) {
onvm_nf_check_status();
RTE_LOG(INFO, APP, "Core %d: Waiting for %" PRIu16 " NFs to exit\n", rte_lcore_id(), num_nfs);
RTE_LOG(INFO, APP, "Socket %d, Core %d: Waiting for %" PRIu16 " NFs to exit\n", rte_socket_id(), rte_lcore_id(), num_nfs);
sleep(sleeptime);
}

if (num_nfs > 0) {
RTE_LOG(INFO, APP, "Core %d: Up to %" PRIu16 " NFs may still be running and must be killed manually\n",
rte_lcore_id(), num_nfs);
RTE_LOG(INFO, APP, "Socket %d, Core %d: Up to %" PRIu16 " NFs may still be running and must be killed manually\n",
rte_socket_id(), rte_lcore_id(), num_nfs);
}

/* Clean up the shared memory */
Expand All @@ -171,7 +171,7 @@ master_thread_main(void) {
}
}

RTE_LOG(INFO, APP, "Core %d: Master thread done\n", rte_lcore_id());
RTE_LOG(INFO, APP, "Socket %d, Core %d: Master thread done\n", rte_socket_id(), rte_lcore_id());
}

/*
Expand All @@ -186,7 +186,7 @@ rx_thread_main(void *arg) {
cur_lcore = rte_lcore_id();

onvm_stats_gen_event_info("Rx Start", ONVM_EVENT_WITH_CORE, &cur_lcore);
RTE_LOG(INFO, APP, "Core %d: Running RX thread for RX queue %d\n", cur_lcore, rx_mgr->id);
RTE_LOG(INFO, APP, "Socket %d, Core %d: Running RX thread for RX queue %d\n", rte_socket_id(), cur_lcore, rx_mgr->id);

for (; worker_keep_running;) {
/* Read ports */
Expand All @@ -206,7 +206,7 @@ rx_thread_main(void *arg) {
}
}

RTE_LOG(INFO, APP, "Core %d: RX thread done\n", rte_lcore_id());
RTE_LOG(INFO, APP, "Socket %d, Core %d: RX thread done\n", rte_socket_id(), rte_lcore_id());
return 0;
}

Expand All @@ -220,10 +220,10 @@ tx_thread_main(void *arg) {

onvm_stats_gen_event_info("Tx Start", ONVM_EVENT_WITH_CORE, &cur_lcore);
if (tx_mgr->tx_thread_info->first_nf == tx_mgr->tx_thread_info->last_nf - 1) {
RTE_LOG(INFO, APP, "Core %d: Running TX thread for NF %d\n", cur_lcore,
RTE_LOG(INFO, APP, "Socket %d, Core %d: Running TX thread for NF %d\n", rte_socket_id(), cur_lcore,
tx_mgr->tx_thread_info->first_nf);
} else if (tx_mgr->tx_thread_info->first_nf < tx_mgr->tx_thread_info->last_nf) {
RTE_LOG(INFO, APP, "Core %d: Running TX thread for NFs %d to %d\n", cur_lcore,
RTE_LOG(INFO, APP, "Socket %d, Core %d: Running TX thread for NFs %d to %d\n", rte_socket_id(), cur_lcore,
tx_mgr->tx_thread_info->first_nf, tx_mgr->tx_thread_info->last_nf - 1);
}

Expand All @@ -250,7 +250,7 @@ tx_thread_main(void *arg) {
onvm_pkt_flush_all_nfs(tx_mgr, NULL);
}

RTE_LOG(INFO, APP, "Core %d: TX thread done\n", rte_lcore_id());
RTE_LOG(INFO, APP, "Socket %d, Core %d: TX thread done\n", rte_socket_id(), rte_lcore_id());
return 0;
}

Expand All @@ -276,10 +276,10 @@ wakeup_thread_main(void *arg) {
struct wakeup_thread_context *wakeup_ctx = (struct wakeup_thread_context *)arg;

if (wakeup_ctx->first_nf == wakeup_ctx->last_nf - 1) {
RTE_LOG(INFO, APP, "Core %d: Running Wakeup thread for NF %d\n", rte_lcore_id(),
RTE_LOG(INFO, APP, "Socket %d, Core %d: Running Wakeup thread for NF %d\n", rte_socket_id(), rte_lcore_id(),
wakeup_ctx->first_nf);
} else if (wakeup_ctx->first_nf < wakeup_ctx->last_nf) {
RTE_LOG(INFO, APP, "Core %d: Running Wakeup thread for NFs %d to %d\n", rte_lcore_id(),
RTE_LOG(INFO, APP, "Socket %d, Core %d: Running Wakeup thread for NFs %d to %d\n", rte_socket_id(), rte_lcore_id(),
wakeup_ctx->first_nf, wakeup_ctx->last_nf - 1);
}

Expand Down Expand Up @@ -379,7 +379,7 @@ main(int argc, char *argv[]) {
/* Offset cur_lcore to start assigning TX cores */
cur_lcore += (rx_lcores - 1);

RTE_LOG(INFO, APP, "%d cores available in total\n", rte_lcore_count());
RTE_LOG(INFO, APP, "%d Sockets, %d Cores available in total\n", rte_socket_count(), rte_lcore_count());
RTE_LOG(INFO, APP, "%d cores available for handling manager RX queues\n", rx_lcores);
RTE_LOG(INFO, APP, "%d cores available for handling TX queues\n", tx_lcores);
if (ONVM_NF_SHARE_CORES)
Expand Down Expand Up @@ -432,7 +432,7 @@ main(int argc, char *argv[]) {
tx_mgr[i]->tx_thread_info->last_nf = RTE_MIN((i + 1) * nfs_per_tx + 1, (unsigned)MAX_NFS);
cur_lcore = rte_get_next_lcore(cur_lcore, 1, 1);
if (rte_eal_remote_launch(tx_thread_main, (void *)tx_mgr[i], cur_lcore) == -EBUSY) {
RTE_LOG(ERR, APP, "Core %d is already busy, can't use for nf %d TX\n", cur_lcore,
RTE_LOG(ERR, APP, "Socket %d, Core %d is already busy, can't use for nf %d TX\n", rte_socket_id(), cur_lcore,
tx_mgr[i]->tx_thread_info->first_nf);
onvm_main_free(tx_lcores,rx_lcores, tx_mgr, rx_mgr, wakeup_ctx);
return -1;
Expand All @@ -454,7 +454,7 @@ main(int argc, char *argv[]) {
}
cur_lcore = rte_get_next_lcore(cur_lcore, 1, 1);
if (rte_eal_remote_launch(rx_thread_main, (void *)rx_mgr[i], cur_lcore) == -EBUSY) {
RTE_LOG(ERR, APP, "Core %d is already busy, can't use for RX queue id %d\n", cur_lcore,
RTE_LOG(ERR, APP, "Socket %d, Core %d is already busy, can't use for RX queue id %d\n", rte_socket_id(), cur_lcore,
rx_mgr[i]->id);
onvm_main_free(tx_lcores,rx_lcores, tx_mgr, rx_mgr, wakeup_ctx);
return -1;
Expand All @@ -472,8 +472,8 @@ main(int argc, char *argv[]) {
wakeup_ctx[i]->last_nf = RTE_MIN((i + 1) * nfs_per_wakeup_thread + 1, (unsigned)MAX_NFS);
cur_lcore = rte_get_next_lcore(cur_lcore, 1, 1);
if (rte_eal_remote_launch(wakeup_thread_main, (void*)wakeup_ctx[i], cur_lcore) == -EBUSY) {
RTE_LOG(ERR, APP, "Core %d is already busy, can't use for nf %d wakeup thread\n",
cur_lcore, wakeup_ctx[i]->first_nf);
RTE_LOG(ERR, APP, "Socket %d, Core %d is already busy, can't use for nf %d wakeup thread\n",
rte_socket_id(), cur_lcore, wakeup_ctx[i]->first_nf);
onvm_main_free(tx_lcores, rx_lcores, tx_mgr, rx_mgr, wakeup_ctx);
return -1;
}
Expand Down
6 changes: 4 additions & 2 deletions onvm/onvm_nflib/onvm_nflib.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ onvm_nflib_start_nf(struct onvm_nf_local_ctx *nf_local_ctx, struct onvm_nf_init_

RTE_LOG(INFO, APP, "Using Instance ID %d\n", nf->instance_id);
RTE_LOG(INFO, APP, "Using Service ID %d\n", nf->service_id);
RTE_LOG(INFO, APP, "Running on core %d\n", nf->thread_info.core);
RTE_LOG(INFO, APP, "Running on Socket %d, Core %d\n", rte_socket_id(), nf->thread_info.core);

if (nf->flags.time_to_live)
RTE_LOG(INFO, APP, "Time to live set to %u\n", nf->flags.time_to_live);
Expand Down Expand Up @@ -1321,7 +1321,7 @@ onvm_nflib_stats_summary_output(uint16_t id) {
const char clr[] = {27, '[', '2', 'J', '\0'};
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
const char *csv_suffix = "_stats.csv";
const char *csv_stats_headers = "NF tag, NF instance ID, NF service ID, NF assigned core, RX total,"
const char *csv_stats_headers = "NF tag, NF instance ID, NF service ID, NF assigned socket, NF assigned core, RX total,"
"RX total dropped, TX total, TX total dropped, NF sent out, NF sent to NF,"
"NF dropped, NF next, NF tx buffered, NF tx buffered, NF tx returned";
const uint64_t rx = nfs[id].stats.rx;
Expand All @@ -1348,6 +1348,7 @@ onvm_nflib_stats_summary_output(uint16_t id) {
printf("NF tag: %s\n", nf_tag);
printf("NF instance ID: %d\n", instance_id);
printf("NF service ID: %d\n", service_id);
printf("NF assigned socket: %d\n", rte_socket_id());
printf("NF assigned core: %d\n", core);
printf("----------------------------------------------------\n");
printf("RX total: %ld\n", rx);
Expand Down Expand Up @@ -1390,6 +1391,7 @@ onvm_nflib_stats_summary_output(uint16_t id) {
fprintf(csv_fp, "\n%s", nf_tag);
fprintf(csv_fp, ", %d", instance_id);
fprintf(csv_fp, ", %d", service_id);
fprintf(csv_fp, ", %d", rte_socket_id());
fprintf(csv_fp, ", %d", core);
fprintf(csv_fp, ", %ld", rx);
fprintf(csv_fp, ", %ld", rx_drop);
Expand Down