From patchwork Fri Oct 31 12:25:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 39885 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 42EA8202FE for ; Fri, 31 Oct 2014 12:27:28 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id gq15sf4055152lab.10 for ; Fri, 31 Oct 2014 05:27:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=9bhOSTbQuMNCtAypgQzNmKzyFkfLZWZqTdWRAF5D8gk=; b=f3NeI+C0B6l/vNuc/Be2lHlkIedt7yyAWf2RcZyApiWMuVfQDd3qoYYonhBppFWF21 KhUJDvd7WgXKV27ph72qQX9jKYCKmdx+gRUmKg/cjZ5aPY9cuAvtVJ+TS3tl4+zH52Ru PXc+1ICBly3G0MKwNDdhAhzvPBGCk0mxEfjBM/Y+NO9x50y/wv1tHYfNAEkfF2yedjfE oD8Oz70PWGO184gkYtBYtpRhvDM+qrWFzM3IHQVTqwwfNV5Vt1aG/t+GgaNQEnJCtQ97 wgGI5Vv3ZXOxIdDvMHfEfVS53KPB2Q3czc5HWCR4+2bnQJqHZGAWhMnSTgsIKkoU0/0H jmwg== X-Gm-Message-State: ALoCoQniKQU6dp3ix8FzX4RfPvNUiTj+BQ6GZMssg1L3AdIdxZZmyHTvv/imV/zx2dfPHrwrOo5+ X-Received: by 10.181.13.195 with SMTP id fa3mr595108wid.0.1414758447059; Fri, 31 Oct 2014 05:27:27 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.26.228 with SMTP id o4ls163014lag.66.gmail; Fri, 31 Oct 2014 05:27:26 -0700 (PDT) X-Received: by 10.152.30.9 with SMTP id o9mr26056137lah.8.1414758446892; Fri, 31 Oct 2014 05:27:26 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id x6si16418380lbo.81.2014.10.31.05.27.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 05:27:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id 10so5865020lbg.22 for ; Fri, 31 Oct 2014 05:27:26 -0700 (PDT) X-Received: by 10.152.120.199 with SMTP id le7mr3392085lab.67.1414758446537; Fri, 31 Oct 2014 05:27:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp193072lbz; Fri, 31 Oct 2014 05:27:25 -0700 (PDT) X-Received: by 10.180.92.169 with SMTP id cn9mr3623444wib.26.1414758445776; Fri, 31 Oct 2014 05:27:25 -0700 (PDT) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id ek2si26314167wid.102.2014.10.31.05.27.24 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 31 Oct 2014 05:27:25 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XkBIC-0006Wr-5f; Fri, 31 Oct 2014 12:27:00 +0000 Received: from mail-qg0-f43.google.com ([209.85.192.43]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XkBI4-0006Wm-Uk for lng-odp@lists.linaro.org; Fri, 31 Oct 2014 12:26:52 +0000 Received: by mail-qg0-f43.google.com with SMTP id f51so5592376qge.30 for ; Fri, 31 Oct 2014 05:26:47 -0700 (PDT) X-Received: by 10.140.40.239 with SMTP id x102mr34235618qgx.69.1414758407752; Fri, 31 Oct 2014 05:26:47 -0700 (PDT) Received: from localhost.localdomain (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id j1sm9280464qao.38.2014.10.31.05.26.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 05:26:46 -0700 (PDT) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Fri, 31 Oct 2014 14:25:58 +0200 Message-Id: <1414758358-25265-1-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.1.1 X-Topics: patch Subject: [lng-odp] [PATCH] Scheduler atomic and ordered definitions X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: petri.savolainen@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Improved atomic and ordered synchronisation definitions. Added order skip function prototype. Signed-off-by: Petri Savolainen --- This is the ordered queue definition (in patch format) promised in the call yesterday. --- platform/linux-generic/include/api/odp_queue.h | 31 +++++++++++++++- platform/linux-generic/include/api/odp_schedule.h | 45 ++++++++++++++++++----- 2 files changed, 64 insertions(+), 12 deletions(-) diff --git a/platform/linux-generic/include/api/odp_queue.h b/platform/linux-generic/include/api/odp_queue.h index b8ac4bb..c0c3969 100644 --- a/platform/linux-generic/include/api/odp_queue.h +++ b/platform/linux-generic/include/api/odp_queue.h @@ -78,8 +78,35 @@ typedef int odp_schedule_prio_t; typedef int odp_schedule_sync_t; #define ODP_SCHED_SYNC_NONE 0 /**< Queue not synchronised */ -#define ODP_SCHED_SYNC_ATOMIC 1 /**< Atomic queue */ -#define ODP_SCHED_SYNC_ORDERED 2 /**< Ordered queue */ + +/** + * Atomic queue synchronisation + * + * The scheduler gives buffers from a queue to a single core at a time. This + * serialises processing of the buffers from the source queue and helps user to + * avoid SW locking. Another schedule call will implicitely release the atomic + * synchronisation of the source queue and free the scheduler to give buffers + * from the queue to other cores. + * + * User can hint the scheduler to release the atomic synchronisation early with + * odp_schedule_release_atomic(). + */ +#define ODP_SCHED_SYNC_ATOMIC 1 + +/** + * Ordered queue synchronisation + * + * The scheduler may give out buffers to multiple cores for parallel processing. + * The original enqueue order of the source queue is maintained when buffers are + * enqueued to their destination queue(s) before another schedule call. Buffers + * from the same ordered (source) queue appear in their original order when + * dequeued from a destination queue. The destination queue type (POLL/SCHED) or + * synchronisation (NONE/ATOMIC/ORDERED) is not limited. + * + * User can command the scheduler to skip ordering of a buffer with + * odp_schedule_skip_order(). + */ +#define ODP_SCHED_SYNC_ORDERED 2 /** Default queue synchronisation */ #define ODP_SCHED_SYNC_DEFAULT ODP_SCHED_SYNC_ATOMIC diff --git a/platform/linux-generic/include/api/odp_schedule.h b/platform/linux-generic/include/api/odp_schedule.h index 91fec10..2a1a642 100644 --- a/platform/linux-generic/include/api/odp_schedule.h +++ b/platform/linux-generic/include/api/odp_schedule.h @@ -52,8 +52,8 @@ uint64_t odp_schedule_wait_time(uint64_t ns); * for a buffer according to the wait parameter setting. Returns * ODP_BUFFER_INVALID if reaches end of the wait period. * - * @param from Output parameter for the source queue (where the buffer was - * dequeued from). Ignored if NULL. + * @param src The source queue (output). Indicates from which queue the + * buffer was dequeued. Ignored if NULL. * @param wait Minimum time to wait for a buffer. Waits infinitely, if set to * ODP_SCHED_WAIT. Does not wait, if set to ODP_SCHED_NO_WAIT. * Use odp_schedule_wait_time() to convert time to other wait @@ -61,7 +61,7 @@ uint64_t odp_schedule_wait_time(uint64_t ns); * * @return Next highest priority buffer, or ODP_BUFFER_INVALID */ -odp_buffer_t odp_schedule(odp_queue_t *from, uint64_t wait); +odp_buffer_t odp_schedule(odp_queue_t *src, uint64_t wait); /** * Schedule one buffer @@ -76,8 +76,8 @@ odp_buffer_t odp_schedule(odp_queue_t *from, uint64_t wait); * * User can exit the schedule loop without first calling odp_schedule_pause(). * - * @param from Output parameter for the source queue (where the buffer was - * dequeued from). Ignored if NULL. + * @param src The source queue (output). Indicates from which queue the + * buffer was dequeued. Ignored if NULL. * @param wait Minimum time to wait for a buffer. Waits infinitely, if set to * ODP_SCHED_WAIT. Does not wait, if set to ODP_SCHED_NO_WAIT. * Use odp_schedule_wait_time() to convert time to other wait @@ -85,7 +85,7 @@ odp_buffer_t odp_schedule(odp_queue_t *from, uint64_t wait); * * @return Next highest priority buffer, or ODP_BUFFER_INVALID */ -odp_buffer_t odp_schedule_one(odp_queue_t *from, uint64_t wait); +odp_buffer_t odp_schedule_one(odp_queue_t *src, uint64_t wait); /** @@ -93,8 +93,8 @@ odp_buffer_t odp_schedule_one(odp_queue_t *from, uint64_t wait); * * Like odp_schedule(), but returns multiple buffers from a queue. * - * @param from Output parameter for the source queue (where the buffer was - * dequeued from). Ignored if NULL. + * @param src The source queue (output). Indicates from which queue the + * buffer was dequeued. Ignored if NULL. * @param wait Minimum time to wait for a buffer. Waits infinitely, if set to * ODP_SCHED_WAIT. Does not wait, if set to ODP_SCHED_NO_WAIT. * Use odp_schedule_wait_time() to convert time to other wait @@ -104,7 +104,7 @@ odp_buffer_t odp_schedule_one(odp_queue_t *from, uint64_t wait); * * @return Number of buffers outputed (0 ... num) */ -int odp_schedule_multi(odp_queue_t *from, uint64_t wait, odp_buffer_t out_buf[], +int odp_schedule_multi(odp_queue_t *src, uint64_t wait, odp_buffer_t out_buf[], unsigned int num); /** @@ -129,11 +129,36 @@ void odp_schedule_pause(void); void odp_schedule_resume(void); /** - * Release currently hold atomic context + * Release the current atomic context + * + * This calls is valid only when the source queue has ATOMIC synchronisation. It + * hints the scheduler that the user has completed processing the critical + * section that needs atomic synchronisation. After the call, the scheduler is + * allowed to give next buffer from the same queue to another core. + * + * Usage of the call may increase parallelism and thus system performance, but + * carefulness is needed when splitting processing into critical vs. + * non-critical sections. */ void odp_schedule_release_atomic(void); /** + * Skip ordering of the buffer + * + * This calls is valid only when source queue has ORDERED synchronisation. It + * commands the scheduler to skip ordering of the buffer. Scheduler maintains + * ordering between two queues: source and destination. The dest parameter + * identifies the destination queue of that pair. After the call, ordering is + * not maintained for the buffer anymore but user still owns the buffer. User + * can e.g. store it, free it or enqueue it (to the same or another queue). + * + * @param dest Destination queue + * @param buf Buffer + */ +void odp_schedule_skip_order(odp_queue_t dest, odp_buffer_t buf); + + +/** * Number of scheduling priorities * * @return Number of scheduling priorities