[dpdk-dev] Question / possible issue with vdev_scan() in secondary process
Luse, Paul E
paul.e.luse at intel.com
Mon Sep 10 00:36:26 CEST 2018
Hi,
I have a test case where vdev_scan() is being called in a secondary process as shown below in a snippet from the function. My test application is compiled with AddressSanitizer which was complaining about a memory leak of memory allocated in rte_mp_request_sync(). I added the free() call shown below and this seems to have addressed the problem. Also looking at other callers of rte_mp_request_sync(), they seem to free the reply->msgs memory from the calling code as well.
Can anyone confirm that this is an issue and that this is the correct fix?
Thanks!
Paul
if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
struct rte_mp_msg mp_req, *mp_rep;
struct rte_mp_reply mp_reply;
struct timespec ts = {.tv_sec = 5, .tv_nsec = 0};
struct vdev_param *req = (struct vdev_param *)mp_req.param;
struct vdev_param *resp;
strlcpy(mp_req.name, VDEV_MP_KEY, sizeof(mp_req.name));
mp_req.len_param = sizeof(*req);
mp_req.num_fds = 0;
req->type = VDEV_SCAN_REQ;
if (rte_mp_request_sync(&mp_req, &mp_reply, &ts) == 0 &&
mp_reply.nb_received == 1) {
mp_rep = &mp_reply.msgs[0];
resp = (struct vdev_param *)mp_rep->param;
VDEV_LOG(INFO, "Received %d vdevs", resp->num);
free(mp_reply.msgs); // <----- I ADDED THIS
} else
VDEV_LOG(ERR, "Failed to request vdev from primary");
/* Fall through to allow private vdevs in secondary process */
}
More information about the dev
mailing list