From: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
To: dev@dpdk.org
Cc: stable@dpdk.org
Subject: [dpdk-dev] [PATCH 1/1] timer: add limitation note for sync stop and reset
Date: Wed, 9 Sep 2020 09:41:14 -0500 [thread overview]
Message-ID: <1599662474-44882-2-git-send-email-erik.g.carrillo@intel.com> (raw)
In-Reply-To: <1599662474-44882-1-git-send-email-erik.g.carrillo@intel.com>
If a timer's callback function calls rte_timer_reset_sync() or
rte_timer_stop_sync() on another timer that is in the RUNNING state and
owned by the current lcore, the *_sync() calls will loop indefinitely.
Relatedly, if a timer's callback function calls *_sync() on another
timer that is in the RUNNING state and is owned by a different lcore,
but a timer callback function runs on that different lcore and calls
*_sync() on a timer that is in the RUNNING state and owned by the
current lcore, the two lcores will loop indefinitely.
Add a note in the rte_timer_stop_sync and rte_timer_reset_sync
documentation that indicates that these APIs should not be used inside
timer callback functions in order to avoid the hangs described above,
and suggests an alternative.
Bugzilla ID: 491
Cc: stable@dpdk.org
Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
---
lib/librte_timer/rte_timer.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/lib/librte_timer/rte_timer.h b/lib/librte_timer/rte_timer.h
index c6b3d45..d7c3e03 100644
--- a/lib/librte_timer/rte_timer.h
+++ b/lib/librte_timer/rte_timer.h
@@ -274,6 +274,12 @@ int rte_timer_reset(struct rte_timer *tim, uint64_t ticks,
* The callback function of the timer.
* @param arg
* The user argument of the callback function.
+ *
+ * @note
+ * This API should not be called inside a timer's callback function to
+ * reset another timer; doing so could hang in certain scenarios. Instead,
+ * the rte_timer_reset() API can be called directly and its return code
+ * can be checked for success or failure.
*/
void
rte_timer_reset_sync(struct rte_timer *tim, uint64_t ticks,
@@ -313,6 +319,12 @@ int rte_timer_stop(struct rte_timer *tim);
*
* @param tim
* The timer handle.
+ *
+ * @note
+ * This API should not be called inside a timer's callback function to
+ * stop another timer; doing so could hang in certain scenarios. Instead, the
+ * rte_timer_stop() API can be called directly and its return code can
+ * be checked for success or failure.
*/
void rte_timer_stop_sync(struct rte_timer *tim);
--
2.6.4
next prev parent reply other threads:[~2020-09-09 14:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-09 14:41 [dpdk-dev] [PATCH 0/1] " Erik Gabriel Carrillo
2020-09-09 14:41 ` Erik Gabriel Carrillo [this message]
2020-09-10 1:22 ` [dpdk-dev] [PATCH 1/1] " Honnappa Nagarahalli
2020-10-08 10:28 ` David Marchand
2020-10-08 13:58 ` Carrillo, Erik G
2020-10-08 14:11 ` David Marchand
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=1599662474-44882-2-git-send-email-erik.g.carrillo@intel.com \
--to=erik.g.carrillo@intel.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/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).