From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH] rte_alarm: modify it to make it not to be affected by discontinuous jumps in the system time Date: Tue, 13 Oct 2015 17:33:20 -0700 Message-ID: <20151013173320.46e07232@xeon-e3> References: <1433472396-18852-1-git-send-email-wolkayang@gmail.com> 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-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by dpdk.org (Postfix) with ESMTP id 4D2F18D9B for ; Wed, 14 Oct 2015 02:33:10 +0200 (CEST) Received: by pabws5 with SMTP id ws5so5174689pab.1 for ; Tue, 13 Oct 2015 17:33:09 -0700 (PDT) In-Reply-To: <1433472396-18852-1-git-send-email-wolkayang@gmail.com> 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" 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 Agreed, this should be applied. Does BSD version have same problem? Acked-by: Stephen Hemminger