From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from prod-mail-xrelay06.akamai.com (prod-mail-xrelay06.akamai.com [96.6.114.98]) by dpdk.org (Postfix) with ESMTP id E40AC37B8 for ; Wed, 20 Jul 2016 22:17:15 +0200 (CEST) Received: from prod-mail-xrelay06.akamai.com (localhost.localdomain [127.0.0.1]) by postfix.imss70 (Postfix) with ESMTP id 43CCD16C9E5; Wed, 20 Jul 2016 20:17:15 +0000 (GMT) Received: from prod-mail-relay09.akamai.com (prod-mail-relay09.akamai.com [172.27.22.68]) by prod-mail-xrelay06.akamai.com (Postfix) with ESMTP id 243E416C96C; Wed, 20 Jul 2016 20:17:15 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akamai.com; s=a1; t=1469045835; bh=m8XyyHMcH2LmMMcBufggojKxXZ33lc6qUSTCCwkQQ3M=; l=2345; h=From:To:CC:Date:References:In-Reply-To:From; b=lJqjOonPFZIpBJoflnaWCUKBBrw236J3h6e8i4+vg2AXsqERYtvW8wpnSivfkI8yC ruvPES+nIvbHHQUtxQka+kbLIPPBlu/0WTNuPPFfoLD+HdSkuDTjv26RbkEdNK4afb muaX8+gOwySkLbsKiYJDU6dmogm8L9gybpYxhpww= Received: from email.msg.corp.akamai.com (ustx2ex-cas5.msg.corp.akamai.com [172.27.25.34]) by prod-mail-relay09.akamai.com (Postfix) with ESMTP id 2030C1E07C; Wed, 20 Jul 2016 20:17:15 +0000 (GMT) Received: from USTX2EX-DAG1LAG.msg.corp.akamai.com (172.27.27.106) by ustx2ex-dag1mb3.msg.corp.akamai.com (172.27.27.103) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Wed, 20 Jul 2016 15:17:09 -0500 Received: from ustx2ex-dag1mb6.msg.corp.akamai.com (172.27.27.107) by ustx2ex-dag1lag.msg.corp.akamai.com (172.27.27.106) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Wed, 20 Jul 2016 15:17:08 -0500 Received: from ustx2ex-dag1mb6.msg.corp.akamai.com ([172.27.27.107]) by ustx2ex-dag1mb6.msg.corp.akamai.com ([172.27.27.107]) with mapi id 15.00.1178.000; Wed, 20 Jul 2016 13:17:08 -0700 From: "Sanford, Robert" To: Hiroyuki Mikita CC: "dev@dpdk.org" , Thomas Monjalon Thread-Topic: [PATCH] timer: fix break list when timer_cb reset running timer Thread-Index: AQHR4FYxMj0lLRaoX0OkvdpVwjjOZKAh+P6A Date: Wed, 20 Jul 2016 20:17:08 +0000 Message-ID: References: <1468778880-25515-1-git-send-email-h.mikita89@gmail.com> In-Reply-To: <1468778880-25515-1-git-send-email-h.mikita89@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.4.3.140616 x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [172.19.132.85] Content-Type: text/plain; charset="us-ascii" Content-ID: <6979AD2C8E427546A08A5AA0BFB6480F@akamai.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] timer: fix break list when timer_cb reset running timer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jul 2016 20:17:16 -0000 Hi Hiroyuki, I am reviewing your 3 timer patches. Can you please explain in more detail your use-case that results in a problem? For example, is it when timer A's callback tries to reset (rte_timer_reset) timer B? If yes, is timer B in PENDING state and likely to expire soon? -- Thanks, Robert On 7/17/16 2:08 PM, "Hiroyuki Mikita" wrote: >When timer_cb resets another running timer on the same lcore, >the list of expired timers is chained to the pending-list. >This commit prevents a running timer from being reset >by not its own timer_cb. > >Signed-off-by: Hiroyuki Mikita >--- > lib/librte_timer/rte_timer.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > >diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c >index 3dcdab5..00e80c9 100644 >--- a/lib/librte_timer/rte_timer.c >+++ b/lib/librte_timer/rte_timer.c >@@ -69,6 +69,9 @@ struct priv_timer { >=20 > unsigned prev_lcore; /**< used for lcore round robin */ >=20 >+ /** running timer on this lcore now */ >+ struct rte_timer *running_tim; >+ > #ifdef RTE_LIBRTE_TIMER_DEBUG > /** per-lcore statistics */ > struct rte_timer_debug_stats stats; >@@ -135,9 +138,12 @@ timer_set_config_state(struct rte_timer *tim, > while (success =3D=3D 0) { > prev_status.u32 =3D tim->status.u32; >=20 >- /* timer is running on another core, exit */ >+ /* timer is running on another core >+ * or ready to run on local core, exit >+ */ > if (prev_status.state =3D=3D RTE_TIMER_RUNNING && >- prev_status.owner !=3D (uint16_t)lcore_id) >+ (prev_status.owner !=3D (uint16_t)lcore_id || >+ tim !=3D priv_timer[lcore_id].running_tim)) > return -1; >=20 > /* timer is being configured on another core */ >@@ -580,6 +586,7 @@ void rte_timer_manage(void) > for (tim =3D run_first_tim; tim !=3D NULL; tim =3D next_tim) { > next_tim =3D tim->sl_next[0]; > priv_timer[lcore_id].updated =3D 0; >+ priv_timer[lcore_id].running_tim =3D tim; >=20 > /* execute callback function with list unlocked */ > tim->f(tim, tim->arg); >@@ -610,6 +617,7 @@ void rte_timer_manage(void) > rte_spinlock_unlock(&priv_timer[lcore_id].list_lock); > } > } >+ priv_timer[lcore_id].running_tim =3D NULL; > } >=20 > /* dump statistics about timers */ >--=20 >2.7.4 >