From patchwork Tue Nov 10 11:01:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 56296 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp699753lbb; Tue, 10 Nov 2015 03:02:04 -0800 (PST) X-Received: by 10.107.135.88 with SMTP id j85mr3201493iod.132.1447153324349; Tue, 10 Nov 2015 03:02:04 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 65si3926994iof.88.2015.11.10.03.02.03; Tue, 10 Nov 2015 03:02:04 -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 C2A3361D09; Tue, 10 Nov 2015 11:02:03 +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 436F361A13; Tue, 10 Nov 2015 11:01:58 +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 B5C5161A19; Tue, 10 Nov 2015 11:01:51 +0000 (UTC) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com [209.85.217.169]) by lists.linaro.org (Postfix) with ESMTPS id 0B01D619F6 for ; Tue, 10 Nov 2015 11:01:46 +0000 (UTC) Received: by lbblt2 with SMTP id lt2so98770229lbb.3 for ; Tue, 10 Nov 2015 03:01:45 -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=Zk/bT5gGsnJdL8iLEGZO+2+pYvHkDKZlPh+yd/dMhBQ=; b=qxoJSr5cTMhz63EtbGPa5XYVo40hxl83nvoX8huCjSCwAHmogI/Uvok1nA86er16k5 OXqCbnqEx8rffbsygvY0KdbOwgsSC/aSeseh4xozMX8M8YFJwXPz88uu3St1i5sqm+fS uMzSgpcFhzvP6ftrZdo4kDFyWL8k3nphHITHIp98L40PDQnq+zJNW//T2gbVACE5ETNU tqwjPhtBvWTQ44pUgd5EhB5pa7VLN6E8uAgPPxw52s1fIp3herUh/ttKe8pPTRPX9wxi /5PbzXjvb1hOnZtEG77pdIao97FzdlZto0nrtrl5LV93xxmeCDsQxCOOiAzXTy8n4+dv 9bKw== 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=Zk/bT5gGsnJdL8iLEGZO+2+pYvHkDKZlPh+yd/dMhBQ=; b=Wco5JUE8byqKx7E+DAn0reDgP0Men4h+pzb8a+f24CMgcr/o/kuO4IITWhsW2hnvFz 092tKBtWRBc6SpDWflsORYastyBBOpE+AyQkzga7zdvNkkw7Wy0MKR5aaXd9rgjFPdaN afnhUugc+UEbRt1nzlzhvJTOHlw3TNlVRrj8smWBpGCYLojWhxmFw1EcF4QK+QRFGHcd Rtqr5Y90GkKCiEg/vSpcYGehVUBKfEyeJYX68QwM+2oIeU+HALVufnStCrMiPa7Y6yra FItwxnhJ7MPRyvCXErCIR4DSdd6c5pDJVZMBXp9HSq3Lnv9JKxMDS0dPAvUkkZmCMRZ0 fNSw== X-Gm-Message-State: ALoCoQm/Zum5qIFDyZkSfIVT0UV1BWFjoMpdB7i6oByTEBVyJiL9bMAcWrvqWuyRrLD+E4GbKbGk X-Received: by 10.112.204.67 with SMTP id kw3mr1385667lbc.60.1447153304938; Tue, 10 Nov 2015 03:01:44 -0800 (PST) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id w132sm424881lfd.11.2015.11.10.03.01.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Nov 2015 03:01:44 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Tue, 10 Nov 2015 13:01:38 +0200 Message-Id: <1447153298-16211-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: timers patch Subject: [lng-odp] [PATCH v3] 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..aa80256 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_ERR("Error: need to increase resolution, lost tickets: %" + PRIu64"\n", overrun); + #ifdef __ARM_ARCH odp_timer *array = &tp->timers[0]; uint32_t i;