From patchwork Fri Oct 30 22:56:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 55864 Delivered-To: patch@linaro.org Received: by 10.112.61.134 with SMTP id p6csp121730lbr; Fri, 30 Oct 2015 15:56:32 -0700 (PDT) X-Received: by 10.50.117.65 with SMTP id kc1mr883568igb.4.1446245792524; Fri, 30 Oct 2015 15:56:32 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id op7si4408544igb.80.2015.10.30.15.56.31; Fri, 30 Oct 2015 15:56:32 -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; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: by lists.linaro.org (Postfix, from userid 109) id B8E4D61BC1; Fri, 30 Oct 2015 22:56:31 +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=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, URIBL_BLOCKED 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 C0D2F61C66; Fri, 30 Oct 2015 22:56:27 +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 3493761C68; Fri, 30 Oct 2015 22:56:25 +0000 (UTC) Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com [209.85.215.42]) by lists.linaro.org (Postfix) with ESMTPS id D953E61BC1 for ; Fri, 30 Oct 2015 22:56:22 +0000 (UTC) Received: by lfaz124 with SMTP id z124so41931725lfa.1 for ; Fri, 30 Oct 2015 15:56:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=K9LzuA3siSo3cYA9ccZu2UzFlZV89G1E0B/EPtCYoGo=; b=TWKiweR6i7aSzuxKUw6mpZaN0s3SDyfk9V9+qnb3vlYg4c9q6tWtoJGQ8QcoLWI9XJ RoNmfNT7u4g7yif1o+aek1gONaW67EfPaWJoT0ZbM1UXmKO4x6Qn/APjSPBOuJw2ay0t Lf1ETV/I/1+j6IiY8TWAs5y5cRM+LG+DhGR83FGq5uVJPE1fKtxkAXqsW4SH1btwnYk9 nMiwZnqo2cuKv0sbLR/4JoxmgD5YjubKAHP8+7m1mc0tRf+BUNYGyXg7i2fnqLBvm3t+ tVP1xoUVp8Y/po3dmz5pbpHi5l85OgnwqjhdNgcT7S3MyVKgLiK2O5VHc/X1//bIDxmf AyLQ== 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=K9LzuA3siSo3cYA9ccZu2UzFlZV89G1E0B/EPtCYoGo=; b=JXQYa4q4ahGbKizrhgByC74AyDjiNgQtA3QWBV8R2gyU8EW4jB+4o6wpybELQtZ11d aVvm1uHCyJZj3IbvMbBG6GY1YuaEVPLKWBm+i+fU7NWRDhJdvx8FyssvtEXB+fP24NJX UAPEthYKcdtvNq7dscj8vjl938dR0dVqRXXE8kX4SGbUo2h9K6A9hwbHlg05p6h/rwS9 y2PtYY/0K8JqCOIzosYbpOH0epYb7TcI+xQhf0QOaMbOmbhbmINv3vB25hYkCVBT/syE ctlC0sFA8qu9WwbkARvngh6w0/vNOpZ0Nnlf2L5X+LWDG51hv2Ff0mNl8zPvivGd8K50 iRag== X-Gm-Message-State: ALoCoQl4vyGi0XTLLTQYs7YAWeb0QC5SijHLIWWQBLAfXKXNv6H0dP6BjZ3MC/CPxhfm9VGkT7sU X-Received: by 10.112.180.230 with SMTP id dr6mr5138432lbc.72.1446245781827; Fri, 30 Oct 2015 15:56:21 -0700 (PDT) Received: from localhost.localdomain ([212.90.60.8]) by smtp.gmail.com with ESMTPSA id l79sm1664408lfl.2.2015.10.30.15.56.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Oct 2015 15:56:21 -0700 (PDT) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Sat, 31 Oct 2015 00:56:15 +0200 Message-Id: <1446245775-31359-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: timers patch Subject: [lng-odp] [PATCH] linux-generic: odp_timer: abort if tick is lost 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: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" No need to continue test example if tick is lost. It means that actual timer resolution is worse than expected. The default timer resolution is set 10ms, that is equal to jiffy on most systems. The default resolution is set bearing in mind that on a CPU runs maximum two threads that ideally fits in 10ms. But user can change it to be smaller, in case if CPU0 is isolated and handles the timer ticks. This patch saves user from incorrect choice by aborting the application. Signed-off-by: Ivan Khoronzhuk --- platform/linux-generic/odp_timer.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index e8f0267..3728ac3 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -632,7 +632,14 @@ static unsigned odp_timer_pool_expire(odp_timer_pool_t tpid, uint64_t tick) static void timer_notify(sigval_t sigval) { + uint64_t overrun; odp_timer_pool *tp = (odp_timer_pool *)sigval.sival_ptr; + + overrun = timer_getoverrun(tp->timerid); + if (overrun) + ODP_ABORT("Error: need to increase resolution, lost tickets: %" + PRIu64"\n", overrun); + #ifdef __ARM_ARCH odp_timer *array = &tp->timers[0]; uint32_t i;