From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 526BCC3A59C for ; Fri, 16 Aug 2019 07:56:26 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 049732077C for ; Fri, 16 Aug 2019 07:56:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 049732077C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AD9DE1BE8D; Fri, 16 Aug 2019 09:56:24 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 5F5571BDFD for ; Fri, 16 Aug 2019 09:56:22 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Aug 2019 00:56:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,391,1559545200"; d="scan'208";a="261048660" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.251.81.21]) ([10.251.81.21]) by orsmga001.jf.intel.com with ESMTP; 16 Aug 2019 00:56:21 -0700 To: Jim Harris , dev@dpdk.org References: <156586845525.44449.11798632267644345382.stgit@jrharri1-skx> From: "Burakov, Anatoly" Message-ID: Date: Fri, 16 Aug 2019 08:56:20 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <156586845525.44449.11798632267644345382.stgit@jrharri1-skx> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 1/2] timer: use rte_mp_msg to pass TSC hz to secondary procs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > --- > @@ -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