}
close (fd);
+ CLIB_MEM_UNPOISON (hp, file_size);
+
nitems = ntohl (hp->nitems);
if (last_index == (u32) ~ 0)
vlib_cli_output (vm, "Range (%d, %d) outside file range (0, %d)\n",
first_index, last_index, nitems - 1);
munmap (hp, file_size);
+ CLIB_MEM_POISON (hp, file_size);
return;
}
if (hp->wrapped)
saved_print_handlers = (void **) vec_dup (am->msg_print_handlers);
vl_msg_api_custom_dump_configure (am);
}
+
msg = (u8 *) (hp + 1);
u16 *msgid_vec = 0;
{
vlib_cli_output (vm, "Ugh: msg id %d no trace config\n", msg_id);
munmap (hp, file_size);
+ CLIB_MEM_POISON (hp, file_size);
return;
}
msg += size;
{
vlib_cli_output (vm, "Ugh: msg id %d no trace config\n", msg_id);
munmap (hp, file_size);
+ CLIB_MEM_POISON (hp, file_size);
vec_free (tmpbuf);
am->replay_in_progress = 0;
return;
{
vlib_cli_output (vm, "Ugh: msg id %d no endian swap\n", msg_id);
munmap (hp, file_size);
+ CLIB_MEM_POISON (hp, file_size);
vec_free (tmpbuf);
am->replay_in_progress = 0;
return;
}
munmap (hp, file_size);
+ CLIB_MEM_POISON (hp, file_size);
vec_free (tmpbuf);
am->replay_in_progress = 0;
}
+/** api_trace_command_fn - control the binary API trace / replay feature
+
+ Note: this command MUST be marked thread-safe. Replay with
+ multiple worker threads depends in many cases on worker thread
+ graph replica maintenance. If we (implicitly) assert a worker
+ thread barrier at the debug CLI level, all graph replica changes
+ are deferred until the replay operation completes. If an interface
+ is deleted, the wheels fall off.
+ */
+
static clib_error_t *
api_trace_command_fn (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
if (unformat (input, "nitems %d", &nitems))
;
+ vlib_worker_thread_barrier_sync (vm);
vl_msg_api_trace_configure (am, which, nitems);
vl_msg_api_trace_onoff (am, which, 1 /* on */ );
+ vlib_worker_thread_barrier_release (vm);
}
else if (unformat (input, "off"))
{
+ vlib_worker_thread_barrier_sync (vm);
vl_msg_api_trace_onoff (am, which, 0);
+ vlib_worker_thread_barrier_release (vm);
}
else if (unformat (input, "save %s", &filename))
{
vlib_cli_output (vm, "Couldn't create %s\n", chroot_filename);
goto out;
}
+ vlib_worker_thread_barrier_sync (vm);
rv = vl_msg_api_trace_save (am, which, fp);
+ vlib_worker_thread_barrier_release (vm);
fclose (fp);
if (rv == -1)
vlib_cli_output (vm, "API Trace data not present\n");
}
else if (unformat (input, "free"))
{
+ vlib_worker_thread_barrier_sync (vm);
vl_msg_api_trace_onoff (am, which, 0);
vl_msg_api_trace_free (am, which);
+ vlib_worker_thread_barrier_release (vm);
}
else if (unformat (input, "post-mortem-on"))
vl_msg_api_post_mortem_dump_enable_disable (1 /* enable */ );
{
.path = "api trace",
.short_help = "api trace [on|off][first <n>][last <n>][status][free]"
- "[post-mortem-on][dump|custom-dump|save|replay <file>]",
+ "[post-mortem-on][dump|custom-dump|save|replay <file>]",
.function = api_trace_command_fn,
+ .is_mp_safe = 1,
};
/* *INDENT-ON* */