From patchwork Tue Nov 10 14:40:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 56325 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp809375lbb; Tue, 10 Nov 2015 06:41:44 -0800 (PST) X-Received: by 10.55.74.19 with SMTP id x19mr4657139qka.28.1447166504720; Tue, 10 Nov 2015 06:41:44 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id w111si281218qge.125.2015.11.10.06.41.44; Tue, 10 Nov 2015 06:41:44 -0800 (PST) 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 4BD7461CB2; Tue, 10 Nov 2015 14:41:44 +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 44F7661D09; Tue, 10 Nov 2015 14:40:44 +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 AE33B61D0A; Tue, 10 Nov 2015 14:40:40 +0000 (UTC) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com [209.85.217.174]) by lists.linaro.org (Postfix) with ESMTPS id A21A261946 for ; Tue, 10 Nov 2015 14:40:38 +0000 (UTC) Received: by lbbkw15 with SMTP id kw15so115232357lbb.0 for ; Tue, 10 Nov 2015 06:40:37 -0800 (PST) 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:in-reply-to:references; bh=HTAnC2EJQ7Allg/L2aQwm6lRv8VevYo7KANIljpNrpQ=; b=ABZNu5f8K/c1du3gPv9xFjDvf2VvKMm8fQdfYC/FjKrx6Ddczr11ZHuo2JMdRzJ2vF DWGz4ZnCGZ4SVqg2Ow6mOjWL17q4+Sv5MRR8IjwbOQWH04AdYtl4lvKIG+CYi+CVKpYJ Tpt27JBDNfWSV1WlyXFDoqzJlfYVG7nQrKoLLitpcgtYcmg1JzE2rGhWApaFuuF4ITUE IM33g3Emj4gjudaC+FGBnCRBgaM+U1Ji2Im+hh57Z5Af+W1exX2Rp1AESaEbvkFCVN24 v9aMl2LOBsc4MR2boIe68cB6BLT086wSekD6QUBNz/cg1z6cydA7FxygPxkNdfXJfaQn eXPg== 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:in-reply-to :references; bh=HTAnC2EJQ7Allg/L2aQwm6lRv8VevYo7KANIljpNrpQ=; b=WCzIOUZi2Gncvlabywsq/dszpTx1UDbmXbFQARhwez3JClRzMxGQXh08KjpjHE1mqc WqKF8kP3DfeAVnD2Li6R0b6WUmphHVxZZ5YceQ4g0Y/2fM9Ua4Q6ajerJNHmL5fslTTB kJ7l6o0Uv6mcNOmhXlQql/eQkalQBq3ntdEewCAdS2if9dfxI2JYmMpODDHP3LNnC5et yzkfKMfxKw7ZvQ5JYukEkfvfxwWx5y8wLIV3D4k0jUaweabbZf1sKQJIGvwLbO+IilQd iKqzHaWX+vhy6mWP2dQ3ah2JBgjvJze7SeoYr+kO/dds7alA3/Z1UVYl2pXW7CcjrFZF wvlA== X-Gm-Message-State: ALoCoQlD6/iZ9rayNjS0UkdjTDJ+BYAgy9JzmoXS0PQ4Qcuf0+y5+zlk/9+G+zEyShTJylg5nyEN X-Received: by 10.112.198.106 with SMTP id jb10mr1868355lbc.111.1447166437593; Tue, 10 Nov 2015 06:40:37 -0800 (PST) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id tp5sm567643lbb.27.2015.11.10.06.40.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Nov 2015 06:40:36 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Tue, 10 Nov 2015 16:40:27 +0200 Message-Id: <1447166428-23791-3-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447166428-23791-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1447166428-23791-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: timers patch Subject: [lng-odp] [PATCH 2/3 v4] linux-generic: odp_timer: warn if tick is late 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" If tick is late then application should be warned about this. 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 it handles only the timer ticks. This patch helps user to set correct timer resolution. Signed-off-by: Ivan Khoronzhuk --- platform/linux-generic/odp_timer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index e8f0267..917ee5a 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -632,7 +632,13 @@ static unsigned odp_timer_pool_expire(odp_timer_pool_t tpid, uint64_t tick) static void timer_notify(sigval_t sigval) { + int overrun; odp_timer_pool *tp = (odp_timer_pool *)sigval.sival_ptr; + + overrun = timer_getoverrun(tp->timerid); + if (overrun) + ODP_ERR("\n\tlow resolution!, overrun ticks: %d\n", overrun); + #ifdef __ARM_ARCH odp_timer *array = &tp->timers[0]; uint32_t i;