timer: add limitation note for sync stop and reset

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>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
This commit is contained in:
Erik Gabriel Carrillo 2020-09-09 09:41:14 -05:00 committed by David Marchand
parent 1fb6301ccb
commit 0875ec4dd5

View File

@ -262,6 +262,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,
@ -301,6 +307,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);