From patchwork Mon Oct 5 12:58:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 54495 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 6482822F05 for ; Mon, 5 Oct 2015 12:59:46 +0000 (UTC) Received: by lahq5 with SMTP id q5sf6109667lah.2 for ; Mon, 05 Oct 2015 05:59:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:errors-to :sender:x-original-sender:x-original-authentication-results :mailing-list; bh=ymwoNib7YnST343xsufdMn7VfnWq6bvtCAgKDaHujIY=; b=JYq4vARbyx7HxilO8UFkzrzyds0hoZibAV1RSW2MUjumT9jbjRQQIvWaZXx6VXqzrR P3SRlqOhRgLywZDGZyTb4JvpCdp4TpXVLxvnqqdWKQq1RrtMnXckP/Ey8zqGfP3JbHgE 0SU5UeWq858cGew79dn0dbyU4YAzz3rDV8LSqheoAZqVTssZY0hFVmU4V4zXVcMx95JG MgAGzKe2RnZo5d89A1+l6yJY5U0kFXIf2NTlLPj4bQ+mMSrOzcMJAZSLZ37UGpaq2PXJ H7MUE210q+UWDl4asrcoBEArLx3I7kgseg6O0ODvzPfQmJiDEiBqPCCK56WlgNZzG9Mr ZVGw== X-Gm-Message-State: ALoCoQm5tzf/HZrTEs2CC80jgVxnuKKv5zUuDZZ3wtBsXLEgoDjK3rp346ewZWuwjN1iWvvsUGak X-Received: by 10.194.6.170 with SMTP id c10mr5248412wja.7.1444049985311; Mon, 05 Oct 2015 05:59:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.149.7 with SMTP id x7ls452767lfd.51.gmail; Mon, 05 Oct 2015 05:59:45 -0700 (PDT) X-Received: by 10.112.156.167 with SMTP id wf7mr11461159lbb.88.1444049985157; Mon, 05 Oct 2015 05:59:45 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id l4si16877244lfb.13.2015.10.05.05.59.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Oct 2015 05:59:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbos8 with SMTP id s8so57321389lbo.0 for ; Mon, 05 Oct 2015 05:59:45 -0700 (PDT) X-Received: by 10.112.159.136 with SMTP id xc8mr7863243lbb.76.1444049984991; Mon, 05 Oct 2015 05:59:44 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1247672lbq; Mon, 5 Oct 2015 05:59:43 -0700 (PDT) X-Received: by 10.50.3.37 with SMTP id 5mr9308021igz.96.1444049983515; Mon, 05 Oct 2015 05:59:43 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id h10si8452413igh.20.2015.10.05.05.59.43; Mon, 05 Oct 2015 05:59:43 -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; Received: by lists.linaro.org (Postfix, from userid 109) id EE9E161B45; Mon, 5 Oct 2015 12:59:42 +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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 9587C61CB0; Mon, 5 Oct 2015 12:58:45 +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 732F261B45; Mon, 5 Oct 2015 12:58:40 +0000 (UTC) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com [209.85.215.51]) by lists.linaro.org (Postfix) with ESMTPS id 7FE73619AF for ; Mon, 5 Oct 2015 12:58:39 +0000 (UTC) Received: by lafb9 with SMTP id b9so36127555laf.0 for ; Mon, 05 Oct 2015 05:58:38 -0700 (PDT) X-Received: by 10.25.141.198 with SMTP id p189mr7787848lfd.9.1444049918420; Mon, 05 Oct 2015 05:58:38 -0700 (PDT) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id p133sm4253148lfp.16.2015.10.05.05.58.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Oct 2015 05:58:37 -0700 (PDT) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Mon, 5 Oct 2015 15:58:13 +0300 Message-Id: <1444049893-28349-3-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444049893-28349-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1444049893-28349-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 2/2] linux-generic: cpu: fix cycle lost while cycle counter overflow X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ivan.khoronzhuk@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 When counter reaches it's counter value, the next clock cycle will cause it to roll over to zero. As result the counter spends 1 additional cycle to switch from UINT64_MAX to 0, it should be taken into account with diff function. Signed-off-by: Ivan Khoronzhuk --- platform/linux-generic/include/odp_cpu_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux-generic/include/odp_cpu_internal.h b/platform/linux-generic/include/odp_cpu_internal.h index 28a0a84..5eeabef 100644 --- a/platform/linux-generic/include/odp_cpu_internal.h +++ b/platform/linux-generic/include/odp_cpu_internal.h @@ -19,7 +19,7 @@ uint64_t _odp_cpu_cycles_diff(uint64_t c1, uint64_t c2) if (odp_likely(c2 >= c1)) return c2 - c1; - return c2 + (odp_cpu_cycles_max() - c1); + return c2 + (odp_cpu_cycles_max() - c1) + 1; } #ifdef __cplusplus