Skip to content

Commit d6483ed

Browse files
authored
[Logging] Log physical socket in use
Logs the physical socket ID whenever logical core ID is also printed out, and outputs socket ID to CSV in the NF directory. Commit log: * Print out physical socket ID
1 parent 07fc800 commit d6483ed

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

onvm/onvm_mgr/main.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ master_thread_main(void) {
8484
const uint64_t start_time = rte_get_tsc_cycles();
8585
uint64_t total_rx_pkts;
8686

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

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

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

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

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

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

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

166166
/* Clean up the shared memory */
@@ -171,7 +171,7 @@ master_thread_main(void) {
171171
}
172172
}
173173

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

177177
/*
@@ -186,7 +186,7 @@ rx_thread_main(void *arg) {
186186
cur_lcore = rte_lcore_id();
187187

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

191191
for (; worker_keep_running;) {
192192
/* Read ports */
@@ -206,7 +206,7 @@ rx_thread_main(void *arg) {
206206
}
207207
}
208208

209-
RTE_LOG(INFO, APP, "Core %d: RX thread done\n", rte_lcore_id());
209+
RTE_LOG(INFO, APP, "Socket %d, Core %d: RX thread done\n", rte_socket_id(), rte_lcore_id());
210210
return 0;
211211
}
212212

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

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

@@ -250,7 +250,7 @@ tx_thread_main(void *arg) {
250250
onvm_pkt_flush_all_nfs(tx_mgr, NULL);
251251
}
252252

253-
RTE_LOG(INFO, APP, "Core %d: TX thread done\n", rte_lcore_id());
253+
RTE_LOG(INFO, APP, "Socket %d, Core %d: TX thread done\n", rte_socket_id(), rte_lcore_id());
254254
return 0;
255255
}
256256

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

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

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

382-
RTE_LOG(INFO, APP, "%d cores available in total\n", rte_lcore_count());
382+
RTE_LOG(INFO, APP, "%d Sockets, %d Cores available in total\n", rte_socket_count(), rte_lcore_count());
383383
RTE_LOG(INFO, APP, "%d cores available for handling manager RX queues\n", rx_lcores);
384384
RTE_LOG(INFO, APP, "%d cores available for handling TX queues\n", tx_lcores);
385385
if (ONVM_NF_SHARE_CORES)
@@ -432,7 +432,7 @@ main(int argc, char *argv[]) {
432432
tx_mgr[i]->tx_thread_info->last_nf = RTE_MIN((i + 1) * nfs_per_tx + 1, (unsigned)MAX_NFS);
433433
cur_lcore = rte_get_next_lcore(cur_lcore, 1, 1);
434434
if (rte_eal_remote_launch(tx_thread_main, (void *)tx_mgr[i], cur_lcore) == -EBUSY) {
435-
RTE_LOG(ERR, APP, "Core %d is already busy, can't use for nf %d TX\n", cur_lcore,
435+
RTE_LOG(ERR, APP, "Socket %d, Core %d is already busy, can't use for nf %d TX\n", rte_socket_id(), cur_lcore,
436436
tx_mgr[i]->tx_thread_info->first_nf);
437437
onvm_main_free(tx_lcores,rx_lcores, tx_mgr, rx_mgr, wakeup_ctx);
438438
return -1;
@@ -454,7 +454,7 @@ main(int argc, char *argv[]) {
454454
}
455455
cur_lcore = rte_get_next_lcore(cur_lcore, 1, 1);
456456
if (rte_eal_remote_launch(rx_thread_main, (void *)rx_mgr[i], cur_lcore) == -EBUSY) {
457-
RTE_LOG(ERR, APP, "Core %d is already busy, can't use for RX queue id %d\n", cur_lcore,
457+
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,
458458
rx_mgr[i]->id);
459459
onvm_main_free(tx_lcores,rx_lcores, tx_mgr, rx_mgr, wakeup_ctx);
460460
return -1;
@@ -472,8 +472,8 @@ main(int argc, char *argv[]) {
472472
wakeup_ctx[i]->last_nf = RTE_MIN((i + 1) * nfs_per_wakeup_thread + 1, (unsigned)MAX_NFS);
473473
cur_lcore = rte_get_next_lcore(cur_lcore, 1, 1);
474474
if (rte_eal_remote_launch(wakeup_thread_main, (void*)wakeup_ctx[i], cur_lcore) == -EBUSY) {
475-
RTE_LOG(ERR, APP, "Core %d is already busy, can't use for nf %d wakeup thread\n",
476-
cur_lcore, wakeup_ctx[i]->first_nf);
475+
RTE_LOG(ERR, APP, "Socket %d, Core %d is already busy, can't use for nf %d wakeup thread\n",
476+
rte_socket_id(), cur_lcore, wakeup_ctx[i]->first_nf);
477477
onvm_main_free(tx_lcores, rx_lcores, tx_mgr, rx_mgr, wakeup_ctx);
478478
return -1;
479479
}

onvm/onvm_nflib/onvm_nflib.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ onvm_nflib_start_nf(struct onvm_nf_local_ctx *nf_local_ctx, struct onvm_nf_init_
533533

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

538538
if (nf->flags.time_to_live)
539539
RTE_LOG(INFO, APP, "Time to live set to %u\n", nf->flags.time_to_live);
@@ -1328,7 +1328,7 @@ onvm_nflib_stats_summary_output(uint16_t id) {
13281328
const char clr[] = {27, '[', '2', 'J', '\0'};
13291329
const char topLeft[] = {27, '[', '1', ';', '1', 'H', '\0'};
13301330
const char *csv_suffix = "_stats.csv";
1331-
const char *csv_stats_headers = "NF tag, NF instance ID, NF service ID, NF assigned core, RX total,"
1331+
const char *csv_stats_headers = "NF tag, NF instance ID, NF service ID, NF assigned socket, NF assigned core, RX total,"
13321332
"RX total dropped, TX total, TX total dropped, NF sent out, NF sent to NF,"
13331333
"NF dropped, NF next, NF tx buffered, NF tx buffered, NF tx returned";
13341334
const uint64_t rx = nfs[id].stats.rx;
@@ -1355,6 +1355,7 @@ onvm_nflib_stats_summary_output(uint16_t id) {
13551355
printf("NF tag: %s\n", nf_tag);
13561356
printf("NF instance ID: %d\n", instance_id);
13571357
printf("NF service ID: %d\n", service_id);
1358+
printf("NF assigned socket: %d\n", rte_socket_id());
13581359
printf("NF assigned core: %d\n", core);
13591360
printf("----------------------------------------------------\n");
13601361
printf("RX total: %ld\n", rx);
@@ -1397,6 +1398,7 @@ onvm_nflib_stats_summary_output(uint16_t id) {
13971398
fprintf(csv_fp, "\n%s", nf_tag);
13981399
fprintf(csv_fp, ", %d", instance_id);
13991400
fprintf(csv_fp, ", %d", service_id);
1401+
fprintf(csv_fp, ", %d", rte_socket_id());
14001402
fprintf(csv_fp, ", %d", core);
14011403
fprintf(csv_fp, ", %ld", rx);
14021404
fprintf(csv_fp, ", %ld", rx_drop);

0 commit comments

Comments
 (0)