From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id C15BD37A0 for ; Fri, 30 Jun 2017 14:06:29 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP; 30 Jun 2017 05:06:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,286,1496127600"; d="scan'208";a="1146464672" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.221.28]) by orsmga001.jf.intel.com with SMTP; 30 Jun 2017 05:06:26 -0700 Received: by (sSMTP sendmail emulation); Fri, 30 Jun 2017 13:06:25 +0100 Date: Fri, 30 Jun 2017 13:06:24 +0100 From: Bruce Richardson To: Olivier Matz Cc: Robert Sanford , dev@dpdk.org Message-ID: <20170630120624.GH14776@bricha3-MOBL3.ger.corp.intel.com> References: <20170428132538.15995-1-bruce.richardson@intel.com> <20170531091621.203189-1-bruce.richardson@intel.com> <20170531091621.203189-2-bruce.richardson@intel.com> <20170630121431.0899f624@platinum> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170630121431.0899f624@platinum> Organization: Intel Research and =?iso-8859-1?Q?De=ACvel?= =?iso-8859-1?Q?opment?= Ireland Ltd. User-Agent: Mutt/1.8.1 (2017-04-11) Subject: Re: [dpdk-dev] [PATCH 1/3] timer: inform periodic timers of multiple expiries 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: , X-List-Received-Date: Fri, 30 Jun 2017 12:06:30 -0000 On Fri, Jun 30, 2017 at 12:14:31PM +0200, Olivier Matz wrote: > Hi Bruce, > > On Wed, 31 May 2017 10:16:19 +0100, Bruce Richardson wrote: > > if timer_manage is called much less frequently than the period of a > > periodic timer, then timer expiries will be missed. For example, if a timer > > has a period of 300us, but timer_manage is called every 1ms, then there > > will only be one timer callback called every 1ms instead of 3 within that > > time. > > > > While we can fix this by having each function called multiple times within > > timer-manage, this will lead to out-of-order timeouts, and will be slower > > with all the function call overheads - especially in the case of a timeout > > doing something trivial like incrementing a counter. Therefore, we instead > > modify the callback functions to take a counter value of the number of > > expiries that have passed since the last time it was called. > > > > Signed-off-by: Bruce Richardson > > Sorry, it's probably a bit late to react. If it's too late, nevermind. > I'm not really convinced that adding another argument to the callback > function is the best solution. > > Invoking the callbacks several times would result in a much smaller patch > that does not need a heavy ABI compat. > Yes, that is true. My first implementation did just that, and I'm not adverse to that as a possible solution. However, my opinion is that this is a better solution - primarily as it can let the worker know that it is very late (from the multiple expiries info). > I'm not sure the function call overhead is really significant in that > case. Yes, you are probably right in many cases. However, for a timeout doing a simple operations, e.g. updating a counter or two, or setting a flag, the function call overhead will be significant compared to the work being done. > I'm not sure I understand your point related to out-of-order timeouts, > nor I see why this patchset would behave better. My problem with the multiple expiries and ordering is that if we call timeout X multiple times, we should really order those calls with other timeouts that also need to expire, rather than just calling them three times in a row. Not doing so seems wrong. By instead passing in the extra parameter, there is no expectation of ordering of the callbacks, and the callback function can know itself that it is running very late and can take appropriate action when needed. > > About the problem itself, my understanding was that the timer manage > function has to be called frequently enough to process the timers. > Yes. However, if some operation ends up taking a longer than expected period of time, we should not drop timer expiries. Anyone else want to weigh in on this problem. Any other opinions as to which solution people would prefer? /Bruce