diff mbox

[API-NEXT,PATCHv3,7/8] linux-generic: schedule: allow order to be ignored for internal use

Message ID 1447129211-9095-8-git-send-email-bill.fischofer@linaro.org
State Superseded
Headers show

Commit Message

Bill Fischofer Nov. 10, 2015, 4:20 a.m. UTC
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 <bill.fischofer@linaro.org>
---
 platform/linux-generic/include/odp_schedule_internal.h |  8 +-------
 platform/linux-generic/odp_schedule.c                  | 17 ++++++++++++++---
 2 files changed, 15 insertions(+), 10 deletions(-)
diff mbox

Patch

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 <odp/packet_io.h>
 #include <odp_queue_internal.h>
 
-
 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);
+}