From patchwork Thu May 12 19:35:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 67699 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp924725qge; Thu, 12 May 2016 12:38:08 -0700 (PDT) X-Received: by 10.140.228.16 with SMTP id y16mr12169864qhb.83.1463081888618; Thu, 12 May 2016 12:38:08 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id g126si9526719qkb.106.2016.05.12.12.38.08; Thu, 12 May 2016 12:38:08 -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 4400561605; Thu, 12 May 2016 19:38:08 +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 664D761650; Thu, 12 May 2016 19:36:16 +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 71B0061605; Thu, 12 May 2016 19:36:08 +0000 (UTC) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com [209.85.215.44]) by lists.linaro.org (Postfix) with ESMTPS id 253B261589 for ; Thu, 12 May 2016 19:36:07 +0000 (UTC) Received: by mail-lf0-f44.google.com with SMTP id m64so77285660lfd.1 for ; Thu, 12 May 2016 12:36:07 -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=NIy1ktBh4+TwPM32f5QQycEfABfwF8gmThQp297yDk0=; b=EO6Qcq0Vh0cYsxtlW5vXNskh1scuNvBQ2BPiPUlOqT4OdEl21GXjHh9IQSg1AnLs5G cktlGkvdywZB/FRPrb/Rc2UzGMTHgreRYYR+4kN3i0cVaH0fi9CzJ89GvjjwOkRO4Wmh nVd0Vv2uEw7HyEEuaal78AY+4LU3YQTu+X9p45gmS9avuLr9OkDeqHsZBJeWa3CQh//3 Ur5ZWvka3s51COSoepNCtgBZqTcxSaaRiDPyx49HqI5HcXF9C0S3ZEYZiT71PKU5T5S6 QTcma3xJEMGyPthL9kScYgAbxg3Opw5ZZZqKeJGoLSHdOuDzKRzsHWf7Ie5lvr3Ifljn K39A== X-Gm-Message-State: AOPr4FVGg7klV3qOT6xy2h5Id2bcDheLLkqsqKXqg1RpkXeqUBhLCLQyOMAeLyKi7ozvJaUPuPk= X-Received: by 10.25.15.228 with SMTP id 97mr5429824lfp.126.1463081765501; Thu, 12 May 2016 12:36:05 -0700 (PDT) Received: from localhost.localdomain (ppp91-77-173-31.pppoe.mtu-net.ru. [91.77.173.31]) by smtp.gmail.com with ESMTPSA id p67sm708382lfp.49.2016.05.12.12.36.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 May 2016 12:36:04 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Thu, 12 May 2016 22:35:54 +0300 Message-Id: <1463081754-26555-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 2.7.1.250.gff4ea60 X-Topics: timers patch Subject: [lng-odp] [PATCH] validation: timer: fix handle unused tmo 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" Current validation test can produce bug: timer.c:250:handle_tmo():Wrong tick: expected 18446744073709551615 actual 149 FAILED 1. timer.c:246 - CU_FAIL("Wrong status (stale) for fresh timeout") 2. timer.c:251 - CU_FAIL("odp_timeout_tick() wrong tick") Which caused with wrong destroy sequence: timer_free() calls timer_cancel(tp, idx, TMO_UNUSED). which is: ((uint64_t)0xFFFFFFFFFFFFFFFF) or 18446744073709551615 and test calls handle_tmo() for event with TMO_UNUSED. To fix reoder destroy sequence odp_timer_cancel()->sleep()->handle_tmo()-> ->odp_timer_free(). Signed-off-by: Maxim Uvarov Reviewed-by: Bill Fischofer --- test/validation/timer/timer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c index aad11aa..a396405 100644 --- a/test/validation/timer/timer.c +++ b/test/validation/timer/timer.c @@ -397,8 +397,6 @@ static void *worker_entrypoint(void *arg TEST_UNUSED) /* Cancel too late, timer already expired and * timeout enqueued */ nstale++; - if (odp_timer_free(tt[i].tim) != ODP_EVENT_INVALID) - CU_FAIL("odp_timer_free"); } LOG_DBG("Thread %u: %" PRIu32 " timers set\n", thr, nset); @@ -429,6 +427,12 @@ static void *worker_entrypoint(void *arg TEST_UNUSED) break; } } + + for (i = 0; i < allocated; i++) { + if (odp_timer_free(tt[i].tim) != ODP_EVENT_INVALID) + CU_FAIL("odp_timer_free"); + } + /* Check if there any more (unexpected) events */ odp_event_t ev = odp_queue_deq(queue); if (ev != ODP_EVENT_INVALID)