diff mbox

[3/3] linux-generic: schedule: make sure SCHED queues get freed by the scheduler

Message ID 1426517487-7124-4-git-send-email-ciprian.barbu@linaro.org
State New
Headers show

Commit Message

Ciprian Barbu March 16, 2015, 2:51 p.m. UTC
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 <ciprian.barbu@linaro.org>
---
 platform/linux-generic/odp_schedule.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

Maxim Uvarov March 16, 2015, 3:16 p.m. UTC | #1
On 03/16/15 17:51, Ciprian Barbu wrote:
> 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 <ciprian.barbu@linaro.org>
> ---
>   platform/linux-generic/odp_schedule.c | 25 +++++++++++++++++++++++++
>   1 file changed, 25 insertions(+)
>
> diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c
> index dd65168..8429bb9 100644
> --- a/platform/linux-generic/odp_schedule.c
> +++ b/platform/linux-generic/odp_schedule.c
> @@ -153,6 +153,31 @@ int odp_schedule_term_global(void)
>   
>   	for (i = 0; i < ODP_CONFIG_SCHED_PRIOS; i++) {
>   		for (j = 0; j < QUEUES_PER_PRIO; j++) {
> +#if 1

if 1?

> +			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;
> +				
> +				desc_buf = odp_buffer_from_event(ev);
> +				if (desc_buf == ODP_BUFFER_INVALID) {
> +					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);
> +				}
> +			}
> +#endif
> +
>   			if (odp_queue_destroy(sched->pri_queue[i][j])) {
>   				ODP_ERR("Sched term: Queue destroy fail.\n");
>   				rc = -1;
Bill Fischofer March 17, 2015, 1:43 a.m. UTC | #2
Code should not have #if 0 or #if 1 in them.  Leftover from debugging?

On Mon, Mar 16, 2015 at 10:16 AM, Maxim Uvarov <maxim.uvarov@linaro.org>
wrote:

> On 03/16/15 17:51, Ciprian Barbu wrote:
>
>> 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 <ciprian.barbu@linaro.org>
>> ---
>>   platform/linux-generic/odp_schedule.c | 25 +++++++++++++++++++++++++
>>   1 file changed, 25 insertions(+)
>>
>> diff --git a/platform/linux-generic/odp_schedule.c
>> b/platform/linux-generic/odp_schedule.c
>> index dd65168..8429bb9 100644
>> --- a/platform/linux-generic/odp_schedule.c
>> +++ b/platform/linux-generic/odp_schedule.c
>> @@ -153,6 +153,31 @@ int odp_schedule_term_global(void)
>>         for (i = 0; i < ODP_CONFIG_SCHED_PRIOS; i++) {
>>                 for (j = 0; j < QUEUES_PER_PRIO; j++) {
>> +#if 1
>>
>
> if 1?
>
>
>  +                       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;
>> +
>> +                               desc_buf = odp_buffer_from_event(ev);
>> +                               if (desc_buf == ODP_BUFFER_INVALID) {
>> +                                       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);
>> +                               }
>> +                       }
>> +#endif
>> +
>>                         if (odp_queue_destroy(sched->pri_queue[i][j])) {
>>                                 ODP_ERR("Sched term: Queue destroy
>> fail.\n");
>>                                 rc = -1;
>>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Ciprian Barbu March 17, 2015, 9:48 a.m. UTC | #3
On Tue, Mar 17, 2015 at 3:43 AM, Bill Fischofer
<bill.fischofer@linaro.org> wrote:
> Code should not have #if 0 or #if 1 in them.  Leftover from debugging?

Yup, sorry about that.

>
> On Mon, Mar 16, 2015 at 10:16 AM, Maxim Uvarov <maxim.uvarov@linaro.org>
> wrote:
>>
>> On 03/16/15 17:51, Ciprian Barbu wrote:
>>>
>>> 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 <ciprian.barbu@linaro.org>
>>> ---
>>>   platform/linux-generic/odp_schedule.c | 25 +++++++++++++++++++++++++
>>>   1 file changed, 25 insertions(+)
>>>
>>> diff --git a/platform/linux-generic/odp_schedule.c
>>> b/platform/linux-generic/odp_schedule.c
>>> index dd65168..8429bb9 100644
>>> --- a/platform/linux-generic/odp_schedule.c
>>> +++ b/platform/linux-generic/odp_schedule.c
>>> @@ -153,6 +153,31 @@ int odp_schedule_term_global(void)
>>>         for (i = 0; i < ODP_CONFIG_SCHED_PRIOS; i++) {
>>>                 for (j = 0; j < QUEUES_PER_PRIO; j++) {
>>> +#if 1
>>
>>
>> if 1?
>>
>>
>>> +                       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;
>>> +
>>> +                               desc_buf = odp_buffer_from_event(ev);
>>> +                               if (desc_buf == ODP_BUFFER_INVALID) {
>>> +                                       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);
>>> +                               }
>>> +                       }
>>> +#endif
>>> +
>>>                         if (odp_queue_destroy(sched->pri_queue[i][j])) {
>>>                                 ODP_ERR("Sched term: Queue destroy
>>> fail.\n");
>>>                                 rc = -1;
>>
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c
index dd65168..8429bb9 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -153,6 +153,31 @@  int odp_schedule_term_global(void)
 
 	for (i = 0; i < ODP_CONFIG_SCHED_PRIOS; i++) {
 		for (j = 0; j < QUEUES_PER_PRIO; j++) {
+#if 1
+			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;
+				
+				desc_buf = odp_buffer_from_event(ev);
+				if (desc_buf == ODP_BUFFER_INVALID) {
+					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);
+				}
+			}
+#endif
+
 			if (odp_queue_destroy(sched->pri_queue[i][j])) {
 				ODP_ERR("Sched term: Queue destroy fail.\n");
 				rc = -1;