From patchwork Wed Feb 21 00:00:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 128984 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp14799ljc; Tue, 20 Feb 2018 16:00:56 -0800 (PST) X-Google-Smtp-Source: AH8x225tp4dJ6s9EzM/mVnTl/uEDbVEccbe1LOG2t98T1af6bLM0A19IWQPGPW2Id/lLNEEC18XE X-Received: by 10.237.43.226 with SMTP id e89mr2444483qtd.17.1519171256322; Tue, 20 Feb 2018 16:00:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519171256; cv=none; d=google.com; s=arc-20160816; b=NjdW3t+s7XHwul3xcbt+Yb3HD09xCADOv/yLD0yGkvXB783/jz4QuGoR8DX+YLgK+Z UmYTSzlbkOkJk8X/4QlbrQHdK9F0m2nQsbM2TXiHZtzpCzvyxgB1HVwjQEaVvxfURgXm AQL+s5+lG8cpiv5cJwR27URxHKEsoA8AC4//bKBcyf1qJrXHA5WhL2S3tlG7HW7vI7Yb tJHndJJi25oJrLGvqmYLjz8VNIgWDf8+R1JX3RFj+oNgFMUOR5H77SM323BS9H8SUU/I +5zJbfMAFC2x8CsJoEkdT+zXa5ya/I2Sm6JriZhj80ps/jc7qFvyd5MuDf5R5zzFwDj2 32jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=b7bdZiMBzED61QISu/lE4OGBv9ZKcnduKD4cNS+gCHg=; b=QBOqDduxbUWALum61Ow2nLUFaLnY3dGIZ4Eal/WitrSeOSPYFA8+5++ujgo3ofHbLS JPwXL5pU/ImbRtEMXAR5kYj2fg8zdtKSDGIWjs94b+Y4QYLq8dtshXvEd/cXJGfWW2LH ESPJN73Hi4ac2FgQrvC09InZYac00EMxc+8Ao9olOB5F1CA7fY+v2jl63aE48A1MgTJI jld5e+MlZQJNiEcwZtJVNnOvDeAtX8tw7OADyCRmILbIw+G1R8Q6MXhJLMOZ7RMWplkJ ad7oem9TozdYSTa58ztH0a82nn8gRIQdEUaz8AKm3tA8fq5wJDfKdNJMMmzFzli7E6hg ixrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id m5si3056448qkd.12.2018.02.20.16.00.54; Tue, 20 Feb 2018 16:00:56 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 6D85E60883; Wed, 21 Feb 2018 00:00:54 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 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 05D8F61762; Wed, 21 Feb 2018 00:00:19 +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 B464861755; Wed, 21 Feb 2018 00:00:13 +0000 (UTC) Received: from forward104o.mail.yandex.net (forward104o.mail.yandex.net [37.140.190.179]) by lists.linaro.org (Postfix) with ESMTPS id E858E61736 for ; Wed, 21 Feb 2018 00:00:11 +0000 (UTC) Received: from mxback1g.mail.yandex.net (mxback1g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:162]) by forward104o.mail.yandex.net (Yandex) with ESMTP id 84755705001 for ; Wed, 21 Feb 2018 03:00:10 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback1g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id JRsh7Xaj8c-0AK4bkt3; Wed, 21 Feb 2018 03:00:10 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id zJRMDvitb1-09hC2g9S; Wed, 21 Feb 2018 03:00:09 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 03:00:06 +0300 Message-Id: <1519171208-17451-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519171208-17451-1-git-send-email-odpbot@yandex.ru> References: <1519171208-17451-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 491 Subject: [lng-odp] [PATCH v2 1/3] validation: timer: fix "Failed to set timer" error 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Occasionally timer test will try to set timer to a tick that has just passed. It is not an error per se, so it should be handled properly. Signed-off-by: Dmitry Eremin-Solenikov Fixes: https://bugs.linaro.org/show_bug.cgi?id=3628 --- /** Email created from pull request 491 (lumag:timer-fix-2) ** https://github.com/Linaro/odp/pull/491 ** Patch: https://github.com/Linaro/odp/pull/491.patch ** Base sha: 5a58bbf2bb331fd7dde2ebbc0430634ace6900fb ** Merge commit sha: cdd45b49da3a6602badcf7c456c6b26d34dd2c9f **/ test/validation/api/timer/timer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/validation/api/timer/timer.c b/test/validation/api/timer/timer.c index 26a5b6086..b4e903768 100644 --- a/test/validation/api/timer/timer.c +++ b/test/validation/api/timer/timer.c @@ -372,7 +372,10 @@ static int worker_entrypoint(void *arg TEST_UNUSED) odp_timer_ns_to_tick(tp, (rand_r(&seed) % RANGE_MS) * 1000000ULL); timer_rc = odp_timer_set_abs(tt[i].tim, tck, &tt[i].ev); - if (timer_rc != ODP_TIMER_SUCCESS) { + if (timer_rc == ODP_TIMER_TOOEARLY) { + LOG_ERR("Missed tick, setting timer\n"); + } else if (timer_rc != ODP_TIMER_SUCCESS) { + LOG_ERR("Failed to set timer: %d\n", timer_rc); CU_FAIL("Failed to set timer"); } else { tt[i].tick = tck; From patchwork Wed Feb 21 00:00:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 128985 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp15303ljc; Tue, 20 Feb 2018 16:01:24 -0800 (PST) X-Google-Smtp-Source: AH8x2260eCMnAcru3c5ovd6/ZRdxX7djnGPzN9aFjTG9Z39GkjHRX1/W/ok06f0vzZfYqP1AxG9S X-Received: by 10.200.56.153 with SMTP id f25mr2509962qtc.9.1519171284668; Tue, 20 Feb 2018 16:01:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519171284; cv=none; d=google.com; s=arc-20160816; b=y5qnZbkpcvIU3KTElTy23qyfFMpxuirOP7yG1osr+rw6v+KlxSrjrnFdjWaHt8pDsV QraJIp3Y0F9myD639H0FBaQGLidnBMUvTQIij1B55VDQMz6GcqKvY/ZaUHi4Lo8YGnzv yakof9ywxv14Eh5ubBVTMqdKaewhgktsm0RKgjai+M5yZDD9Ehr140Jwn9X3arxB9cDs pvnraLlbsn/V2/kI+ieNZ3T+fSdAnygUldHBu1AB3TeWe8jHYq8lsLzDv/JSi1PBEWML eMyCj/Wg6PEziDUO7LdcFzGEEUs9t9GxGH/6yBMr+4Lw//TO5VGxUyihdSifGZ4HjIk8 Mz0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=FVYhJ0dLgkrFC4x3RfwJPlfvOcasfqD4I22o0+2c3hY=; b=IziP2x4O/e5EI7jOBky/F3ncdQVLSjMNFkAHmyYJA2aAjyQb98Tp7F8K6dXVEdKIDx 9sAFu4J4j2IWbIqYCmRd9NW8AvG9Ax6+GtV8IQ799JGCRIr23OudU4FUbKlUKzXVk8ob aAU2lKXzLYPnvoz5ZxT23q5cVz+ErRUUYXqOyVE8Hq41CU4ycwB0WsBGR9GiB+kQfgeU LFPNFz2XMqOXr2VHTADBUYoADvmap2D2jQxfYY/63qQKrdV4BlJLnvYeQU2XEWuO2iaI boThVwtSE1x+9/2oUxt83QiJXAcfqK7H01RYVIrDe8oUFLN5uOmH83eD6uvmrvY7WPAV 73/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id o22si629654qtm.367.2018.02.20.16.01.24; Tue, 20 Feb 2018 16:01:24 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 25CA16171C; Wed, 21 Feb 2018 00:01:24 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW 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 7A5996177B; Wed, 21 Feb 2018 00:00:24 +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 74BE861737; Wed, 21 Feb 2018 00:00:17 +0000 (UTC) Received: from forward103o.mail.yandex.net (forward103o.mail.yandex.net [37.140.190.177]) by lists.linaro.org (Postfix) with ESMTPS id 33EE161739 for ; Wed, 21 Feb 2018 00:00:13 +0000 (UTC) Received: from mxback15j.mail.yandex.net (mxback15j.mail.yandex.net [IPv6:2a02:6b8:0:1619::91]) by forward103o.mail.yandex.net (Yandex) with ESMTP id AD3E05886EBA for ; Wed, 21 Feb 2018 03:00:11 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback15j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 3PyOtyL704-0BvG4dt0; Wed, 21 Feb 2018 03:00:11 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id zJRMDvitb1-0BhCISwf; Wed, 21 Feb 2018 03:00:11 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 03:00:08 +0300 Message-Id: <1519171208-17451-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519171208-17451-1-git-send-email-odpbot@yandex.ru> References: <1519171208-17451-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 491 Subject: [lng-odp] [PATCH v2 3/3] validation: timer: fix test failure 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov timer_main test was regularly failing due to worker code receiving timeout events for cancelled timers in invalid state. However after fixing implementation bug, several other asserts started to fail, as they dependent on incorrect behaviour, like non-freshness of cancelled events. Fixes: https://bugs.linaro.org/show_bug.cgi?id=3517 Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 491 (lumag:timer-fix-2) ** https://github.com/Linaro/odp/pull/491 ** Patch: https://github.com/Linaro/odp/pull/491.patch ** Base sha: 5a58bbf2bb331fd7dde2ebbc0430634ace6900fb ** Merge commit sha: cdd45b49da3a6602badcf7c456c6b26d34dd2c9f **/ test/validation/api/timer/timer.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/test/validation/api/timer/timer.c b/test/validation/api/timer/timer.c index b4e903768..2914faf79 100644 --- a/test/validation/api/timer/timer.c +++ b/test/validation/api/timer/timer.c @@ -274,15 +274,10 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t prev_tick) CU_FAIL("odp_timeout_user_ptr() wrong user ptr"); if (ttp && ttp->tim != tim) CU_FAIL("odp_timeout_timer() wrong timer"); - if (stale) { - if (odp_timeout_fresh(tmo)) - CU_FAIL("Wrong status (fresh) for stale timeout"); - /* Stale timeout => local timer must have invalid tick */ - if (ttp && ttp->tick != TICK_INVALID) - CU_FAIL("Stale timeout for active timer"); - } else { - if (!odp_timeout_fresh(tmo)) - CU_FAIL("Wrong status (stale) for fresh timeout"); + + if (!odp_timeout_fresh(tmo)) + CU_FAIL("Wrong status (stale) for fresh timeout"); + if (!stale) { /* Fresh timeout => local timer must have matching tick */ if (ttp && ttp->tick != tick) { LOG_DBG("Wrong tick: expected %" PRIu64 @@ -290,6 +285,9 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t prev_tick) ttp->tick, tick); CU_FAIL("odp_timeout_tick() wrong tick"); } + if (ttp && ttp->ev != ODP_EVENT_INVALID) + CU_FAIL("Wrong state for fresh timer (event)"); + /* Check that timeout was delivered 'timely' */ if (tick > odp_timer_current_tick(tp)) CU_FAIL("Timeout delivered early"); @@ -403,11 +401,14 @@ static int worker_entrypoint(void *arg TEST_UNUSED) (rand_r(&seed) % 2 == 0)) { /* Timer active, cancel it */ rc = odp_timer_cancel(tt[i].tim, &tt[i].ev); - if (rc != 0) + if (rc != 0) { /* Cancel failed, timer already expired */ ntoolate++; - tt[i].tick = TICK_INVALID; - ncancel++; + LOG_DBG("Failed to cancel timer, probably already expired\n"); + } else { + tt[i].tick = TICK_INVALID; + ncancel++; + } } else { if (tt[i].ev != ODP_EVENT_INVALID) /* Timer inactive => set */ @@ -461,7 +462,7 @@ static int worker_entrypoint(void *arg TEST_UNUSED) thr, ntoolate); LOG_DBG("Thread %u: %" PRIu32 " timeouts received\n", thr, nrcv); LOG_DBG("Thread %u: %" PRIu32 - " stale timeout(s) after odp_timer_free()\n", + " stale timeout(s) after odp_timer_cancel()\n", thr, nstale); /* Delay some more to ensure timeouts for expired timers can be