From patchwork Mon Sep 7 08:50:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 53215 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id E7E4422B05 for ; Mon, 7 Sep 2015 08:51:18 +0000 (UTC) Received: by lbcjc2 with SMTP id jc2sf23419353lbc.0 for ; Mon, 07 Sep 2015 01:51:17 -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: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=H1AWcMkCWa4P6jFva6U70sfIUryLRxnC4uoSRWgFSIc=; b=SgtozjNUALvhz2yHVDgu5vYyicJGcmSIx3Jr+dnhoFls3Du/6c8tzpZ3c7fyLQjnf0 BYVBzZVAMRApg5mceIrb9CSFZfl6gm4AtbaX7qVkxM5qDXfgqbGZ5W46craZlJ+sCuDa enVl39l5v68tdog6JlmtMu7WxQCBvL83GdU/kP26I2Xom1RcY7tmUktpcmnclOIflu3s 9hZJX1dZ4yX1JDGd8uC1cPZVlABNX/ac0IyZb6FV5LyNmkWsaHheMtn/WojJ33A5joV2 3BobGdt/x6GR/TydSyfq1GKGnoSw8SydQcHPFjKR9ufqfhnmZn1SJF5A4zDLQkODElfM KkAA== X-Gm-Message-State: ALoCoQkRhdqpIc8oTOR0oh8r3ePW/+LlNvXqMOs57GhEQn/JO2OTBS99fGwA8M8+Zi2J8I8v+Jcj X-Received: by 10.180.9.104 with SMTP id y8mr4756128wia.7.1441615877910; Mon, 07 Sep 2015 01:51:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.10 with SMTP id o10ls572496lah.22.gmail; Mon, 07 Sep 2015 01:51:17 -0700 (PDT) X-Received: by 10.112.184.137 with SMTP id eu9mr15935738lbc.21.1441615877616; Mon, 07 Sep 2015 01:51:17 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id mr8si9856770lbb.104.2015.09.07.01.51.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Sep 2015 01:51:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbcao8 with SMTP id ao8so35686889lbc.3 for ; Mon, 07 Sep 2015 01:51:17 -0700 (PDT) X-Received: by 10.112.166.106 with SMTP id zf10mr15976760lbb.36.1441615877451; Mon, 07 Sep 2015 01:51:17 -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 w3csp241977lbq; Mon, 7 Sep 2015 01:51:16 -0700 (PDT) X-Received: by 10.140.33.225 with SMTP id j88mr24970669qgj.30.1441615876462; Mon, 07 Sep 2015 01:51:16 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id h12si13011086qhc.71.2015.09.07.01.51.15; Mon, 07 Sep 2015 01:51:16 -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 6378061952; Mon, 7 Sep 2015 08:51:15 +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 6BD6D6184A; Mon, 7 Sep 2015 08:51:11 +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 5FC96618F6; Mon, 7 Sep 2015 08:51:09 +0000 (UTC) Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by lists.linaro.org (Postfix) with ESMTPS id 6DCBE61845 for ; Mon, 7 Sep 2015 08:51:08 +0000 (UTC) Received: by wicge5 with SMTP id ge5so75472656wic.0 for ; Mon, 07 Sep 2015 01:51:07 -0700 (PDT) X-Received: by 10.194.86.134 with SMTP id p6mr35426426wjz.71.1441615867701; Mon, 07 Sep 2015 01:51:07 -0700 (PDT) Received: from khorivan.synapse.com ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id gt4sm19102524wib.21.2015.09.07.01.51.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Sep 2015 01:51:06 -0700 (PDT) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Mon, 7 Sep 2015 11:50:59 +0300 Message-Id: <1441615859-23305-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [Patch] linux-generic: odp_schedule: fix odp_schdule_wait_time 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.169 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 The resolution of schedule time can be more than 1ns. As result can happen that 1ns corresponds 0 ticks of timer counter, but if passed 1ns it's obvious that user wanted to schedule at least once. Currently it can lead to wait forever, as 0 corresponds to ODP_SCHED_WAIT, it can block program flow at all. Signed-off-by: Ivan Khoronzhuk Reviewed-by: Nicolas Morey-Chaisemartin --- Prerequisit for this patch was taken from: "[lng-odp] [Patch] validation: scheduler: increase time check" https://lists.linaro.org/pipermail/lng-odp/2015-August/014738.html platform/linux-generic/odp_schedule.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index c6619e5..05497de 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -646,10 +646,13 @@ void odp_schedule_resume(void) uint64_t odp_schedule_wait_time(uint64_t ns) { - if (ns <= ODP_SCHED_NO_WAIT) - ns = ODP_SCHED_NO_WAIT + 1; + uint64_t time; - return odp_time_ns_to_cycles(ns); + time = odp_time_ns_to_cycles(ns); + if (!time) + time = ODP_SCHED_NO_WAIT; + + return time; }