Message ID | 1445515299-18496-2-git-send-email-ivan.khoronzhuk@linaro.org |
---|---|
State | Superseded |
Headers | show
Return-Path: <patchwork-forward+bncBDSIZNM7U4BRBUFAUOYQKGQEZQPHJ7A@linaro.org> X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f69.google.com (mail-lf0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id B86E422AA5 for <linaro@patches.linaro.org>; Thu, 22 Oct 2015 12:02:25 +0000 (UTC) Received: by lffz202 with SMTP id z202sf31397299lff.3 for <linaro@patches.linaro.org>; Thu, 22 Oct 2015 05:02:24 -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=2Wo/F91XMVLJgM/9YX4/aj8cB8N9wwhuCY4+bNwkfiY=; b=PzXBdqD8nkAflKR73ZyfSxUpwNZP60hQANL25yjgpUtXEXJ874zrzpPUl4YKF+rtQW RjUdWtkHvuKgRf9vfP55HlDUVKJn259MBTccOvUen99CbQKS5uA1Hdrxz2X4Lus2Xk7+ /ynJcAljxjF2QXcMQzQNXVudsh4au8T7sABqkQa/89dnf9Hxw5TnI+tvJCNdOv1gAed4 bba+mpkVsyET3AWM275DhsMkw9bo26WSGyM30/U5u+dg0/WVr1n2kfA5zJ1fyJ4DdGf5 bjPzeSugaiyXhb6vSguElEjo8k8Tf5PS58cFR6LW542wrURM1neUyR+ToMOB06xwOBeG rBSw== X-Gm-Message-State: ALoCoQky+4hSovsNLHjV2l5/EGZDE1CckTsOkXTPWkEJPnhYGGT1Xefrd+KJxYUbg0ggxtaNebZ5 X-Received: by 10.180.87.74 with SMTP id v10mr2750765wiz.5.1445515344572; Thu, 22 Oct 2015 05:02:24 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.144.6 with SMTP id s6ls336082lfd.91.gmail; Thu, 22 Oct 2015 05:02:24 -0700 (PDT) X-Received: by 10.25.15.163 with SMTP id 35mr5284725lfp.98.1445515344416; Thu, 22 Oct 2015 05:02:24 -0700 (PDT) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id mj20si9392811lbb.45.2015.10.22.05.02.24 for <patchwork-forward@linaro.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Oct 2015 05:02:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lffv3 with SMTP id v3so44963495lff.0 for <patchwork-forward@linaro.org>; Thu, 22 Oct 2015 05:02:24 -0700 (PDT) X-Received: by 10.112.199.137 with SMTP id jk9mr8268665lbc.86.1445515344266; Thu, 22 Oct 2015 05:02:24 -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 w3csp559153lbq; Thu, 22 Oct 2015 05:02:23 -0700 (PDT) X-Received: by 10.141.28.69 with SMTP id f66mr17835812qhe.67.1445515343236; Thu, 22 Oct 2015 05:02:23 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f75si12946223qkf.66.2015.10.22.05.02.22; Thu, 22 Oct 2015 05:02:23 -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 C89AB61CF5; Thu, 22 Oct 2015 12:02:22 +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 2871C61CCC; Thu, 22 Oct 2015 12:02:14 +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 5843861D1D; Thu, 22 Oct 2015 12:02:11 +0000 (UTC) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) by lists.linaro.org (Postfix) with ESMTPS id 9B61961CCC for <lng-odp@lists.linaro.org>; Thu, 22 Oct 2015 12:01:49 +0000 (UTC) Received: by lffz202 with SMTP id z202so45063855lff.3 for <lng-odp@lists.linaro.org>; Thu, 22 Oct 2015 05:01:48 -0700 (PDT) X-Received: by 10.112.64.72 with SMTP id m8mr7898617lbs.41.1445515308576; Thu, 22 Oct 2015 05:01:48 -0700 (PDT) Received: from khorivan.synapse.com ([212.90.60.8]) by smtp.gmail.com with ESMTPSA id bn5sm2296353lbc.16.2015.10.22.05.01.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Oct 2015 05:01:47 -0700 (PDT) From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> To: lng-odp@lists.linaro.org, petri.savolainen@nokia.com Date: Thu, 22 Oct 2015 15:01:35 +0300 Message-Id: <1445515299-18496-2-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445515299-18496-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1445515299-18496-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH v5 1/5] performance: odp_pktio_perf: fix potential overflow in wait loop X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: <patchwork-forward.linaro.org> List-Unsubscribe: <mailto:googlegroups-manage+836684582541+unsubscribe@googlegroups.com>, <http://groups.google.com/a/linaro.org/group/patchwork-forward/subscribe> List-Archive: <http://groups.google.com/a/linaro.org/group/patchwork-forward/> List-Post: <http://groups.google.com/a/linaro.org/group/patchwork-forward/post>, <mailto:patchwork-forward@linaro.org> List-Help: <http://support.google.com/a/linaro.org/bin/topic.py?topic=25838>, <mailto:patchwork-forward+help@linaro.org> List-Subscribe: <https://lists.linaro.org/mailman/listinfo/lng-odp>, <mailto:lng-odp-request@lists.linaro.org?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" <lng-odp-bounces@lists.linaro.org> 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.215.50 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 |
diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index efd26dc..ae5b4c0 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -591,9 +591,13 @@ static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx, */ static void busy_loop_ns(uint64_t wait_ns) { - uint64_t end = odp_time_cycles() + odp_time_ns_to_cycles(wait_ns); - while (odp_time_cycles() < end) - ; + uint64_t diff; + uint64_t start_time = odp_time_cycles(); + uint64_t wait = odp_time_ns_to_cycles(wait_ns); + + do { + diff = odp_time_diff_cycles(start_time, odp_time_cycles()); + } while (diff < wait); } /*
There cannot be used direct comparison of timestamps of counter that can overflow, better to compare ranges. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> --- test/performance/odp_pktio_perf.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)