From patchwork Wed Mar 18 11:36:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 45940 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 96F472153C for ; Wed, 18 Mar 2015 11:37:19 +0000 (UTC) Received: by lamq1 with SMTP id q1sf6812109lam.3 for ; Wed, 18 Mar 2015 04:37:18 -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=C3qZe/68Vwua8eOnE83TRPO4ZFG1p+dIav9pAmr943CAqRGxz4VBuzCb8bNcI9tBwW Ry9Sus08kVzsqVa6anMl2ME8XdzT3gprC9NBt+R1NT6NZbCg/W2Bo1O6oVn5UUe51rgG KszoyrZ5NhyDGsitcl0HRaW/fggrKxk1pfP0P9PUnoFo83lK1t9F2ci1MKerNYB4rcJX HRyo5v9jA4wcQdeaAbi0tpIHS2YHQPDxmUPm4yik7m1r25/6JlrdlXVsBhHs5/TutK5R zujVE+lSwhWE3Jg3xYDtDeOPy4ATu5Al2wwdGhf8iphJHPhObAZksySN2WASYIqXJcHf UI9w== X-Gm-Message-State: ALoCoQlj9wcM6Gxm/3ygu1zoHuD4yq6HtZRnpMejG60rqU59nYve++qllreDCcOCxrRpyrSShVwO X-Received: by 10.194.221.65 with SMTP id qc1mr10994654wjc.7.1426678638660; Wed, 18 Mar 2015 04:37:18 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.225.132 with SMTP id rk4ls153498lac.50.gmail; Wed, 18 Mar 2015 04:37:18 -0700 (PDT) X-Received: by 10.152.88.1 with SMTP id bc1mr35768409lab.20.1426678638215; Wed, 18 Mar 2015 04:37:18 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id g7si12702054lbd.52.2015.03.18.04.37.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 04:37:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lagg8 with SMTP id g8so33409856lag.1 for ; Wed, 18 Mar 2015 04:37:18 -0700 (PDT) X-Received: by 10.152.22.67 with SMTP id b3mr62790538laf.117.1426678638120; Wed, 18 Mar 2015 04:37:18 -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 h5csp1095206lbj; Wed, 18 Mar 2015 04:37:17 -0700 (PDT) X-Received: by 10.140.42.13 with SMTP id b13mr87681745qga.43.1426678636745; Wed, 18 Mar 2015 04:37:16 -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 d35si16297334qgf.4.2015.03.18.04.37.15 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 18 Mar 2015 04:37:16 -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 1YYCHg-0001ly-Pb; Wed, 18 Mar 2015 11:37:12 +0000 Received: from mail-lb0-f181.google.com ([209.85.217.181]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YYCHR-0001kr-BU for lng-odp@lists.linaro.org; Wed, 18 Mar 2015 11:36:57 +0000 Received: by lbblx11 with SMTP id lx11so5107068lbb.3 for ; Wed, 18 Mar 2015 04:36:51 -0700 (PDT) X-Received: by 10.152.44.161 with SMTP id f1mr47348106lam.26.1426678611545; Wed, 18 Mar 2015 04:36:51 -0700 (PDT) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id pd1sm2551936lbc.9.2015.03.18.04.36.50 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Mar 2015 04:36:50 -0700 (PDT) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Wed, 18 Mar 2015 13:36:34 +0200 Message-Id: <1426678594-29398-4-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1426678594-29398-1-git-send-email-ciprian.barbu@linaro.org> References: <1426678594-29398-1-git-send-email-ciprian.barbu@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv4 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.215.54 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; }