aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-06-14 17:29:55 -0400
committerDave Barach <dave@barachs.net>2019-06-14 17:30:30 -0400
commitc898a4f5bae84148ddec462a9510dee99e3da67d (patch)
treecf6a59693a66c4ce60390d49dc0fd4f2382f8b7b
parentd83c4a8d70cfd9dc8c5af3d7391d2ea6a67aa480 (diff)
api: add mp-safe/barrier-sync indication to elogs
Costs nothing, and leaves nothing to the imagination. Type: fix Change-Id: I7c9f9fb9325475c268eca062da7bbbf014438cfc Signed-off-by: Dave Barach <dave@barachs.net>
-rw-r--r--src/vlibapi/api_shared.c23
-rw-r--r--src/vlibmemory/memory_api.c1
2 files changed, 18 insertions, 6 deletions
diff --git a/src/vlibapi/api_shared.c b/src/vlibapi/api_shared.c
index 77a18c9e73c..5b45b24ffb5 100644
--- a/src/vlibapi/api_shared.c
+++ b/src/vlibapi/api_shared.c
@@ -469,6 +469,7 @@ vl_msg_api_handler_with_vm_node (api_main_t * am,
u16 id = ntohs (*((u16 *) the_msg));
u8 *(*handler) (void *, void *, void *);
u8 *(*print_fp) (void *, void *);
+ int is_mp_safe = 1;
if (PREDICT_FALSE (vm->elog_trace_api_messages))
{
@@ -510,14 +511,15 @@ vl_msg_api_handler_with_vm_node (api_main_t * am,
(*print_fp) (the_msg, vm);
}
}
+ is_mp_safe = am->is_mp_safe[id];
- if (!am->is_mp_safe[id])
+ if (!is_mp_safe)
{
vl_msg_api_barrier_trace_context (am->msg_names[id]);
vl_msg_api_barrier_sync ();
}
(*handler) (the_msg, vm, node);
- if (!am->is_mp_safe[id])
+ if (!is_mp_safe)
vl_msg_api_barrier_release ();
}
else
@@ -535,14 +537,22 @@ vl_msg_api_handler_with_vm_node (api_main_t * am,
if (PREDICT_FALSE (vm->elog_trace_api_messages))
{
/* *INDENT-OFF* */
- ELOG_TYPE_DECLARE (e) = {
- .format = "api-msg-done: %s",
- .format_args = "T4",
- };
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "api-msg-done(%s): %s",
+ .format_args = "t4T4",
+ .n_enum_strings = 2,
+ .enum_strings =
+ {
+ "barrier",
+ "mp-safe",
+ }
+ };
/* *INDENT-ON* */
struct
{
+ u32 barrier;
u32 c;
} *ed;
ed = ELOG_DATA (&vm->elog_main, e);
@@ -550,6 +560,7 @@ vl_msg_api_handler_with_vm_node (api_main_t * am,
ed->c = elog_id_for_msg_name (vm, (const char *) am->msg_names[id]);
else
ed->c = elog_id_for_msg_name (vm, "BOGUS");
+ ed->barrier = is_mp_safe;
}
}
diff --git a/src/vlibmemory/memory_api.c b/src/vlibmemory/memory_api.c
index 10425dd971c..123aa22f07f 100644
--- a/src/vlibmemory/memory_api.c
+++ b/src/vlibmemory/memory_api.c
@@ -466,6 +466,7 @@ vl_mem_api_init (const char *region_name)
*/
am->message_bounce[VL_API_MEMCLNT_DELETE] = 1;
am->is_mp_safe[VL_API_MEMCLNT_KEEPALIVE_REPLY] = 1;
+ am->is_mp_safe[VL_API_MEMCLNT_KEEPALIVE] = 1;
vlib_set_queue_signal_callback (vm, memclnt_queue_callback);