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 2/2] timer bug fix
Date: Wed, 21 May 2014 16:31:21 +0200	[thread overview]
Message-ID: <537CB8B9.4050604@6wind.com> (raw)
In-Reply-To: <1400235354-14810-3-git-send-email-vadim.suraev@gmail.com>

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 <vadim.suraev@gmail.com>
 >
> [...]
 >
> --- 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

  reply	other threads:[~2014-05-21 14:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16 10:15 [dpdk-dev] [PATCH 0/2] Vadim Suraev
2014-05-16 10:15 ` [dpdk-dev] [PATCH 1/2] timer bug fix Vadim Suraev
2014-05-16 10:15 ` [dpdk-dev] [PATCH 2/2] " Vadim Suraev
2014-05-21 14:31   ` Olivier MATZ [this message]
2014-05-23 19:43 [dpdk-dev] [PATCH 0/2] timer bugs fixes Vadim Suraev
2014-05-23 19:43 ` [dpdk-dev] [PATCH 2/2] timer bug fix Vadim Suraev

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=537CB8B9.4050604@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).