From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] rte_alarm: modify it to make it not to be affected by discontinuous jumps in the system time Date: Wed, 21 Oct 2015 17:10:18 +0200 Message-ID: <1790131.1sIkGeekIY@xps13> References: <1433472396-18852-1-git-send-email-wolkayang@gmail.com> <20151013173320.46e07232@xeon-e3> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org To: Wen-Chi Yang Return-path: Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by dpdk.org (Postfix) with ESMTP id DA60AC314 for ; Wed, 21 Oct 2015 17:11:23 +0200 (CEST) Received: by wicll6 with SMTP id ll6so79225627wic.1 for ; Wed, 21 Oct 2015 08:11:23 -0700 (PDT) In-Reply-To: <20151013173320.46e07232@xeon-e3> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2015-10-13 17:33, Stephen Hemminger: > On Fri, 5 Jun 2015 10:46:36 +0800 > Wen-Chi Yang wrote: > > > Due to eal_alarm_callback() and rte_eal_alarm_set() use gettimeofday() > > to get the current time, and gettimeofday() is affected by jumps. > > > > For example, set up a rte_alarm which will be triggerd next second ( > > current time + 1 second) by rte_eal_alarm_set(). And the callback > > function of this rte_alarm sets up another rte_alarm which will be > > triggered next second (current time + 2 second). > > Once we change the system time when the callback function is triggered, > > it is possiblb that rte alarm functionalities work out of expectation. > > > > Replace gettimeofday() with clock_gettime(CLOCK_MONOTONIC_RAW, &now) > > could avoid this phenomenon. > > > > Signed-off-by: Wen-Chi Yang > > Acked-by: Stephen Hemminger Applied, thanks