From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 882C3A04B6 for ; Wed, 9 Sep 2020 16:41:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6C9221C0CA; Wed, 9 Sep 2020 16:41:26 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 2B7601BF8E; Wed, 9 Sep 2020 16:41:24 +0200 (CEST) IronPort-SDR: BCALKb7php2UiM5osDaa0UAAYjvjSnjYIh1WKlrt7brcKWQLLMbudR8NpfsgwBG90c98xA28cE YgRh1VswUwmg== X-IronPort-AV: E=McAfee;i="6000,8403,9738"; a="138377364" X-IronPort-AV: E=Sophos;i="5.76,409,1592895600"; d="scan'208";a="138377364" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2020 07:41:21 -0700 IronPort-SDR: 6uSiJR6R8Qc/EBLq382AGoUg27tuuWT1P+hhyaGSz8MXksfl7hkqccIox8zJ4W/Uy5s7ZEbW17 JRvhvtz0Bs9g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,409,1592895600"; d="scan'208";a="505473908" Received: from wcpqa1.an.intel.com ([10.123.72.207]) by fmsmga005.fm.intel.com with ESMTP; 09 Sep 2020 07:41:21 -0700 From: Erik Gabriel Carrillo To: dev@dpdk.org Cc: stable@dpdk.org Date: Wed, 9 Sep 2020 09:41:14 -0500 Message-Id: <1599662474-44882-2-git-send-email-erik.g.carrillo@intel.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1599662474-44882-1-git-send-email-erik.g.carrillo@intel.com> References: <1599662474-44882-1-git-send-email-erik.g.carrillo@intel.com> Subject: [dpdk-stable] [PATCH 1/1] timer: add limitation note for sync stop and reset X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 --- 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