DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Question / possible issue with vdev_scan() in secondary process
@ 2018-09-09 22:36 Luse, Paul E
  0 siblings, 0 replies; only message in thread
From: Luse, Paul E @ 2018-09-09 22:36 UTC (permalink / raw)
  To: dev; +Cc: Harris, James R, Stojaczyk, Dariusz

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 */

}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-09-09 22:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-09 22:36 [dpdk-dev] Question / possible issue with vdev_scan() in secondary process Luse, Paul E

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).