From patchwork Tue Nov 10 04:20:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 56282 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp550975lbb; Mon, 9 Nov 2015 20:25:57 -0800 (PST) X-Received: by 10.107.10.199 with SMTP id 68mr1807405iok.75.1447129557673; Mon, 09 Nov 2015 20:25:57 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id h10si2306570ioe.141.2015.11.09.20.25.57; Mon, 09 Nov 2015 20:25:57 -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 0648B61CE9; Tue, 10 Nov 2015 04:25:57 +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=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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 79C7861D13; Tue, 10 Nov 2015 04:21:36 +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 2A42861D0E; Tue, 10 Nov 2015 04:21:30 +0000 (UTC) Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by lists.linaro.org (Postfix) with ESMTPS id D549961CE8 for ; Tue, 10 Nov 2015 04:20:30 +0000 (UTC) Received: by padhx2 with SMTP id hx2so212872915pad.1 for ; Mon, 09 Nov 2015 20:20:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5dyb/RbGPu9aoPnTwV9Hfp4YlvKsVb21NjZEmYsTxIM=; b=YEQuyAKfLsNl9i1Snb5wsLimMF9VC868EjL+1w2Ny27TmZnXvrhi6ne4hUm+MmYaro Gvu/V29VUPVI0sIH7lOTXwgf4+qTXsbztk0EK81qqAUa3xH3I452vSd1ZhqhfLINQGTz /FLzKxCbdOBZC0P06gD+Cawxo8YWmAZQOvIx53C5aCp/XnS+sKId5cnUKvAibJTgHYtS yuZXxxLzGBxl3ouBqfbRtyVw2PzvSP67UL3QiSkHM0sHhF1/Wl8jVvZADdwOSVwlmu6u sOc1iNoTp8XUWBQJCgNE8uQwFUhL+As6PAjbJxUYoKacCOT/FFpU7p9x9QU7yqQ4ov5h kqXg== 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:in-reply-to :references; bh=5dyb/RbGPu9aoPnTwV9Hfp4YlvKsVb21NjZEmYsTxIM=; b=N+o7uPlEBlxfW+nQmjPrkJiyaIx2Y2mXM+dMh1WlKILE1yq5coJ+WJwFOTnKoWHMc2 HQR/UCy7G1hnxZRsRFj/twowuIqliTHDkDGHI8uoitu4whIaEWVnCxuzwvbDcaiaZT9k hHQsvHAWNy25hSSruzsgXIFR1JN98xQsk+y21sINquA5SFDkHm2Ty3rbsDGjUOevqjpz AlDQVy5CyEloYWHsO7lnhcKvYNJt/pM7Qd/NA2EV4GrfQEYJ0s6apgfc20yfRE8JN0zB BGUDMms4aHqSz+HcPOKQn1n3TzkrHxzSgy4KO7vnu7KX9P++ZJnfB5zzs70xJB57/hbG 2CDg== X-Gm-Message-State: ALoCoQm3oF38MTZ1iHyViV2rWzXH/p0U7IMNuS8VPcgy1eSjrsKu/0YacFl8RIDKhtouZckC+jTS X-Received: by 10.68.216.36 with SMTP id on4mr2528647pbc.12.1447129230162; Mon, 09 Nov 2015 20:20:30 -0800 (PST) Received: from Ubuntu15.localdomain ([40.139.248.3]) by smtp.gmail.com with ESMTPSA id fl5sm1137315pbd.70.2015.11.09.20.20.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Nov 2015 20:20:29 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Mon, 9 Nov 2015 20:20:10 -0800 Message-Id: <1447129211-9095-8-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447129211-9095-1-git-send-email-bill.fischofer@linaro.org> References: <1447129211-9095-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv3 7/8] linux-generic: schedule: allow order to be ignored for internal use 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 a schedulable queue transitions from QUEUE_STATUS_NOTSCHED to QUEUE_STATUS_SCHED, the scheduler makes it ready by adding it to one of the scheduler's internal queues. This enqueue operation should not participate in any current ordered context to avoid potential deadlock. This patch resolves Bug https://bugs.linaro.org/show_bug.cgi?id=1879 Signed-off-by: Bill Fischofer --- platform/linux-generic/include/odp_schedule_internal.h | 8 +------- platform/linux-generic/odp_schedule.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/platform/linux-generic/include/odp_schedule_internal.h b/platform/linux-generic/include/odp_schedule_internal.h index 6f9cbdc..6b301cd 100644 --- a/platform/linux-generic/include/odp_schedule_internal.h +++ b/platform/linux-generic/include/odp_schedule_internal.h @@ -20,15 +20,9 @@ extern "C" { #include #include - int schedule_queue_init(queue_entry_t *qe); void schedule_queue_destroy(queue_entry_t *qe); - -static inline int schedule_queue(const queue_entry_t *qe) -{ - return odp_queue_enq(qe->s.pri_queue, qe->s.cmd_ev); -} - +int schedule_queue(const queue_entry_t *qe); int schedule_pktio_start(odp_pktio_t pktio, int prio); void odp_schedule_release_context(void); diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 195240e..5982f85 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -93,7 +93,7 @@ typedef struct { int num; int index; int pause; - + int ignore_ordered_context; } sched_local_t; /* Global scheduler context */ @@ -839,8 +839,13 @@ void sched_enq_called(void) void get_sched_order(queue_entry_t **origin_qe, uint64_t *order) { - *origin_qe = sched_local.origin_qe; - *order = sched_local.order; + if (sched_local.ignore_ordered_context) { + sched_local.ignore_ordered_context = 0; + *origin_qe = NULL; + } else { + *origin_qe = sched_local.origin_qe; + *order = sched_local.order; + } } void sched_order_resolved(odp_buffer_hdr_t *buf_hdr) @@ -849,3 +854,9 @@ void sched_order_resolved(odp_buffer_hdr_t *buf_hdr) buf_hdr->origin_qe = NULL; sched_local.origin_qe = NULL; } + +int schedule_queue(const queue_entry_t *qe) +{ + sched_local.ignore_ordered_context = 1; + return odp_queue_enq(qe->s.pri_queue, qe->s.cmd_ev); +}