From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from prod-mail-xrelay08.akamai.com (prod-mail-xrelay08.akamai.com [96.6.114.112]) by dpdk.org (Postfix) with ESMTP id 955D65680 for ; Sat, 23 Jul 2016 00:14:24 +0200 (CEST) Received: from prod-mail-xrelay08.akamai.com (localhost.localdomain [127.0.0.1]) by postfix.imss70 (Postfix) with ESMTP id 1A2E42000D4; Fri, 22 Jul 2016 22:14:24 +0000 (GMT) Received: from prod-mail-relay08.akamai.com (prod-mail-relay08.akamai.com [172.27.22.71]) by prod-mail-xrelay08.akamai.com (Postfix) with ESMTP id 045CC200008; Fri, 22 Jul 2016 22:14:24 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akamai.com; s=a1; t=1469225664; bh=qDbDgD0mYF5LDN91pCXIqoGjHsxhamJiUMEmFhKuJps=; l=2211; h=From:To:Date:References:In-Reply-To:From; b=EI3a+bIPkcZ+iUVkOO4PE8k5PPRaUXrXU5dGIzfAcx8w15RN0k5rIMaI9Gv2cJ5pU hbW/0QWmITNZJ1j0Vp2c+iN5dAqEfVw8kHvgteho/5gBv3TXETNc285L3mXYXr8QD2 Cvnevi49UDxne+iv7cr+UdS+gzjaK7RjbJsXt42U= Received: from email.msg.corp.akamai.com (ustx2ex-cas4.msg.corp.akamai.com [172.27.25.33]) by prod-mail-relay08.akamai.com (Postfix) with ESMTP id 0078398082; Fri, 22 Jul 2016 22:14:24 +0000 (GMT) Received: from ustx2ex-dag1mb6.msg.corp.akamai.com (172.27.27.107) by ustx2ex-dag1mb4.msg.corp.akamai.com (172.27.27.104) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Fri, 22 Jul 2016 17:14:23 -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; Fri, 22 Jul 2016 15:14:23 -0700 From: "Sanford, Robert" To: Hiroyuki Mikita , "dev@dpdk.org" , Thomas Monjalon Thread-Topic: [PATCH] timer: fix break list when timer_cb reset running timer Thread-Index: AQHR4FYxMj0lLRaoX0OkvdpVwjjOZKAlPmoA Date: Fri, 22 Jul 2016 22:14:23 +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.133.74] Content-Type: text/plain; charset="us-ascii" Content-ID: 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: Fri, 22 Jul 2016 22:14:25 -0000 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 > Acked-by: Robert Sanford I tested the three timer patches with app/test timer_autotest and timer_racecond_autotest, and additional private tests.