From patchwork Tue Feb 16 14:02:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 62023 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1681796lbl; Tue, 16 Feb 2016 06:03:27 -0800 (PST) X-Received: by 10.107.136.210 with SMTP id s79mr23658775ioi.50.1455631407566; Tue, 16 Feb 2016 06:03:27 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id o2si35199056igr.49.2016.02.16.06.03.26; Tue, 16 Feb 2016 06:03:27 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id BB80A617D5; Tue, 16 Feb 2016 14:03:26 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=kETxGLSN; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, 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 34D436172C; Tue, 16 Feb 2016 14:03:21 +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 23CB36171F; Tue, 16 Feb 2016 14:03:13 +0000 (UTC) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com [209.85.215.50]) by lists.linaro.org (Postfix) with ESMTPS id 89CD96171F for ; Tue, 16 Feb 2016 14:02:45 +0000 (UTC) Received: by mail-lf0-f50.google.com with SMTP id j78so109192088lfb.1 for ; Tue, 16 Feb 2016 06:02:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=M7fFpv16ZOWoqoTVFtiwVlIxq3yQ8iKRnHF9b7Xd4w4=; b=kETxGLSN7EKdQ0A6m6coSAx/s5qgE01kV/WiMvOicF2OG0eLB4FcaV/JLtwML59dcC b/GrO4KhoVpEkKk1npnugOKppAN+vcyBelxd/cUQeGQGT5ZQV9zbXsCTjAeciIE59pdG GgkfdI7pdcTit3cXWAJe2u++2rQxUVpRhTJV8= 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=M7fFpv16ZOWoqoTVFtiwVlIxq3yQ8iKRnHF9b7Xd4w4=; b=c5yOtYChvi+8n08XJ/TzJaYTf69Z5IhlLdEeZLV2ZXSYDw3mECT2jLbaqTNo2OwjBL vNM+DOavc2Z+ATpWb6sslLIWzNNnF1YUb3cbSf2PwHFbsBlflWvJFT1eOKFzqSNOsnWi CISK67yiS9vwoedrLKixrMApMhVfOkXbNPN6/8BRKD0u7QTR/Gv4ShfK0JIGa4fiJcNb vH0820oznZracYqbpamYRfqrR9FPQbc6UuwpN6ohWPRVA2ESZIvnQCIK8yT2M0PsxUW4 31AVcFAPhvH0ZEZ18c5JVAuG6Uck4Vt0yKFcgPrJY8Dsc68qWFn2HdTuOzqtX2SSoPbd 054A== X-Gm-Message-State: AG10YOQHWLQLVjK4XJsgBNJEnIJQZeDSXLFRlrbwa0TnaieP++WJT8K4mGhlTrOPXb/tw3J2U/g= X-Received: by 10.25.40.139 with SMTP id o133mr8140844lfo.10.1455631364010; Tue, 16 Feb 2016 06:02:44 -0800 (PST) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id mp1sm4353934lbb.22.2016.02.16.06.02.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Feb 2016 06:02:43 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Tue, 16 Feb 2016 16:02:38 +0200 Message-Id: <1455631358-5934-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [PATCH] validation: scheduler: correct pause/resume sequence 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" When test for single thread is finished the following test for many threads can be started, and for some implementations can happen that future one event can arrive to main thread, as it was requested in previous test. As result one event can be lost for rest threads. So, it's better to pause scheduling for main thread when it doesn't participate in the multi-threaded test. Also move pause/resume test closer to beginning, because it's used in tests before. Signed-off-by: Ivan Khoronzhuk --- test/validation/scheduler/scheduler.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/validation/scheduler/scheduler.c b/test/validation/scheduler/scheduler.c index dcf01c0..c1b61c5 100644 --- a/test/validation/scheduler/scheduler.c +++ b/test/validation/scheduler/scheduler.c @@ -1000,6 +1000,8 @@ static void schedule_common(odp_schedule_sync_t sync, int num_queues, args.enable_schd_multi = enable_schd_multi; args.enable_excl_atomic = 0; /* Not needed with a single CPU */ + /* resume scheduling in case it was paused */ + odp_schedule_resume(); fill_queues(&args); schedule_common_(&args); @@ -1037,6 +1039,9 @@ static void parallel_execute(odp_schedule_sync_t sync, int num_queues, args->enable_schd_multi = enable_schd_multi; args->enable_excl_atomic = enable_excl_atomic; + /* disable receive events for main thread */ + exit_schedule_loop(); + fill_queues(args); /* Create and launch worker threads */ @@ -1249,6 +1254,9 @@ void scheduler_test_pause_resume(void) int i; int local_bufs = 0; + /* resume scheduling in case it was paused */ + odp_schedule_resume(); + queue = odp_queue_lookup("sched_0_0_n"); CU_ASSERT(queue != ODP_QUEUE_INVALID); @@ -1296,6 +1304,8 @@ void scheduler_test_pause_resume(void) } CU_ASSERT(exit_schedule_loop() == 0); + + odp_schedule_resume(); } static int create_queues(void) @@ -1556,6 +1566,7 @@ odp_testinfo_t scheduler_suite[] = { ODP_TEST_INFO(scheduler_test_num_prio), ODP_TEST_INFO(scheduler_test_queue_destroy), ODP_TEST_INFO(scheduler_test_groups), + ODP_TEST_INFO(scheduler_test_pause_resume), ODP_TEST_INFO(scheduler_test_parallel), ODP_TEST_INFO(scheduler_test_atomic), ODP_TEST_INFO(scheduler_test_ordered), @@ -1586,7 +1597,6 @@ odp_testinfo_t scheduler_suite[] = { ODP_TEST_INFO(scheduler_test_multi_mq_mt_prio_a), ODP_TEST_INFO(scheduler_test_multi_mq_mt_prio_o), ODP_TEST_INFO(scheduler_test_multi_1q_mt_a_excl), - ODP_TEST_INFO(scheduler_test_pause_resume), ODP_TEST_INFO_NULL, };