aboutsummaryrefslogtreecommitdiffstats
path: root/vpp
diff options
context:
space:
mode:
authorDave Barach <dbarach@cisco.com>2016-04-22 09:54:22 -0400
committerDave Barach <dbarach@cisco.com>2016-04-22 09:54:33 -0400
commit2b836cf4d1e4e59ca34229a9fdf49d79216da20e (patch)
treead9e5acabd3702c33a4247fce2adbcbd4a390859 /vpp
parentdaede645441e72cdca631cef7b687e74183cc146 (diff)
Add a vpp_restart command
vpp_restart solves the problem of restarting vpp and not exiting until the new vpp instance is sufficiently established to allow immediate binary API connections. The point is to avoid using arbitrary "sleep N" commands e.g. in CSIT shell scripts. We send SIGTERM to the current vpp process, and expect / depend on the process-monitor du jour to remove the vpp-api shared-memory segment. vpp_restart exits w/ status 0 if all is well, non-zero upon failure. In trying to make vpp_restart reliable, we discovered a recently-introduced heap corruption bug in .../dpdk/init.c, which caused vpp to crash on startup once every 20 times on a particular rig. If possible, we should check /var/log/syslog for evidence of unexpected multiple restarts during regression-testing. Change-Id: Ic48c74b1a94a4368066ba2e326d4b12d51192088 Signed-off-by: Dave Barach <dbarach@cisco.com>
Diffstat (limited to 'vpp')
-rw-r--r--vpp/api/gmon.c16
-rw-r--r--vpp/app/version.c1
2 files changed, 13 insertions, 4 deletions
diff --git a/vpp/api/gmon.c b/vpp/api/gmon.c
index 32786d63b38..8ab890fceb4 100644
--- a/vpp/api/gmon.c
+++ b/vpp/api/gmon.c
@@ -92,6 +92,18 @@ static u64 get_significant_errors(gmon_main_t * gm)
return (significant_errors);
}
+static clib_error_t *
+publish_pid (vlib_main_t *vm)
+{
+ gmon_main_t *gm = &gmon_main;
+
+ *gm->vpef_pid_ptr = getpid();
+
+ return 0;
+}
+VLIB_API_INIT_FUNCTION(publish_pid);
+
+
static uword
gmon_process (vlib_main_t * vm,
vlib_node_runtime_t * rt,
@@ -101,12 +113,8 @@ gmon_process (vlib_main_t * vm,
u64 input_packets, last_input_packets, new_sig_errors;
f64 last_runtime, dt, now;
gmon_main_t *gm = &gmon_main;
- pid_t vpefpid;
int i;
- vpefpid = getpid();
- *gm->vpef_pid_ptr = vpefpid;
-
last_runtime = 0.0;
last_input_packets = 0;
diff --git a/vpp/app/version.c b/vpp/app/version.c
index 5eb1fc5aad1..588aadf29e9 100644
--- a/vpp/app/version.c
+++ b/vpp/app/version.c
@@ -59,6 +59,7 @@ show_vpe_version_command_fn (vlib_main_t * vm,
_("Compiler", "%s", vpe_compiler);
_("CPU model name", "%U", format_cpu_model_name);
_("CPU microarchitecture", "%U", format_cpu_uarch);
+ _("Current PID", "%d", getpid());
#if DPDK > 0
_("DPDK Version", "%s", rte_version());
_("DPDK EAL init args", "%s", dpdk_main.eal_init_args_str);