From patchwork Tue Nov 10 10:58:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 56295 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp698028lbb; Tue, 10 Nov 2015 02:58:32 -0800 (PST) X-Received: by 10.140.98.195 with SMTP id o61mr3207657qge.70.1447153112350; Tue, 10 Nov 2015 02:58:32 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e200si2359489qhc.22.2015.11.10.02.58.31; Tue, 10 Nov 2015 02:58:32 -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 9AB8261B7C; Tue, 10 Nov 2015 10:58: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 79BE461A13; Tue, 10 Nov 2015 10:58: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 78CEF61A19; Tue, 10 Nov 2015 10:58: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 3C766619F6 for ; Tue, 10 Nov 2015 10:58:24 +0000 (UTC) Received: by lfdo63 with SMTP id o63so22488762lfd.2 for ; Tue, 10 Nov 2015 02:58:23 -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; bh=dcgFxhf6a+XYD7Dd4CVLZIRNDie5zcMzjYIqk7oYRLg=; b=eCLEGe/Dfrj8vLWDrStpnISBfW0zOhbwmb4egXwioK+30LQzkuUG71kSB3sqEpdm6t Pa/gFRLjynmR6mHwosqJj+a+9hOUveha/rTmV6Kjpmv+8PtY66sT5ACWt6MiwYas126E +6JgMvYT6qSksB8M28cNYf/GcgRpDj6+j7wH2qa+XkZnR/8ezodJHoW9lcStv9SUVl+Q s5AXbuErRRvgCQpMblGfVV9b5nrMcJ5fRjABviZbR7yJwCNj++X8V6y0F4bgPOs3YXws EPnS3hrjHcO8w2bwXBnttQGzSrkQmm0lgpNZ78zH5iHQxS9G8vrEIhGsgbNw0n7uhiMk WPdg== 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=dcgFxhf6a+XYD7Dd4CVLZIRNDie5zcMzjYIqk7oYRLg=; b=MUk+GaPH9TUUpnGRlaK4Dl+cPnpx44ZwyUkTDyhaGzodTCiPktk5+5/ZafmM+3yOvQ g1CX9F8J2alZ+y8HDlljyAWjgxbSqVzvL0vjo1PkP4eNh27Rfmzf//h5cANpRS4OpL6E FSvUCCHGOY0flnqDq2Q4IJM7ipkVqUT6+15bTwtGUf/7k9J9HTfkpKRj3AQaKh6HTQAQ W5iMQ11WjfH9o6Ft2nIsd/PGGtzw0yNGfRCPDh7ngYXFBfjVRyfdndUpK2v23MtFfGgS pEWKAYDvxfRCa8ec8QgJM9Wqs4w7NUksW5PAm1Vk/yx4c1O3MW2E+CdTps9J7v2Kpd0a MJ5Q== X-Gm-Message-State: ALoCoQkBIaE43suxeGBjKS78SG/ujv47GZqq3y3s5YQO6xPP0FIK7uAopa0FscYZaZbdLXNJyD9c X-Received: by 10.25.134.134 with SMTP id i128mr1307579lfd.103.1447153103100; Tue, 10 Nov 2015 02:58:23 -0800 (PST) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id m124sm413840lfd.40.2015.11.10.02.58.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Nov 2015 02:58:22 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Tue, 10 Nov 2015 12:58:12 +0200 Message-Id: <1447153092-15998-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: timers patch Subject: [lng-odp] [PATCH v2] linux-generic: odp_timer: warn 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" If tick is lost 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 --- Since v1: - changed ODP_ABORT on ODP_ERR v1: https://lists.linaro.org/pipermail/lng-odp/2015-November/017026.html 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;