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