From patchwork Thu Oct 13 21:18:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Brooks X-Patchwork-Id: 77637 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp11663qge; Thu, 13 Oct 2016 14:19:41 -0700 (PDT) X-Received: by 10.237.52.1 with SMTP id w1mr8860580qtd.109.1476393581282; Thu, 13 Oct 2016 14:19:41 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 33si7702730qkr.272.2016.10.13.14.19.34; Thu, 13 Oct 2016 14:19:41 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 6C88461824; Thu, 13 Oct 2016 21:19:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 1062B60D02; Thu, 13 Oct 2016 21:19:31 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 7B4CA60D39; Thu, 13 Oct 2016 21:19:28 +0000 (UTC) Received: from mail-oi0-f43.google.com (mail-oi0-f43.google.com [209.85.218.43]) by lists.linaro.org (Postfix) with ESMTPS id B05ED60CEA for ; Thu, 13 Oct 2016 21:19:26 +0000 (UTC) Received: by mail-oi0-f43.google.com with SMTP id d132so114600072oib.2 for ; Thu, 13 Oct 2016 14:19:26 -0700 (PDT) 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=EewB25xRUQtMt5ftZL7OfckbgZb/k6FktTLWqeezaFg=; b=iSbhQACIWA/8nvzXi2N0J2oURBDDJW7X7uuBw4PmPIMsnpw7c9rrJwHYUboIcEEW4j mreHYMXXEzEIOx4Z12Qt4rzqs4Wb2+oMh6+9U+OGyiRRqaA7myczi7XuUj8m6igLXjZn tf9oNl0T5NMx9xTZ3aKt5t0ii+c3o5jDOAGdQmWqjVH1tK+1y/zvS66wg9DX1lZ/mCqA 8LAj7AHEpUz+yhJPjbsR9WueWSMP0MKuoujR9VvRaEaSad6SRqgS/NgikBUNFQXDQIHU +VhC4aANiBkrjEtm4QW1ZvgBH8ONtkAzXJl0RPMqITn6dPc7+LHK0PpCPyrv5NZPxMlM H/Rg== X-Gm-Message-State: AA6/9Rlk7dc/yHc0xPrvButaA9EODFY5+VE2ksq2jt4OPPC6BjZskT20gSdnqw9FuHBzl4KXa2M= X-Received: by 10.157.60.16 with SMTP id q16mr4683930otc.102.1476393566090; Thu, 13 Oct 2016 14:19:26 -0700 (PDT) Received: from localhost.localdomain (68-248-140-212.lightspeed.austtx.sbcglobal.net. [68.248.140.212]) by smtp.gmail.com with ESMTPSA id s23sm5036222ots.1.2016.10.13.14.19.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 13 Oct 2016 14:19:24 -0700 (PDT) From: Brian Brooks To: lng-odp@lists.linaro.org Date: Thu, 13 Oct 2016 16:18:44 -0500 Message-Id: <1476393524-113801-1-git-send-email-brian.brooks@linaro.org> X-Mailer: git-send-email 2.7.4 X-Topics: timers patch Subject: [lng-odp] [PATCH] timers: fix off by one tick in timer expiration processing X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" A timer pool's tick starts at t0 (zero). Once the first period has passed, the timer pool is scanned for any timers that have expired since t0 + 1. Current code does an atomic fetch increment on the tick, but uses the previous tick during timer expiration processing. What is needed is the previous tick + 1. The observable effect without this patch is that timers are expired one tick period (timer resolution) later than they should be. Signed-off-by: Brian Brooks --- platform/linux-generic/odp_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 Reviewed-by: Bill Fischofer diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index becea9d..b26ac6b 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -691,7 +691,7 @@ static void timer_notify(odp_timer_pool *tp) prev_tick = odp_atomic_fetch_inc_u64(&tp->cur_tick); /* Scan timer array, looking for timers to expire */ - (void)odp_timer_pool_expire(tp, prev_tick); + (void)odp_timer_pool_expire(tp, prev_tick + 1); /* Else skip scan of timers. cur_tick was updated and next itimer * invocation will process older expiration ticks as well */