summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vat/api_format.c21
-rw-r--r--src/vlibapi/api_common.h2
-rw-r--r--src/vlibapi/api_shared.c20
-rw-r--r--src/vlibmemory/memory_api.c52
-rw-r--r--src/vlibmemory/memory_client.c14
-rw-r--r--src/vlibmemory/memory_shared.c15
-rw-r--r--src/vnet/session/session.c5
-rw-r--r--src/vpp/api/api.c23
-rw-r--r--src/vpp/api/api_main.c10
9 files changed, 61 insertions, 101 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index e4ef0b4916b..ff61e9a99d1 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -1100,7 +1100,6 @@ vl_api_cli_reply_t_handler_json (vl_api_cli_reply_t * mp)
{
vat_main_t *vam = &vat_main;
vat_json_node_t node;
- api_main_t *am = vlibapi_get_main ();
void *oldheap;
u8 *reply;
@@ -1109,14 +1108,12 @@ vl_api_cli_reply_t_handler_json (vl_api_cli_reply_t * mp)
vat_json_object_add_uint (&node, "reply_in_shmem",
ntohl (mp->reply_in_shmem));
/* Toss the shared-memory original... */
- pthread_mutex_lock (&am->vlib_rp->mutex);
- oldheap = svm_push_data_heap (am->vlib_rp);
+ oldheap = vl_msg_push_heap ();
reply = uword_to_pointer (mp->reply_in_shmem, u8 *);
vec_free (reply);
- svm_pop_heap (oldheap);
- pthread_mutex_unlock (&am->vlib_rp->mutex);
+ vl_msg_pop_heap (oldheap);
vat_json_print (vam->ofp, &node);
vat_json_free (&node);
@@ -2710,7 +2707,6 @@ static void vl_api_get_node_graph_reply_t_handler
(vl_api_get_node_graph_reply_t * mp)
{
vat_main_t *vam = &vat_main;
- api_main_t *am = vlibapi_get_main ();
i32 retval = ntohl (mp->retval);
u8 *pvt_copy, *reply;
void *oldheap;
@@ -2735,13 +2731,11 @@ static void vl_api_get_node_graph_reply_t_handler
pvt_copy = vec_dup (reply);
/* Toss the shared-memory original... */
- pthread_mutex_lock (&am->vlib_rp->mutex);
- oldheap = svm_push_data_heap (am->vlib_rp);
+ oldheap = vl_msg_push_heap ();
vec_free (reply);
- svm_pop_heap (oldheap);
- pthread_mutex_unlock (&am->vlib_rp->mutex);
+ vl_msg_pop_heap (oldheap);
if (vam->graph_nodes)
{
@@ -2773,7 +2767,6 @@ static void vl_api_get_node_graph_reply_t_handler_json
(vl_api_get_node_graph_reply_t * mp)
{
vat_main_t *vam = &vat_main;
- api_main_t *am = vlibapi_get_main ();
void *oldheap;
vat_json_node_t node;
u8 *reply;
@@ -2786,13 +2779,11 @@ static void vl_api_get_node_graph_reply_t_handler_json
reply = uword_to_pointer (mp->reply_in_shmem, u8 *);
/* Toss the shared-memory original... */
- pthread_mutex_lock (&am->vlib_rp->mutex);
- oldheap = svm_push_data_heap (am->vlib_rp);
+ oldheap = vl_msg_push_heap ();
vec_free (reply);
- svm_pop_heap (oldheap);
- pthread_mutex_unlock (&am->vlib_rp->mutex);
+ vl_msg_pop_heap (oldheap);
vat_json_print (vam->ofp, &node);
vat_json_free (&node);
diff --git a/src/vlibapi/api_common.h b/src/vlibapi/api_common.h
index 4d401046174..2105f1bd430 100644
--- a/src/vlibapi/api_common.h
+++ b/src/vlibapi/api_common.h
@@ -201,7 +201,9 @@ void vl_msg_api_set_first_available_msg_id (u16 first_avail);
u16 vl_msg_api_get_msg_ids (const char *name, int n);
u32 vl_msg_api_get_msg_index (u8 * name_and_crc);
void *vl_msg_push_heap (void);
+void *vl_msg_push_heap_w_region (svm_region_t * vlib_rp);
void vl_msg_pop_heap (void *oldheap);
+void vl_msg_pop_heap_w_region (svm_region_t * vlib_rp, void *oldheap);
typedef clib_error_t *(vl_msg_api_init_function_t) (u32 client_index);
diff --git a/src/vlibapi/api_shared.c b/src/vlibapi/api_shared.c
index a553a5b5b95..aba853dc997 100644
--- a/src/vlibapi/api_shared.c
+++ b/src/vlibapi/api_shared.c
@@ -1064,19 +1064,31 @@ vl_msg_api_get_msg_index (u8 * name_and_crc)
}
void *
+vl_msg_push_heap_w_region (svm_region_t * vlib_rp)
+{
+ pthread_mutex_lock (&vlib_rp->mutex);
+ return svm_push_data_heap (vlib_rp);
+}
+
+void *
vl_msg_push_heap (void)
{
api_main_t *am = vlibapi_get_main ();
- pthread_mutex_lock (&am->vlib_rp->mutex);
- return svm_push_data_heap (am->vlib_rp);
+ return vl_msg_push_heap_w_region (am->vlib_rp);
+}
+
+void
+vl_msg_pop_heap_w_region (svm_region_t * vlib_rp, void *oldheap)
+{
+ svm_pop_heap (oldheap);
+ pthread_mutex_unlock (&vlib_rp->mutex);
}
void
vl_msg_pop_heap (void *oldheap)
{
api_main_t *am = vlibapi_get_main ();
- svm_pop_heap (oldheap);
- pthread_mutex_unlock (&am->vlib_rp->mutex);
+ vl_msg_pop_heap_w_region (am->vlib_rp, oldheap);
}
int
diff --git a/src/vlibmemory/memory_api.c b/src/vlibmemory/memory_api.c
index 8c633e20223..b5f3fae232e 100644
--- a/src/vlibmemory/memory_api.c
+++ b/src/vlibmemory/memory_api.c
@@ -121,31 +121,27 @@ vl_api_memclnt_create_internal (char *name, svm_queue_t * q)
{
vl_api_registration_t **regpp;
vl_api_registration_t *regp;
- svm_region_t *svm;
void *oldheap;
api_main_t *am = vlibapi_get_main ();
ASSERT (vlib_get_thread_index () == 0);
pool_get (am->vl_clients, regpp);
- svm = am->vlib_rp;
- pthread_mutex_lock (&svm->mutex);
- oldheap = svm_push_data_heap (svm);
+ oldheap = vl_msg_push_heap ();
*regpp = clib_mem_alloc (sizeof (vl_api_registration_t));
regp = *regpp;
clib_memset (regp, 0, sizeof (*regp));
regp->registration_type = REGISTRATION_TYPE_SHMEM;
regp->vl_api_registration_pool_index = regpp - am->vl_clients;
- regp->vlib_rp = svm;
+ regp->vlib_rp = am->vlib_rp;
regp->shmem_hdr = am->shmem_hdr;
regp->vl_input_queue = q;
regp->name = format (0, "%s%c", name, 0);
- pthread_mutex_unlock (&svm->mutex);
- svm_pop_heap (oldheap);
+ vl_msg_pop_heap (oldheap);
return vl_msg_api_handle_from_index_and_epoch
(regp->vl_api_registration_pool_index,
am->shmem_hdr->application_restarts);
@@ -160,7 +156,6 @@ vl_api_memclnt_create_t_handler (vl_api_memclnt_create_t * mp)
vl_api_registration_t **regpp;
vl_api_registration_t *regp;
vl_api_memclnt_create_reply_t *rp;
- svm_region_t *svm;
svm_queue_t *q;
int rv = 0;
void *oldheap;
@@ -195,17 +190,14 @@ vl_api_memclnt_create_t_handler (vl_api_memclnt_create_t * mp)
pool_get (am->vl_clients, regpp);
- svm = am->vlib_rp;
-
- pthread_mutex_lock (&svm->mutex);
- oldheap = svm_push_data_heap (svm);
+ oldheap = vl_msg_push_heap ();
*regpp = clib_mem_alloc (sizeof (vl_api_registration_t));
regp = *regpp;
clib_memset (regp, 0, sizeof (*regp));
regp->registration_type = REGISTRATION_TYPE_SHMEM;
regp->vl_api_registration_pool_index = regpp - am->vl_clients;
- regp->vlib_rp = svm;
+ regp->vlib_rp = am->vlib_rp;
regp->shmem_hdr = am->shmem_hdr;
regp->clib_file_index = am->shmem_hdr->clib_file_index;
@@ -224,8 +216,7 @@ vl_api_memclnt_create_t_handler (vl_api_memclnt_create_t * mp)
else
msg_table = am->serialized_message_table_in_shmem;
- pthread_mutex_unlock (&svm->mutex);
- svm_pop_heap (oldheap);
+ vl_msg_pop_heap (oldheap);
rp = vl_msg_api_alloc (sizeof (*rp));
rp->_vl_msg_id = ntohs (VL_API_MEMCLNT_CREATE_REPLY);
@@ -266,7 +257,6 @@ vl_api_memclnt_delete_t_handler (vl_api_memclnt_delete_t * mp)
vl_api_registration_t **regpp;
vl_api_registration_t *regp;
vl_api_memclnt_delete_reply_t *rp;
- svm_region_t *svm;
void *oldheap;
api_main_t *am = vlibapi_get_main ();
u32 handle, client_index, epoch;
@@ -294,7 +284,6 @@ vl_api_memclnt_delete_t_handler (vl_api_memclnt_delete_t * mp)
{
int i;
regp = *regpp;
- svm = am->vlib_rp;
int private_registration = 0;
/* Send reply unless client asked us to do the cleanup */
@@ -327,11 +316,11 @@ vl_api_memclnt_delete_t_handler (vl_api_memclnt_delete_t * mp)
for (i = 0; i < vec_len (am->vlib_private_rps); i++)
{
/* Is this a pairwise / private API segment? */
- if (am->vlib_private_rps[i] == svm)
+ if (am->vlib_private_rps[i] == am->vlib_rp)
{
/* Note: account for the memfd header page */
- uword virtual_base = svm->virtual_base - MMAP_PAGESIZE;
- uword virtual_size = svm->virtual_size + MMAP_PAGESIZE;
+ uword virtual_base = am->vlib_rp->virtual_base - MMAP_PAGESIZE;
+ uword virtual_size = am->vlib_rp->virtual_size + MMAP_PAGESIZE;
/*
* Kill the registration pool element before we make
@@ -355,16 +344,14 @@ vl_api_memclnt_delete_t_handler (vl_api_memclnt_delete_t * mp)
{
pool_put_index (am->vl_clients,
regp->vl_api_registration_pool_index);
- pthread_mutex_lock (&svm->mutex);
- oldheap = svm_push_data_heap (svm);
+ oldheap = vl_msg_push_heap ();
if (mp->do_cleanup)
svm_queue_free (regp->vl_input_queue);
vec_free (regp->name);
/* Poison the old registration */
clib_memset (regp, 0xF1, sizeof (*regp));
clib_mem_free (regp);
- pthread_mutex_unlock (&svm->mutex);
- svm_pop_heap (oldheap);
+ vl_msg_pop_heap (oldheap);
/*
* These messages must be freed manually, since they're set up
* as "bounce" messages. In the private_registration == 1 case,
@@ -617,7 +604,6 @@ vl_mem_api_dead_client_scan (api_main_t * am, vl_shmem_hdr_t * shm, f64 now)
if (PREDICT_FALSE (vec_len (dead_indices) > 0))
{
int i;
- svm_region_t *svm;
void *oldheap;
/* Allow the application to clean up its registrations */
@@ -634,9 +620,7 @@ vl_mem_api_dead_client_scan (api_main_t * am, vl_shmem_hdr_t * shm, f64 now)
}
}
- svm = am->vlib_rp;
- pthread_mutex_lock (&svm->mutex);
- oldheap = svm_push_data_heap (svm);
+ oldheap = vl_msg_push_heap ();
for (i = 0; i < vec_len (dead_indices); i++)
{
@@ -644,7 +628,7 @@ vl_mem_api_dead_client_scan (api_main_t * am, vl_shmem_hdr_t * shm, f64 now)
if (regpp)
{
/* Is this a pairwise SVM segment? */
- if ((*regpp)->vlib_rp != svm)
+ if ((*regpp)->vlib_rp != am->vlib_rp)
{
int i;
svm_region_t *dead_rp = (*regpp)->vlib_rp;
@@ -661,7 +645,7 @@ vl_mem_api_dead_client_scan (api_main_t * am, vl_shmem_hdr_t * shm, f64 now)
}
svm_pop_heap (oldheap);
clib_warning ("private rp %llx AWOL", dead_rp);
- oldheap = svm_push_data_heap (svm);
+ oldheap = svm_push_data_heap (am->vlib_rp);
found:
/* Kill it, accounting for the memfd header page */
@@ -670,7 +654,7 @@ vl_mem_api_dead_client_scan (api_main_t * am, vl_shmem_hdr_t * shm, f64 now)
clib_unix_warning ("munmap");
/* Reset the queue-length-address cache */
vec_reset_length (vl_api_queue_cursizes);
- oldheap = svm_push_data_heap (svm);
+ oldheap = svm_push_data_heap (am->vlib_rp);
}
else
{
@@ -686,14 +670,13 @@ vl_mem_api_dead_client_scan (api_main_t * am, vl_shmem_hdr_t * shm, f64 now)
svm_pop_heap (oldheap);
clib_warning ("Duplicate free, client index %d",
regpp - am->vl_clients);
- oldheap = svm_push_data_heap (svm);
+ oldheap = svm_push_data_heap (am->vlib_rp);
}
}
svm_client_scan_this_region_nolock (am->vlib_rp);
- pthread_mutex_unlock (&svm->mutex);
- svm_pop_heap (oldheap);
+ vl_msg_pop_heap (oldheap);
for (i = 0; i < vec_len (dead_indices); i++)
pool_put_index (am->vl_clients, dead_indices[i]);
}
@@ -776,7 +759,6 @@ vl_mem_api_handle_msg_private (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 reg_index)
{
api_main_t *am = vlibapi_get_main ();
-
return void_mem_api_handle_msg_i (am, am->vlib_private_rps[reg_index], vm,
node, 1 /* is_private */ );
}
diff --git a/src/vlibmemory/memory_client.c b/src/vlibmemory/memory_client.c
index b5090636a7f..bd89526b696 100644
--- a/src/vlibmemory/memory_client.c
+++ b/src/vlibmemory/memory_client.c
@@ -160,7 +160,6 @@ void vl_msg_api_send_shmem (svm_queue_t * q, u8 * elem);
int
vl_client_connect (const char *name, int ctx_quota, int input_queue_size)
{
- svm_region_t *svm;
vl_api_memclnt_create_t *mp;
vl_api_memclnt_create_reply_t *rp;
svm_queue_t *vl_input_queue;
@@ -181,7 +180,6 @@ vl_client_connect (const char *name, int ctx_quota, int input_queue_size)
return -1;
}
- svm = am->vlib_rp;
shmem_hdr = am->shmem_hdr;
if (shmem_hdr == 0 || shmem_hdr->vl_input_queue == 0)
@@ -193,12 +191,10 @@ vl_client_connect (const char *name, int ctx_quota, int input_queue_size)
CLIB_MEM_UNPOISON (shmem_hdr, sizeof (*shmem_hdr));
VL_MSG_API_SVM_QUEUE_UNPOISON (shmem_hdr->vl_input_queue);
- pthread_mutex_lock (&svm->mutex);
- oldheap = svm_push_data_heap (svm);
+ oldheap = vl_msg_push_heap ();
vl_input_queue = svm_queue_alloc_and_init (input_queue_size, sizeof (uword),
getpid ());
- svm_pop_heap (oldheap);
- pthread_mutex_unlock (&svm->mutex);
+ vl_msg_pop_heap (oldheap);
am->my_client_index = ~0;
am->my_registration = 0;
@@ -256,11 +252,9 @@ vl_api_memclnt_delete_reply_t_handler (vl_api_memclnt_delete_reply_t * mp)
void *oldheap;
api_main_t *am = vlibapi_get_main ();
- pthread_mutex_lock (&am->vlib_rp->mutex);
- oldheap = svm_push_data_heap (am->vlib_rp);
+ oldheap = vl_msg_push_heap ();
svm_queue_free (am->vl_input_queue);
- pthread_mutex_unlock (&am->vlib_rp->mutex);
- svm_pop_heap (oldheap);
+ vl_msg_pop_heap (oldheap);
am->my_client_index = ~0;
am->my_registration = 0;
diff --git a/src/vlibmemory/memory_shared.c b/src/vlibmemory/memory_shared.c
index 0b232adf899..1716f271466 100644
--- a/src/vlibmemory/memory_shared.c
+++ b/src/vlibmemory/memory_shared.c
@@ -163,15 +163,13 @@ vl_msg_api_alloc_internal (svm_region_t * vlib_rp, int nbytes, int pool,
*/
am->ring_misses++;
- pthread_mutex_lock (&vlib_rp->mutex);
- oldheap = svm_push_data_heap (vlib_rp);
+ oldheap = vl_msg_push_heap_w_region (vlib_rp);
if (may_return_null)
{
rv = clib_mem_alloc_or_null (nbytes);
if (PREDICT_FALSE (rv == 0))
{
- svm_pop_heap (oldheap);
- pthread_mutex_unlock (&vlib_rp->mutex);
+ vl_msg_pop_heap_w_region (vlib_rp, oldheap);
return 0;
}
}
@@ -180,8 +178,7 @@ vl_msg_api_alloc_internal (svm_region_t * vlib_rp, int nbytes, int pool,
rv->q = 0;
rv->gc_mark_timestamp = 0;
- svm_pop_heap (oldheap);
- pthread_mutex_unlock (&vlib_rp->mutex);
+ vl_msg_pop_heap_w_region (vlib_rp, oldheap);
out:
#if DEBUG_MESSAGE_BUFFER_OVERRUN > 0
@@ -296,8 +293,7 @@ vl_msg_api_free_w_region (svm_region_t * vlib_rp, void *a)
return;
}
- pthread_mutex_lock (&vlib_rp->mutex);
- oldheap = svm_push_data_heap (vlib_rp);
+ oldheap = vl_msg_push_heap_w_region (vlib_rp);
#if DEBUG_MESSAGE_BUFFER_OVERRUN > 0
{
@@ -308,8 +304,7 @@ vl_msg_api_free_w_region (svm_region_t * vlib_rp, void *a)
#endif
clib_mem_free (rv);
- svm_pop_heap (oldheap);
- pthread_mutex_unlock (&vlib_rp->mutex);
+ vl_msg_pop_heap_w_region (vlib_rp, oldheap);
}
void
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 33691068b0c..0b66cf87c4d 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -1333,7 +1333,6 @@ session_vpp_event_queues_allocate (session_main_t * smm)
{
u32 evt_q_length = 2048, evt_size = sizeof (session_event_t);
ssvm_private_t *eqs = &smm->evt_qs_segment;
- api_main_t *am = vlibapi_get_main ();
uword eqs_size = 64 << 20;
pid_t vpp_pid = getpid ();
void *oldheap;
@@ -1363,7 +1362,7 @@ session_vpp_event_queues_allocate (session_main_t * smm)
if (smm->evt_qs_use_memfd_seg)
oldheap = ssvm_push_heap (eqs->sh);
else
- oldheap = svm_push_data_heap (am->vlib_rp);
+ oldheap = vl_msg_push_heap ();
for (i = 0; i < vec_len (smm->wrk); i++)
{
@@ -1388,7 +1387,7 @@ session_vpp_event_queues_allocate (session_main_t * smm)
if (smm->evt_qs_use_memfd_seg)
ssvm_pop_heap (oldheap);
else
- svm_pop_heap (oldheap);
+ vl_msg_pop_heap (oldheap);
}
ssvm_private_t *
diff --git a/src/vpp/api/api.c b/src/vpp/api/api.c
index c62e7d05738..70839b61059 100644
--- a/src/vpp/api/api.c
+++ b/src/vpp/api/api.c
@@ -143,22 +143,19 @@ shmem_cli_output (uword arg, u8 * buffer, uword buffer_bytes)
u8 **shmem_vecp = (u8 **) arg;
u8 *shmem_vec;
void *oldheap;
- api_main_t *am = vlibapi_get_main ();
u32 offset;
shmem_vec = *shmem_vecp;
offset = vec_len (shmem_vec);
- pthread_mutex_lock (&am->vlib_rp->mutex);
- oldheap = svm_push_data_heap (am->vlib_rp);
+ oldheap = vl_msg_push_heap ();
vec_validate (shmem_vec, offset + buffer_bytes - 1);
clib_memcpy (shmem_vec + offset, buffer, buffer_bytes);
- svm_pop_heap (oldheap);
- pthread_mutex_unlock (&am->vlib_rp->mutex);
+ vl_msg_pop_heap (oldheap);
*shmem_vecp = shmem_vec;
}
@@ -170,7 +167,6 @@ vl_api_cli_t_handler (vl_api_cli_t * mp)
vl_api_cli_reply_t *rp;
vl_api_registration_t *reg;
vlib_main_t *vm = vlib_get_main ();
- api_main_t *am = vlibapi_get_main ();
unformat_input_t input;
u8 *shmem_vec = 0;
void *oldheap;
@@ -187,13 +183,9 @@ vl_api_cli_t_handler (vl_api_cli_t * mp)
vlib_cli_input (vm, &input, shmem_cli_output, (uword) & shmem_vec);
- pthread_mutex_lock (&am->vlib_rp->mutex);
- oldheap = svm_push_data_heap (am->vlib_rp);
-
+ oldheap = vl_msg_push_heap ();
vec_add1 (shmem_vec, 0);
-
- svm_pop_heap (oldheap);
- pthread_mutex_unlock (&am->vlib_rp->mutex);
+ vl_msg_pop_heap (oldheap);
rp->reply_in_shmem = (uword) shmem_vec;
@@ -439,15 +431,13 @@ vl_api_get_node_graph_t_handler (vl_api_get_node_graph_t * mp)
{
int rv = 0;
u8 *vector = 0;
- api_main_t *am = vlibapi_get_main ();
vlib_main_t *vm = vlib_get_main ();
void *oldheap;
vl_api_get_node_graph_reply_t *rmp;
static vlib_node_t ***node_dups;
static vlib_main_t **stat_vms;
- pthread_mutex_lock (&am->vlib_rp->mutex);
- oldheap = svm_push_data_heap (am->vlib_rp);
+ oldheap = vl_msg_push_heap ();
/*
* Keep the number of memcpy ops to a minimum (e.g. 1).
@@ -462,8 +452,7 @@ vl_api_get_node_graph_t_handler (vl_api_get_node_graph_t * mp)
vector = vlib_node_serialize (vm, node_dups, vector, 1 /* include nexts */ ,
1 /* include stats */ );
- svm_pop_heap (oldheap);
- pthread_mutex_unlock (&am->vlib_rp->mutex);
+ vl_msg_pop_heap (oldheap);
/* *INDENT-OFF* */
REPLY_MACRO2(VL_API_GET_NODE_GRAPH_REPLY,
diff --git a/src/vpp/api/api_main.c b/src/vpp/api/api_main.c
index 7fcbe7027f1..1d16f78ea88 100644
--- a/src/vpp/api/api_main.c
+++ b/src/vpp/api/api_main.c
@@ -76,7 +76,6 @@ maybe_register_api_client (vat_main_t * vam)
{
vl_api_registration_t **regpp;
vl_api_registration_t *regp;
- svm_region_t *svm;
void *oldheap;
api_main_t *am = vlibapi_get_main ();
@@ -85,17 +84,15 @@ maybe_register_api_client (vat_main_t * vam)
pool_get (am->vl_clients, regpp);
- svm = am->vlib_rp;
+ oldheap = vl_msg_push_heap ();
- pthread_mutex_lock (&svm->mutex);
- oldheap = svm_push_data_heap (svm);
*regpp = clib_mem_alloc (sizeof (vl_api_registration_t));
regp = *regpp;
clib_memset (regp, 0, sizeof (*regp));
regp->registration_type = REGISTRATION_TYPE_SHMEM;
regp->vl_api_registration_pool_index = regpp - am->vl_clients;
- regp->vlib_rp = svm;
+ regp->vlib_rp = am->vlib_rp;
regp->shmem_hdr = am->shmem_hdr;
/* Loopback connection */
@@ -104,8 +101,7 @@ maybe_register_api_client (vat_main_t * vam)
regp->name = format (0, "%s", "vpp-internal");
vec_add1 (regp->name, 0);
- pthread_mutex_unlock (&svm->mutex);
- svm_pop_heap (oldheap);
+ vl_msg_pop_heap (oldheap);
vam->my_client_index = vl_msg_api_handle_from_index_and_epoch
(regp->vl_api_registration_pool_index,