From patchwork Thu Feb 15 01: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: 128386 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1197110ljc; Wed, 14 Feb 2018 17:00:26 -0800 (PST) X-Google-Smtp-Source: AH8x227Ng4vT7IR5QEKRLn1hyDuFSrc6tnOU9gX7yhMWAUq2Sx5KzEyFPIyc1SSIhBoBMRXN0fI2 X-Received: by 10.55.99.202 with SMTP id x193mr1499402qkb.125.1518656426307; Wed, 14 Feb 2018 17:00:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518656426; cv=none; d=google.com; s=arc-20160816; b=Q9rBaEVE6UG9+V5tNPDZtrO/s/c6/gWr9ztSTY9xY1QTT5AEgGQNour2HoxjFmHnpY HpJ42D8kXSheWmk/F8+IndRTy3949tbBqu8oqQgcSN4ufcxfY0KmYtpw3CUrdarEcCc0 XVXF0tsEP/f4Q6VKHntmc2B6/rnYDQwZBqp5rURugkARodZgZH52xyNUZxZfDDdhzwcQ 1deF649CZt21NWsAP7bX2iqrp20fzeEZ3MqBxQ4vCiw/uitAaQQPhvM4z0X6u/K68yB4 vue8CNeAJJKTCJoC5Ugu0FuLZ6Pe6iM25cMUfHdc2fOFDC1xhl+kJG7/d1D99EKCfjx9 SuzQ== 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=qGZUOR+DCN67vk58EymiWQS/gzb5wHbhykaeO+KFdg8=; b=gYDSSeus7ZKNSAGlUo28xbXM1d+YCqPcjb94zSLoPg7fuj4pjAv2r17nUNvHIHRj4M UBFPyeDX2mHe2cYpALYBufTmKB/dFRTKG1iUBpHtTxIkgaPJBQQz7en6KO2HAzYBQYwe L+9pM7gJAsxssQtvFVCPfKmXzjWFMysQoWAoR9u0Rs4lKxK8MXJflrn/+uBz+6rUIYkd FTlMV/HrmWS3TcwWjNUmKBN4GelgeXjfT4O8SnlXVUltMAiv6KKsJdwN9pbDXAV9Kyh6 lamgdDUjp7qYzc1bipCPIPNKUlRPAabx0Ey5QVBNbfwhpy3Tt9TMHR+g3o+i4Lh/dHh8 xubQ== 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 d84si4647291qkh.142.2018.02.14.17.00.25; Wed, 14 Feb 2018 17:00:26 -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 532D5608C0; Thu, 15 Feb 2018 01:00:25 +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 995AE6093A; Thu, 15 Feb 2018 01:00:18 +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 4FCFF6177D; Thu, 15 Feb 2018 01:00:15 +0000 (UTC) Received: from forward103p.mail.yandex.net (forward103p.mail.yandex.net [77.88.28.106]) by lists.linaro.org (Postfix) with ESMTPS id 63BCA60745 for ; Thu, 15 Feb 2018 01:00:13 +0000 (UTC) Received: from mxback15j.mail.yandex.net (mxback15j.mail.yandex.net [IPv6:2a02:6b8:0:1619::91]) by forward103p.mail.yandex.net (Yandex) with ESMTP id 6179B2185161 for ; Thu, 15 Feb 2018 04:00:11 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback15j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Y3LKX1JGE1-0BqWo1H1; Thu, 15 Feb 2018 04:00:11 +0300 Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id mdVomAt4eE-0AY03TZa; Thu, 15 Feb 2018 04:00:10 +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: Thu, 15 Feb 2018 04:00:08 +0300 Message-Id: <1518656409-31169-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518656409-31169-1-git-send-email-odpbot@yandex.ru> References: <1518656409-31169-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 479 Subject: [lng-odp] [PATCH v3 1/2] 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. I'm fixing worker code to handle these events correctly, however this might signify a loophole in API definition or in linux-generic implementation. Should application be able to copy with timers that are cancelled after expiration (but before event reception)? Should implementation mark such timers as non-fresh? Signed-off-by: Dmitry Eremin-Solenikov Fixes: https://bugs.linaro.org/show_bug.cgi?id=3517 Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 479 (lumag:timer-fix) ** https://github.com/Linaro/odp/pull/479 ** Patch: https://github.com/Linaro/odp/pull/479.patch ** Base sha: 41b3fa2cd994a7ef68290a07dcde5564e4640847 ** Merge commit sha: eff72e496790b8e924e3fceaea22548fa28241b8 **/ test/validation/api/timer/timer.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/test/validation/api/timer/timer.c b/test/validation/api/timer/timer.c index 7ea508aa0..da2dc05ca 100644 --- a/test/validation/api/timer/timer.c +++ b/test/validation/api/timer/timer.c @@ -282,15 +282,28 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t prev_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"); - /* Fresh timeout => local timer must have matching tick */ - if (ttp && ttp->tick != tick) { - LOG_DBG("Wrong tick: expected %" PRIu64 - " actual %" PRIu64 "\n", - ttp->tick, tick); - CU_FAIL("odp_timeout_tick() wrong tick"); + if (ttp && ttp->tick == TICK_INVALID) { + /* Timer was cancelled when it has already expired */ + + if (odp_timeout_fresh(tmo)) + CU_FAIL("Wrong status (fresh) " + "for cancelled timeout"); + } else { + if (!odp_timeout_fresh(tmo)) + CU_FAIL("Wrong status (stale) " + "for fresh timeout"); + + /* Fresh timeout => local timer must have matching tick + */ + if (ttp && ttp->tick != tick) { + LOG_DBG("Wrong tick: expected %" PRIu64 + " actual %" PRIu64 "\n", + 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"); @@ -401,9 +414,11 @@ 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++; + LOG_DBG("Failed to cancel timer, probably already expired\n"); + } tt[i].tick = TICK_INVALID; ncancel++; } else { From patchwork Thu Feb 15 01:00:09 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: 128387 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1197598ljc; Wed, 14 Feb 2018 17:00:59 -0800 (PST) X-Google-Smtp-Source: AH8x226FQIF9zQBckfKug+0IHX+wgKF75iZlIjnLVphAjGgUf4s3VryqvNtsewQ+Uaj3G1l3fNcP X-Received: by 10.55.75.151 with SMTP id y145mr1549416qka.281.1518656459734; Wed, 14 Feb 2018 17:00:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518656459; cv=none; d=google.com; s=arc-20160816; b=shooqZ4KYaGWw54Kq2uUo50T6aE/svu5foe1Wgl9XKebVAR1wIX0Bn6YgKau/oVFgi GujXyC0+H/jt4nKsGCmWP2jrr5Ht2Bj40veh0+4xLZI5U5I1kUeuusqQtxigOwMAwQqb 12e5/k9IdZRk5Ix5WbsC+MDzQ3/UL4QtNF4DiP+O9sfGxMpej6o5tpZ/yW5it1PlIX2s 8QwDjw2Kmr4FrTlbfls2R2omojfZaj1VNTaeXI2vonKU3+SkFAWoZftXWwqJXjGl8hZ7 /TLpAPU75ZNGtNs0iYiUTiAgsQU8IpgMnqfVoJp3AhGk85wlroZ58UogXDl2uWnIdeSE Cq0Q== 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=lMZuNYmXB0qSTNtg0qCpzWEm6SnpnXlArFuHyhmP2J0=; b=VrdKkcFguhGQbVLbs+l6hNQBWBeFsWX5+QcHHDFyntukx45u0TxRfEwqYE76EwDFyE nSW2RuK6krZDxQeUrHyibtWOeGVMXNBgxWda3Wz6RG/+eBaQfuYE30JdU4v2LAqMOdds 3J6x6EDNIjZT6RFz8RfXZzYcC8J77mrioLZDKeENai8IPWee+OgFHP2x0Z0R5BX6WPaZ eFv8gDPakmCHh/RS44mAe1Q4T/H0onj1QDG+tfRXxUhSu8NY/s33aPcif7mlyWi8kMgU QymFvfhX6DhD9qhf8YMCFDhLNX3yf4tl5yJBmbHJ/ReSdI9YsOXrI27iwLFYwVK0u8TH xTlw== 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 a6si1754893qkb.411.2018.02.14.17.00.59; Wed, 14 Feb 2018 17:00:59 -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 611666174A; Thu, 15 Feb 2018 01:00:59 +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 19F9A617B5; Thu, 15 Feb 2018 01: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 B5D6A6174A; Thu, 15 Feb 2018 01:00:15 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id A8F126093A for ; Thu, 15 Feb 2018 01:00:13 +0000 (UTC) Received: from mxback5o.mail.yandex.net (mxback5o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1f]) by forward101j.mail.yandex.net (Yandex) with ESMTP id 391C01245369 for ; Thu, 15 Feb 2018 04:00:12 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback5o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id CUg9kNTp7k-0CTq88Pp; Thu, 15 Feb 2018 04:00:12 +0300 Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id mdVomAt4eE-0BY85kXw; Thu, 15 Feb 2018 04: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: Thu, 15 Feb 2018 04:00:09 +0300 Message-Id: <1518656409-31169-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518656409-31169-1-git-send-email-odpbot@yandex.ru> References: <1518656409-31169-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 479 Subject: [lng-odp] [PATCH v3 2/2] 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 --- /** Email created from pull request 479 (lumag:timer-fix) ** https://github.com/Linaro/odp/pull/479 ** Patch: https://github.com/Linaro/odp/pull/479.patch ** Base sha: 41b3fa2cd994a7ef68290a07dcde5564e4640847 ** Merge commit sha: eff72e496790b8e924e3fceaea22548fa28241b8 **/ 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 da2dc05ca..0dfb565e2 100644 --- a/test/validation/api/timer/timer.c +++ b/test/validation/api/timer/timer.c @@ -386,7 +386,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;