DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier MATZ <olivier.matz@6wind.com>
To: Vadim Suraev <vadim.suraev@gmail.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] timer bug fix.
Date: Fri, 23 May 2014 16:44:24 +0200	[thread overview]
Message-ID: <537F5EC8.70109@6wind.com> (raw)
In-Reply-To: <1400704555-18818-1-git-send-email-vadim.suraev@gmail.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

On 05/21/2014 10:35 PM, Vadim Suraev wrote:
> Bug: When a timer is running
>   - if rte_timer_stop is called, the pending decrement is
>   skipped (decremented only if the timer is pending) and due
>   to the update flag the future processing is skipped so the
>   timer is counted as pending while it is stopped. - the same
>   applies when rte_timer_reset is called but then the pending
>   statistics is additionally incremented so the timer is
>   counted pending twice.
> Solution: decrement the pending
>   statistics after returning from the callback. If
>   rte_timer_stop was called, it skipped decrementing the
>   pending statistics. If rte_time_reset was called, the
>   pending statistics was incremented. If neither was called
>   and the timer is periodic, the pending statistics is
>   incremented when it is reloaded
>
>
> Signed-off-by: Vadim Suraev <vadim.suraev@gmail.com>
> ---
>   lib/librte_timer/rte_timer.c |    4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c
> index 1ebd223..7035bed 100755
> --- a/lib/librte_timer/rte_timer.c
> +++ b/lib/librte_timer/rte_timer.c
> @@ -551,7 +551,7 @@ void rte_timer_manage(void)
>   		tim->f(tim, tim->arg);
>
>   		rte_spinlock_lock(&priv_timer[lcore_id].list_lock);
> -
> +		__TIMER_STAT_ADD(pending, -1);
>   		/* the timer was stopped or reloaded by the callback
>   		 * function, we have nothing to do here */
>   		if (priv_timer[lcore_id].updated == 1)
> @@ -559,7 +559,6 @@ void rte_timer_manage(void)
>
>   		if (tim->period == 0) {
>   			/* remove from done list and mark timer as stopped */
> -			__TIMER_STAT_ADD(pending, -1);
>   			status.state = RTE_TIMER_STOP;
>   			status.owner = RTE_TIMER_NO_OWNER;
>   			rte_wmb();
> @@ -568,6 +567,7 @@ void rte_timer_manage(void)
>   		else {
>   			/* keep it in list and mark timer as pending */
>   			status.state = RTE_TIMER_PENDING;
> +			__TIMER_STAT_ADD(pending, 1);
>   			status.owner = (int16_t)lcore_id;
>   			rte_wmb();
>   			tim->status.u32 = status.u32;
>

  reply	other threads:[~2014-05-23 14:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-21 20:35 Vadim Suraev
2014-05-23 14:44 ` Olivier MATZ [this message]
2014-05-26 16:25   ` Thomas Monjalon
  -- strict thread matches above, loose matches on Subject: below --
2014-05-21 19:53 Vadim Suraev
2014-05-23 14:52 ` Olivier MATZ
2014-05-26 16:24   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=537F5EC8.70109@6wind.com \
    --to=olivier.matz@6wind.com \
    --cc=dev@dpdk.org \
    --cc=vadim.suraev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).