From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id 0EC6F30D for ; Wed, 21 May 2014 16:31:15 +0200 (CEST) Received: by mail-wg0-f41.google.com with SMTP id z12so2064490wgg.0 for ; Wed, 21 May 2014 07:31:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=we0isOxbUfo1iGyy8niH3/wNszw3avqq/D6lsFkVcrY=; b=CQj5+k5qwevEZtpQPHJ6GdP5E0AvxVCTuHCsdabeH+fJuVZrBbe/IWYNiVaf93WU28 2oXJSlYGRf43/Fd3AiBi+rHQByUmm43cqmPOORoMwhewnTejUChvnXXcBGSMfzdmkHEN +scnPwFFK8oFaRWfEKfAKJanfjINr1zvxY7QPMxgEvB8Qu3edXgw21GnsFkZHKwPPJK3 ZRZ9l5b7zvA8NbSjlGyBJkg9zfLieIrik+kUKxBKuj/9s6OwRhzcA8NqmaZp1fcNkdQ3 T2R8zZCzXkAl6x25ApvhQSXEI2x7GHH3nKzJ1R/jstHFDieM4Cz+qJPw2ILQFzKGaw0e lwnw== X-Gm-Message-State: ALoCoQk+SHiluVZciWJ41+2zLkyQlCH8FJ4yjc5NnPfemUGrwRVJPMSOsQWC8YIMrnKs7LhIVkgz X-Received: by 10.180.88.129 with SMTP id bg1mr10674306wib.51.1400682684723; Wed, 21 May 2014 07:31:24 -0700 (PDT) Received: from [10.16.0.195] (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id fs5sm2582800wic.22.2014.05.21.07.31.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 May 2014 07:31:23 -0700 (PDT) Message-ID: <537CB8B9.4050604@6wind.com> Date: Wed, 21 May 2014 16:31:21 +0200 From: Olivier MATZ User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.4.0 MIME-Version: 1.0 To: Vadim Suraev , dev@dpdk.org References: <1400235354-14810-1-git-send-email-vadim.suraev@gmail.com> <1400235354-14810-3-git-send-email-vadim.suraev@gmail.com> In-Reply-To: <1400235354-14810-3-git-send-email-vadim.suraev@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 2/2] timer bug fix 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: Wed, 21 May 2014 14:31:16 -0000 Hi Vadim, On 05/16/2014 12:15 PM, Vadim Suraev wrote: > Description: while running a periodic timer's callback, if another > timer is manipulated, the updated flag is raised > preventing the periodic timer to reload. > Fix: move > updated flag from priv_timer to rte_timer stucture (one > per core) > > Signed-off-by: Vadim Suraev > > [...] > > --- a/lib/librte_timer/rte_timer.h > +++ b/lib/librte_timer/rte_timer.h > @@ -129,6 +129,10 @@ struct rte_timer > uint64_t period; /**< Period of timer (0 if not periodic). */ > rte_timer_cb_t *f; /**< Callback function. */ > void *arg; /**< Argument to callback function. */ > + /** per-core variable that true if a timer was updated on this > + * core since last reset of the variable */ > + int updated[RTE_MAX_LCORE]; > + > }; I don't think that adding a quite large table in the rte_timer structure is a good idea. Instead, I suggest to add a new field in the per-core structure priv_timer: struct rte_timer *cur_timer; This timer pointer is set before invoking the callback of the timer. Then, you could do this in rte_timer_reset() and rte_timer_stop(): if (tim == priv_timer[lcore_id].cur_timer) priv_timer[lcore_id].updated = 1; I think it will also fix the problem you are describing (which is a real problem), in a more simple way. Regards, Olivier