From patchwork Tue Nov 10 14:47:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 56332 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp815324lbb; Tue, 10 Nov 2015 06:53:39 -0800 (PST) X-Received: by 10.55.72.70 with SMTP id v67mr4623794qka.83.1447167219591; Tue, 10 Nov 2015 06:53:39 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id g48si3203942qgd.16.2015.11.10.06.53.37; Tue, 10 Nov 2015 06:53:39 -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 BC65161D0F; Tue, 10 Nov 2015 14:53:37 +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 DB07861D20; Tue, 10 Nov 2015 14:49:46 +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 771C561D25; Tue, 10 Nov 2015 14:49:40 +0000 (UTC) Received: from mail-pa0-f44.google.com (mail-pa0-f44.google.com [209.85.220.44]) by lists.linaro.org (Postfix) with ESMTPS id B805261D24 for ; Tue, 10 Nov 2015 14:47:13 +0000 (UTC) Received: by pabfh17 with SMTP id fh17so236565666pab.0 for ; Tue, 10 Nov 2015 06:47:13 -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=V0jixYSWnXisYFIbTKTJHelG7wzYRjBu8vbVctWnKNhyepxR2Mg3nVrFnjPi2VnT83 cpFTwAUHtQn9m9InqG/TlGS5exbO1sRkjfwn8ZmfaRby5pZ3K1AWCZR8wuY9037qN8vu bAOaeuutPYJbWwzsaskDAyTHrZM2JZDjUCn/jslhEyt/k6eMXPishtZXBlj34t3p9DXC IqYOmXDBK53J2rGX4h/SjQS4iW3mki8kTjXnbINX9mbMhhc9DePtgdA3Dez/BRth4yzq dYVwaWOSJAO/BcZ7znPHWwNk1nGa/8CwwLtNF9VE1H9j7X3pjIooRDRmZamKe8WiMwUL HNIw== 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=Zmydx7lVb16+lsXXw0ppcIofChUYRRWbwPAO04hMHH9FtdPCGDE4P5ZvdfWbPUQ8P0 RuJ9ypJfQLepaGw2nawYoWB8cNtiPuTlmRaIa0iDkLYDhVusA1aMMn7gLpxQ+QxQm5at 4ZrTgj1/bOxBzai33n/bYRbz/PIJnCPcH0PrT+U99O+Z4QIuhRbxBEYuBmoLbxhJ8Zeh K/nO4o8bBga2pTJCR/GF6cV/1F4R1x2qM9LjVKdonz/PXhSasYOw0vGVzSuBA9BukkVY k+scLkZsSAmxVGdMG0wS4Hl9TGbLh/4avfKYTpTn+U22TuX1IFR1O9OSE5Z2NB7MJTXg txMg== X-Gm-Message-State: ALoCoQn4wm0a/89JBYM+tuUZK5IG/M2iGLzDjyIYkoYYYzC0Pbb3TlC/vRnB1aoQqcMi50oJy21J X-Received: by 10.68.161.194 with SMTP id xu2mr6304860pbb.86.1447166833074; Tue, 10 Nov 2015 06:47:13 -0800 (PST) Received: from Ubuntu15.localdomain ([40.139.248.3]) by smtp.gmail.com with ESMTPSA id w11sm4531237pbs.87.2015.11.10.06.47.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Nov 2015 06:47:12 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Tue, 10 Nov 2015 06:47:00 -0800 Message-Id: <1447166821-24585-8-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447166821-24585-1-git-send-email-bill.fischofer@linaro.org> References: <1447166821-24585-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv4 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); +}