From patchwork Fri Jul 1 13:55:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 71310 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp316526qgy; Fri, 1 Jul 2016 06:56:05 -0700 (PDT) X-Received: by 10.55.178.195 with SMTP id b186mr3400690qkf.81.1467381365863; Fri, 01 Jul 2016 06:56:05 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id x123si2416502qkb.287.2016.07.01.06.56.05; Fri, 01 Jul 2016 06:56:05 -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; 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; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 309016856D; Fri, 1 Jul 2016 13:56:05 +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_H2, 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 054096858B; Fri, 1 Jul 2016 13:56:01 +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 19C0068598; Fri, 1 Jul 2016 13:55:59 +0000 (UTC) Received: from mail-oi0-f44.google.com (mail-oi0-f44.google.com [209.85.218.44]) by lists.linaro.org (Postfix) with ESMTPS id 4C7AE6856D for ; Fri, 1 Jul 2016 13:55:58 +0000 (UTC) Received: by mail-oi0-f44.google.com with SMTP id f189so111507150oig.3 for ; Fri, 01 Jul 2016 06:55:58 -0700 (PDT) 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=LF6lDGg/R7FhIovtWYF6wbq+nSHBpaBnIoETcM9smFM=; b=cwNvKy8vYjS8F+Q7PLidwBXxTH7Q40fd1IgxhWsQjlJUeuw4gfnAsta0tsQUneLD7o rAj4MHmtEjhvaXQJGmK+fRRENW8ruCoSqBQegVwn3O1rtDxjFNDJtsTFHnj3Npn9G5h8 srEZIkLVIJoVyZoYDCo/8S0Gdl9yfFUo1GiJCzCYL2nKIpC8YCaOMEKoD2oj+FX5fdrr XvDAGUTSUFiApD+3h+Lw9br+bdIS4sNoxOxlMa1x/KD/vmQ0oVwUJSAyRppBaZjjKb8z 3/GaPn+LSNbib5PpLX1NVW5tazkw/lYIVFFOBJaLdSv1l/MWDCney9GpXnPW4unMy+mU RfGA== X-Gm-Message-State: ALyK8tLSVnxRwqiU6WYv91dyrmmkef6G2kVQWK3Wfx7ToKOJaPD29vem+db+wsGZS4cci7t4TiE= X-Received: by 10.157.7.68 with SMTP id 62mr12920693ote.168.1467381357749; Fri, 01 Jul 2016 06:55:57 -0700 (PDT) Received: from localhost.localdomain (cpe-66-68-129-43.austin.res.rr.com. [66.68.129.43]) by smtp.gmail.com with ESMTPSA id v55sm5318304otv.12.2016.07.01.06.55.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Jul 2016 06:55:57 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Fri, 1 Jul 2016 08:55:54 -0500 Message-Id: <1467381354-13151-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.7.4 X-Topics: patch Subject: [lng-odp] [PATCH] linux-generic: schedule: simplify wait logic to avoid clang issues 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" Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2387 by ensuring that t1 variable is see as initialized in all paths in the SP Scheduler. Previous logic failed due to an apparent issue with clang. Signed-off-by: Bill Fischofer --- platform/linux-generic/odp_schedule_sp.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/odp_schedule_sp.c index 8c45123..e373d7f 100644 --- a/platform/linux-generic/odp_schedule_sp.c +++ b/platform/linux-generic/odp_schedule_sp.c @@ -364,10 +364,9 @@ static uint64_t schedule_wait_time(uint64_t ns) } static int schedule_multi(odp_queue_t *from, uint64_t wait, - odp_event_t events[], int max_events) + odp_event_t events[], int max_events ODP_UNUSED) { - (void)max_events; - int update_t1 = 1; + odp_time_t t1 = ODP_TIME_NULL; if (sched_local.cmd) { /* Continue scheduling if queue is not empty */ @@ -384,7 +383,6 @@ static int schedule_multi(odp_queue_t *from, uint64_t wait, sched_cmd_t *cmd; uint32_t qi; int num; - odp_time_t t1; cmd = sched_cmd(NUM_PRIO); @@ -410,16 +408,15 @@ static int schedule_multi(odp_queue_t *from, uint64_t wait, if (wait == ODP_SCHED_WAIT) continue; - if (update_t1) { + if (odp_time_cmp(odp_time_local(), t1) < 0) + continue; + + if (odp_time_cmp(t1, ODP_TIME_NULL) == 0) { t1 = odp_time_sum(odp_time_local(), odp_time_local_from_ns(wait)); - update_t1 = 0; continue; } - if (odp_time_cmp(odp_time_local(), t1) < 0) - continue; - return 0; }