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 83BBDA04B5 for ; Wed, 9 Sep 2020 16:39:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 77BB51BF8E; Wed, 9 Sep 2020 16:39:06 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 3AB781BF8E for ; Wed, 9 Sep 2020 16:39:05 +0200 (CEST) IronPort-SDR: kJlb0ZRPI+qbtNuO2I3/2UBqRaGNe1U+PpclGuyi+dXkCANKSQCgrTxD7QbMnkTKwHRpuiI7Z/ +K5t0g+pcgaA== X-IronPort-AV: E=McAfee;i="6000,8403,9738"; a="155738607" X-IronPort-AV: E=Sophos;i="5.76,409,1592895600"; d="scan'208";a="155738607" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2020 07:39:04 -0700 IronPort-SDR: hclYL+esVCcS58HpLX7BR6Uug45nTxuxX2Fw2OuROvvEnXCOKbtSFjgjKBa/KYDCsTPO3ve7U9 0foFNtxWcjhg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,409,1592895600"; d="scan'208";a="328931295" Received: from wcpqa1.an.intel.com ([10.123.72.207]) by fmsmga004.fm.intel.com with ESMTP; 09 Sep 2020 07:39:04 -0700 From: Erik Gabriel Carrillo To: erik.g.carrillo@intel.com Cc: stable@dpdk.org Date: Wed, 9 Sep 2020 09:38:50 -0500 Message-Id: <1599662330-44663-2-git-send-email-erik.g.carrillo@intel.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1599662330-44663-1-git-send-email-erik.g.carrillo@intel.com> References: <1599662330-44663-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