From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier MATZ Subject: Re: [PATCH 2/2] timer bug fix Date: Wed, 21 May 2014 16:31:21 +0200 Message-ID: <537CB8B9.4050604@6wind.com> References: <1400235354-14810-1-git-send-email-vadim.suraev@gmail.com> <1400235354-14810-3-git-send-email-vadim.suraev@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit To: Vadim Suraev , dev-VfR2kkLFssw@public.gmane.org Return-path: In-Reply-To: <1400235354-14810-3-git-send-email-vadim.suraev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" 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