From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 4197BC760 for ; Fri, 19 Jun 2015 12:14:20 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 19 Jun 2015 03:14:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,643,1427785200"; d="scan'208";a="730559407" Received: from bricha3-mobl3.ger.corp.intel.com ([10.243.20.21]) by fmsmga001.fm.intel.com with SMTP; 19 Jun 2015 03:14:17 -0700 Received: by (sSMTP sendmail emulation); Fri, 19 Jun 2015 11:14:16 +0025 Date: Fri, 19 Jun 2015 11:14:16 +0100 From: Bruce Richardson To: "Yeddula, Avinash" Message-ID: <20150619101416.GB6880@bricha3-MOBL3> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Shannon Ltd. User-Agent: Mutt/1.5.23 (2014-03-12) Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] RTE TIMER LIBRARY X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2015 10:14:20 -0000 On Thu, Jun 18, 2015 at 08:57:45PM -0400, Yeddula, Avinash wrote: > Hello Dpdk-team, > > I have few very basic questions. In the DPDK timer sample application, the periodic timer0's callback function is not called unless "rte_timer_manage()" is called. I understand rte_timer_manage() function looks at all the expired timers in the core and runs them. > > Here are my questions: > > 1. If I comment out the rte_timer_manage() function in the code, time0_cb function is not getting called at all. Why is this ? > I see some documentation saying if they are in Running state the timer would fail, what exactly does this mean, could you please provide more details. > > 2. Is it mandatory to call rte_timer_manage to trigger for the dpdk timers when they expire? > > 3. I see this point "The Timer library provides a timer service to Intel(r) DPDK execution units to enable execution of callback functions asynchronously." What does asynchronously means ? > > For example, I just have 1 worker thread in my application and the periodic timer expired and the corresponding call back function has to be executed. Now does the worker thread stop what it is doing now and starts executing timer's callback function or how does it work. > > I apologies if the questions are very basic and doesn't make sense. > > Thanks > -Avinash > The timers in DPDK are asynchronous in the sense that the timers will fire at a time given by the timeout command, and not at a guaranteed point in the code execution. On the other hand, they are also synchronous in that the timers' callbacks can only be executed at specific designated points in the code - the rte_timer_manage calls. This arrangement allows greater predictability of execution - as timer callbacks fire at known points - and helps apps avoid race conditions e.g. if you are modifying a setting on a port/queue in a callback, you can know that the core on which this callback is executing is not performing packet IO on that port/queue at the same time. So overall, the rte_timer_manage functions are required in order to have timer callbacks executed - since it is that function which itself triggers the callbacks, at known points in the code. /Bruce