From patchwork Wed Mar 18 10:16:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 45925 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D88AB2153C for ; Wed, 18 Mar 2015 10:17:26 +0000 (UTC) Received: by wesk11 with SMTP id k11sf1698769wes.3 for ; Wed, 18 Mar 2015 03:17:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=s7b8K0b7L/gM9emWZddC/4YZv6j0s8P+ZJ+nNKpPdIc=; b=DekIcFDNLs5/uSFlzeOSF03E+XxXEYS8HEvrTeEt+UWckrZGNX+dZkHsf60/w2TH03 sQm+sy8IHj/VFagbKh86R54uRRrcNO2UWTtEtImjIPSfJex6pZKIc8LIILDr7AesH5GN imKC09WAU4vS/aD2UqOEykDq4rilTTnCq5+olWIwUMBoWnG3kXpFy0bpvjWAqo/tCBng CB9FmVD9e4G8fe9vfkTXwg4Sr4gM3n+HXzS8zXJY8V2gNFwGd4fdYipIVBe5Z8XnX9ZT NRTau8k10MP3BRaKcJkhigwCnPxRsv3h+lw0dYx4C1VhmgcvObPpnuXP6RmQUfJK0Eut KQEQ== X-Gm-Message-State: ALoCoQlgUZ+ZzlU8ADxQY4dWEwq236WnKzfjEqZNuZz8PXtqppWQZo1wHL3t6/vVrs3KDP5sv3Fn X-Received: by 10.112.181.166 with SMTP id dx6mr8480737lbc.17.1426673846183; Wed, 18 Mar 2015 03:17:26 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.225 with SMTP id n1ls143545lah.52.gmail; Wed, 18 Mar 2015 03:17:25 -0700 (PDT) X-Received: by 10.152.3.42 with SMTP id 10mr63299902laz.84.1426673845752; Wed, 18 Mar 2015 03:17:25 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id r6si12556999laj.72.2015.03.18.03.17.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 03:17:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbblx11 with SMTP id lx11so3790173lbb.3 for ; Wed, 18 Mar 2015 03:17:25 -0700 (PDT) X-Received: by 10.112.130.39 with SMTP id ob7mr65596544lbb.32.1426673845650; Wed, 18 Mar 2015 03:17:25 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp1055935lbj; Wed, 18 Mar 2015 03:17:24 -0700 (PDT) X-Received: by 10.55.21.66 with SMTP id f63mr111049930qkh.102.1426673842754; Wed, 18 Mar 2015 03:17:22 -0700 (PDT) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id 195si16096302qhw.115.2015.03.18.03.17.21 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 18 Mar 2015 03:17:22 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YYB2N-00061H-54; Wed, 18 Mar 2015 10:17:19 +0000 Received: from mail-la0-f42.google.com ([209.85.215.42]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YYB28-000609-35 for lng-odp@lists.linaro.org; Wed, 18 Mar 2015 10:17:04 +0000 Received: by ladw1 with SMTP id w1so31811247lad.0 for ; Wed, 18 Mar 2015 03:16:58 -0700 (PDT) X-Received: by 10.112.9.236 with SMTP id d12mr1669953lbb.102.1426673818404; Wed, 18 Mar 2015 03:16:58 -0700 (PDT) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id bm5sm1681413lbb.25.2015.03.18.03.16.57 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Mar 2015 03:16:57 -0700 (PDT) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Wed, 18 Mar 2015 12:16:39 +0200 Message-Id: <1426673799-28116-4-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1426673799-28116-1-git-send-email-ciprian.barbu@linaro.org> References: <1426673799-28116-1-git-send-email-ciprian.barbu@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv3 3/3] linux-generic: schedule: make sure SCHED queues get freed by the scheduler X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ciprian.barbu@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 ODP_QUEUE_TYPE_SCHED queues only get marked as destroyed, they need to be removed from the pri_queues of the linux-generic scheduler Signed-off-by: Ciprian Barbu --- v3: - check ev is valid - use already set pri_q like Maxim suggested v2: - removed #if 1 and trailing whitespaces platform/linux-generic/odp_schedule.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index dd65168..ea60639 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -153,7 +153,35 @@ int odp_schedule_term_global(void) for (i = 0; i < ODP_CONFIG_SCHED_PRIOS; i++) { for (j = 0; j < QUEUES_PER_PRIO; j++) { - if (odp_queue_destroy(sched->pri_queue[i][j])) { + odp_queue_t pri_q = sched->pri_queue[i][j]; + + for (;;) { + odp_event_t ev = odp_queue_deq(pri_q); + odp_buffer_t desc_buf; + queue_desc_t *desc; + odp_queue_t queue; + + if (ev == ODP_EVENT_INVALID) + break; + + desc_buf = odp_buffer_from_event(ev); + if (desc_buf == ODP_BUFFER_INVALID) { + ODP_ERR("Sched term: Invalid event.\n"); + rc = -1; + break; + } + + desc = odp_buffer_addr(desc_buf); + queue = desc->queue; + /* Let deq_multi_destroy do the job */ + if (queue_is_destroyed(queue)) { + odp_queue_deq_multi(queue, + sched_local.ev, + MAX_DEQ); + } + } + + if (odp_queue_destroy(pri_q)) { ODP_ERR("Sched term: Queue destroy fail.\n"); rc = -1; }