> -----Original Message-----
> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of Brian
> Brooks
> Sent: Monday, April 24, 2017 11:59 PM
> To: lng-odp@lists.linaro.org
> Cc: Ola Liljedahl <ola.liljed...@arm.com>
> Subject: [lng-odp] [PATCH] test: odp_sched_latency: robust draining of
> queues
> 
> From: Ola Liljedahl <ola.liljed...@arm.com>
> 
> In order to robustly drain all queues when the benchmark has
> ended, we enqueue a special event on every queue and invoke
> the scheduler until all such events have been received.
> 

        odp_schedule_pause();

        while (1) {
                ev = odp_schedule(&src_queue, ODP_SCHED_NO_WAIT);

                if (ev == ODP_EVENT_INVALID)
                        break;

                if (odp_queue_enq(src_queue, ev)) {
                        LOG_ERR("[%i] Queue enqueue failed.\n", thr);
                        odp_event_free(ev);
                        return -1;
                }
        }

        odp_schedule_resume();

        odp_barrier_wait(&globals->barrier);

        clear_sched_queues();


What is the issue that this patch fixes? This sequence should be quite robust 
already since no new enqueues happen after the barrier. In a simple test code 
like this, the latency from last enq() (through the barrier) to schedule loop 
(in clear_sched_queues()) could be overcome just by not exiting after the first 
EVENT_INVALID from scheduler, but after N EVENT_INVALIDs in a row.

Also in your patch, thread should exit only after scheduler returns 
EVENT_INVALID.


-Petri

Reply via email to