From patchwork Wed Nov 18 15:47:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 56943 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp2635222lbb; Wed, 18 Nov 2015 07:47:30 -0800 (PST) X-Received: by 10.140.142.147 with SMTP id 141mr2291307qho.24.1447861650108; Wed, 18 Nov 2015 07:47:30 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id d90si2776699qge.52.2015.11.18.07.47.29; Wed, 18 Nov 2015 07:47:30 -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.20150623.gappssmtp.com Received: by lists.linaro.org (Postfix, from userid 109) id 9CD3661D95; Wed, 18 Nov 2015 15:47:29 +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.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 35E4861D64; Wed, 18 Nov 2015 15:47:26 +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 B5D6561D74; Wed, 18 Nov 2015 15:47:23 +0000 (UTC) Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by lists.linaro.org (Postfix) with ESMTPS id 861AD61D63 for ; Wed, 18 Nov 2015 15:47:22 +0000 (UTC) Received: by wmvv187 with SMTP id v187so284909899wmv.1 for ; Wed, 18 Nov 2015 07:47:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=ZCVqwcC/31K4uKWkl/zBABeZtSjv2gKpTi5Mpfcv5pw=; b=LSdVJkGkBjaQTrjztwIXPPxEiQZKrWsYjjF2ESX/JJRoKAZ40f+EVEUTeRpJ4ZGSa1 3wP6HBEZ242dLnOR8Q93FDl81KFQRHNElYdId7xpgKbK0f3r/8+s6G8Xq65QClz1Fbvi 4SU5Js9fruOq6wziSHQWpVjQRWFV9LfwhpFwBTy7DgqXVoz6GSDrdueYtwQkD89xmeHx XHEfgEDDZ0LOWmDUpdQ8ethyG023ax86CBIRMkmeoDP0NiRY/geyy6ygUyuAfdy6pbVr Hkp0LFZD2YYSGFEECzIJtwX7nR4jBRYkJNhibrxoySqn1r6+uWUAqTWfc3O010MqVzYw H6Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=ZCVqwcC/31K4uKWkl/zBABeZtSjv2gKpTi5Mpfcv5pw=; b=daMRGm7wPw377HC8gLay4qi5k3e9VEO2k3to9kD6mu7Z+/+0MSS3DI74iHcxKUKnaN BrfNq/FMAMm6LVorh4TTcc67wbe9nMCb0OBjXpuJcv2Pq+qVtYbQFBoimBUS7rfvg3hL HC6c87XSUTJd1UvXB/RCWcwUnFNL6nWc/qE4kL4BBHW5tTNWgxUg0psCT2PcWIBzUwHm cB4G/ZRHkZHi+ooJ1RIw63kPEiMxR1BFCXt2VTG7GNIF3eIt8M8XIt3h5BOVQAk7z8QA McqobuErP0C0Lss4LnLCAB62g+q1bvLaFCWq+a590GJGAmy9aEGUEXc1r2yWZj0WqlDz rk8Q== X-Gm-Message-State: ALoCoQlKzh9Phi64FLEw9xuv6wt0kErwngyrKdqfNG/0n4hVIxxde0eJskLdoDEJxw4L4rXqQ80m X-Received: by 10.194.110.35 with SMTP id hx3mr3227099wjb.0.1447861641643; Wed, 18 Nov 2015 07:47:21 -0800 (PST) Received: from e106441.emea.arm.com ([2001:41d0:a:3cb4::abcd]) by smtp.gmail.com with ESMTPSA id m135sm34959782wmb.0.2015.11.18.07.47.20 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Nov 2015 07:47:21 -0800 (PST) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Wed, 18 Nov 2015 15:47:05 +0000 Message-Id: <1447861625-30217-1-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 X-Topics: patch Subject: [lng-odp] [PATCH] validation: scheduler: add missing ticketlock unlock 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" The scheduler validation test occasionally deadlocks due to a missing ticketlock unlock. Signed-off-by: Stuart Haslam Reviewed-by: Bill Fischofer --- test/validation/scheduler/scheduler.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/validation/scheduler/scheduler.c b/test/validation/scheduler/scheduler.c index f8effb3..2bd180c 100644 --- a/test/validation/scheduler/scheduler.c +++ b/test/validation/scheduler/scheduler.c @@ -593,6 +593,7 @@ static void *schedule_common_(void *arg) queue_context *qctx; buf_contents *bctx, *bctx_cpy; odp_pool_t pool; + int locked; globals = args->globals; sync = args->sync; @@ -608,7 +609,6 @@ static void *schedule_common_(void *arg) odp_buffer_t buf, buf_cpy; odp_queue_t from = ODP_QUEUE_INVALID; int num = 0; - int locked; odp_ticketlock_lock(&globals->lock); if (globals->buf_count == 0) { @@ -747,9 +747,12 @@ static void *schedule_common_(void *arg) if (args->num_workers > 1) odp_barrier_wait(&globals->barrier); - if (sync == ODP_SCHED_SYNC_ORDERED && - odp_ticketlock_trylock(&globals->lock) && - globals->buf_count_cpy > 0) { + if (sync == ODP_SCHED_SYNC_ORDERED) + locked = odp_ticketlock_trylock(&globals->lock); + else + locked = 0; + + if (locked && globals->buf_count_cpy > 0) { odp_event_t ev; odp_queue_t pq; uint64_t seq; @@ -787,9 +790,11 @@ static void *schedule_common_(void *arg) } CU_ASSERT(bcount == buf_count); globals->buf_count_cpy = 0; - odp_ticketlock_unlock(&globals->lock); } + if (locked) + odp_ticketlock_unlock(&globals->lock); + return NULL; }