On 15-Aug-19 12:27 PM, Jim Harris wrote:
rte_eal_init() is much faster in secondary processes since
hugepages don't need to be zeroed.  But there's still
non-trivial delays in the timer subsystem initialization
due to the 100ms sleep used to calculate TSC hz.  So use
the rte_mp_msg framework to allow secondary processes
to get the TSC hz from the primary process.

This cuts rte_eal_init() execution time in a secondary
process from 165ms to 66ms in my test program.

Signed-off-by: Jim Harris <james.r.har...@intel.com>
---

<snip>

@@ -89,6 +96,65 @@ set_tsc_freq(void)
        eal_tsc_resolution_hz = freq;
  }
+static void
+set_tsc_freq_secondary(void)
+{
+       struct rte_mp_msg mp_req;
+       struct rte_mp_reply mp_reply;
+       struct timer_mp_param *r;
+       struct timespec ts = {.tv_sec = 1, .tv_nsec = 0};
+
+       memset(&mp_req, 0, sizeof(mp_req));
+       strcpy(mp_req.name, EAL_TIMER_MP);
+       if (rte_mp_request_sync(&mp_req, &mp_reply, &ts) || 
mp_reply.nb_received != 1) {

If rte_mp_request_sync returns 0 but mp_reply.nb_receieved isn't set to 1, you'll be leaking mp_reply.msgs.

--
Thanks,
Anatoly

Reply via email to