From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by dpdk.org (Postfix) with ESMTP id AC3E22BCE for ; Sun, 17 Jul 2016 20:08:14 +0200 (CEST) Received: by mail-pf0-f196.google.com with SMTP id g202so10065943pfb.1 for ; Sun, 17 Jul 2016 11:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=db8aHMgBTYOKfu0lNluvAcZ8Uew+68066WJDioj5QAk=; b=FM2lCbyTbAYeIiOG8QnJ97d4QrAYabZ9N6fwE9LBbCC1zMrhImO3yf4vApkIEm3VId 8weQPhGUaedHJ90hwE/zOD/Tbrf+uoNUjFNfKLXIxRbiCqQ0tu4e2/u4ZJeHwx43Abu9 lNT7NeSquanj9mlrfAgNX0w5pqBo4gwZnk36kzbtTt4zSWywG6Ev/Io2rD6qIMLk2Hid 0qQFjak7qLtplAh8szlMddSLB8zloMBc6aMQ3XxmC0i0b1hfSN93yAkkk4vQdiuLEDMT Si4YtOG1fZt5nYA5zmuxVLbieLK/rmiGiQufdExxl7Oc/RyzcGoYoHcFYQ0pdnmAmAff wCcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=db8aHMgBTYOKfu0lNluvAcZ8Uew+68066WJDioj5QAk=; b=JgkYGhRjumRT7MfD2gX7G9Lzk00iiqepIfSCQpxcRAXM/Zd7sKa/sSI1mz6j0Vy7l3 GnsBMPFc6+GAopi6EAvzSB9isjbU+mZ7HbhI7y448Tywve/27h6h6/HDhSfVmTitB35k F8Cjcyy3HTCn0cas42XcBjAWHzN705lRbbMxzJ0UUBrE+6Y7XkW+hMOBNFrbxgqW5Xxs aoIw2YPqeX4dndae/oZC8vEkkarsLQhCwYLueHqdJ2Ynh6C4g0eTiA70mlMcWUVQI5g8 wOID7BLCNHxKM8VJ5YOt1LW/sjHgit80BYbePXLmubdcOQktL0bSXBLxt/XV5J+8XRmV 7FzQ== X-Gm-Message-State: ALyK8tLqdsgBFwuSyoSz/LI7HyAaamlfuBCxXYNONNIOl11xj2Bz/snT3pywNdoEu7vviw== X-Received: by 10.98.35.7 with SMTP id j7mr24754106pfj.39.1468778893852; Sun, 17 Jul 2016 11:08:13 -0700 (PDT) Received: from localhost.localdomain (183.180.67.214.ap.gmobb-fix.jp. [183.180.67.214]) by smtp.gmail.com with ESMTPSA id z10sm3375703pff.95.2016.07.17.11.08.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 17 Jul 2016 11:08:13 -0700 (PDT) From: Hiroyuki Mikita To: rsanford@akamai.com Cc: dev@dpdk.org Date: Mon, 18 Jul 2016 03:08:00 +0900 Message-Id: <1468778880-25515-1-git-send-email-h.mikita89@gmail.com> X-Mailer: git-send-email 2.7.4 Subject: [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: Sun, 17 Jul 2016 18:08:14 -0000 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 { unsigned prev_lcore; /**< used for lcore round robin */ + /** 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 == 0) { prev_status.u32 = tim->status.u32; - /* 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 == RTE_TIMER_RUNNING && - prev_status.owner != (uint16_t)lcore_id) + (prev_status.owner != (uint16_t)lcore_id || + tim != priv_timer[lcore_id].running_tim)) return -1; /* timer is being configured on another core */ @@ -580,6 +586,7 @@ void rte_timer_manage(void) for (tim = run_first_tim; tim != NULL; tim = next_tim) { next_tim = tim->sl_next[0]; priv_timer[lcore_id].updated = 0; + priv_timer[lcore_id].running_tim = tim; /* 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 = NULL; } /* dump statistics about timers */ -- 2.7.4