diff mbox

[API-NEXT,1/8] api: scheduler: scheduler group additional APIs

Message ID 1440389196-28814-2-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer Aug. 24, 2015, 4:06 a.m. UTC
Add the following scheduler group APIs:
odp_schedule_group_lookup()
odp_schedule_group_join()
odp_schedule_group_leave()
odp_schedule_group_thrmask()

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 include/odp/api/schedule.h | 66 ++++++++++++++++++++++++++++++----------------
 1 file changed, 43 insertions(+), 23 deletions(-)

Comments

Bill Fischofer Aug. 24, 2015, 11:45 a.m. UTC | #1
I'll address that in v2.  I wanted to get the initial version pushed out
last night so you could review the API changes based on our discussions on
Friday.  Packaging aside, is the general shape of the APIs OK now?

On Mon, Aug 24, 2015 at 3:25 AM, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolainen@nokia.com> wrote:

> This patch does two things: modifies/add group APIs and removes olock.
> Group API changes are OK. Please, send another patch which does not touch
> the olock API at all.
>
> -Petri
>
> > -----Original Message-----
> > From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of
> > ext Bill Fischofer
> > Sent: Monday, August 24, 2015 7:06 AM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [API-NEXT PATCH 1/8] api: scheduler: scheduler group
> > additional APIs
> >
> > Add the following scheduler group APIs:
> > odp_schedule_group_lookup()
> > odp_schedule_group_join()
> > odp_schedule_group_leave()
> > odp_schedule_group_thrmask()
> >
> > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
> > ---
> >  include/odp/api/schedule.h | 66 ++++++++++++++++++++++++++++++--------
> > --------
> >  1 file changed, 43 insertions(+), 23 deletions(-)
> >
> > diff --git a/include/odp/api/schedule.h b/include/odp/api/schedule.h
> > index 36e52cd..5837f69 100644
> > --- a/include/odp/api/schedule.h
> > +++ b/include/odp/api/schedule.h
> > @@ -187,12 +187,12 @@ int odp_schedule_num_prio(void);
> >  /**
> >   * Schedule group create
> >   *
> > - * Creates a schedule group with the thread mask. Only threads in the
> > + * Create a schedule group with the specified thread mask. Only
> > threads in the
> >   * mask will receive events from a queue that belongs to the schedule
> > group.
> >   * Thread masks of various schedule groups may overlap. There are
> > predefined
> >   * groups such as ODP_SCHED_GROUP_ALL and ODP_SCHED_GROUP_WORKER,
> > which are
> > - * always present and automatically updated. Group name is optional
> > - * (may be NULL) and can have ODP_SCHED_GROUP_NAME_LEN characters in
> > maximum.
> > + * always present and automatically updated. Group name is optional
> > (may be
> > + * NULL) and can contain a maximum of ODP_SCHED_GROUP_NAME_LEN
> > characters.
> >   *
> >   * @param name    Schedule group name
> >   * @param mask    Thread mask
> > @@ -208,7 +208,7 @@ odp_schedule_group_t
> > odp_schedule_group_create(const char *name,
> >  /**
> >   * Schedule group destroy
> >   *
> > - * Destroys a schedule group. All queues belonging to the schedule
> > group must
> > + * Destroy a schedule group. All queues belonging to the schedule
> > group must
> >   * be destroyed before destroying the group. Other operations on this
> > group
> >   * must not be invoked in parallel.
> >   *
> > @@ -220,41 +220,61 @@ odp_schedule_group_t
> > odp_schedule_group_create(const char *name,
> >  int odp_schedule_group_destroy(odp_schedule_group_t group);
> >
> >  /**
> > - * Initialize ordered context lock
> > + * Look up a schedule group by name
> >   *
> > - * Initialize an ordered queue context lock. The lock can be
> > associated only
> > - * with ordered queues and used only within an ordered synchronization
> > context.
> > + * Return the handle of a schedule group from its name
> >   *
> > - * @param queue   Ordered queue
> > - * @param lock    Ordered context lock
> > + * @param name   Name of schedule group
> > + *
> > + * @return Handle of schedule group for specified name
> > + * @retval ODP_SCHEDULE_GROUP_INVALID No matching schedule group found
> > + */
> > +odp_schedule_group_t odp_schedule_group_lookup(const char *name);
> > +
> > +/**
> > + * Join a schedule group
> > + *
> > + * Join a threadmask to an existing schedule group
> > + *
> > + * @param group  Schdule group handle
> > + * @param mask   Thread mask
> >   *
> >   * @retval 0 on success
> >   * @retval <0 on failure
> >   */
> > -int odp_schedule_olock_init(odp_queue_t queue, odp_schedule_olock_t
> > *lock);
> > +int odp_schedule_group_join(odp_schedule_group_t group,
> > +                         const odp_thrmask_t *mask);
> >
> >  /**
> > - * Acquire ordered context lock
> > + * Leave a schedule group
> > + *
> > + * Remove a threadmask from an existing schedule group
> > + *
> > + * @param group  Schedule group handle
> > + * @param mask   Thread mask
> >   *
> > - * This call is valid only when holding an ordered synchronization
> > context. The
> > - * lock is used to protect a critical section that is executed within
> > an
> > - * ordered context. Threads enter the critical section in the order
> > determined
> > - * by the context (source queue). Lock ordering is automatically
> > skipped for
> > - * threads that release the context instead of calling the lock.
> > + * @retval 0 on success
> > + * @retval <0 on failure
> >   *
> > - * @param lock    Ordered context lock
> > + * @note Leaving a schedule group means threads in the specified mask
> > will no
> > + * longer receive events from queues belonging to the specified
> > schedule
> > + * group. This effect is not instantaneous, however, and events that
> > have been
> > + * prestaged may still be presented to the masked threads.
> >   */
> > -void odp_schedule_olock_lock(odp_schedule_olock_t *lock);
> > +int odp_schedule_group_leave(odp_schedule_group_t group,
> > +                          const odp_thrmask_t *mask);
> >
> >  /**
> > - * Release ordered context lock
> > + * Get a schedule group's thrmask
> >   *
> > - * This call is valid only when holding an ordered synchronization
> > context.
> > - * Release a previously locked ordered context lock.
> > + * @param      group   Schedule group handle
> > + * @param[out] thrmask The current thrmask used for this schedule
> > group
> >   *
> > - * @param lock    Ordered context lock
> > + * @retval 0  On success
> > + * @retval <0 Invalid group specified
> >   */
> > -void odp_schedule_olock_unlock(odp_schedule_olock_t *lock);
> > +int odp_schedule_group_thrmask(odp_schedule_group_t group,
> > +                            odp_thrmask_t *thrmask);
> >
> >  /**
> >   * @}
> > --
> > 2.1.4
> >
> > _______________________________________________
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > https://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/include/odp/api/schedule.h b/include/odp/api/schedule.h
index 36e52cd..5837f69 100644
--- a/include/odp/api/schedule.h
+++ b/include/odp/api/schedule.h
@@ -187,12 +187,12 @@  int odp_schedule_num_prio(void);
 /**
  * Schedule group create
  *
- * Creates a schedule group with the thread mask. Only threads in the
+ * Create a schedule group with the specified thread mask. Only threads in the
  * mask will receive events from a queue that belongs to the schedule group.
  * Thread masks of various schedule groups may overlap. There are predefined
  * groups such as ODP_SCHED_GROUP_ALL and ODP_SCHED_GROUP_WORKER, which are
- * always present and automatically updated. Group name is optional
- * (may be NULL) and can have ODP_SCHED_GROUP_NAME_LEN characters in maximum.
+ * always present and automatically updated. Group name is optional (may be
+ * NULL) and can contain a maximum of ODP_SCHED_GROUP_NAME_LEN characters.
  *
  * @param name    Schedule group name
  * @param mask    Thread mask
@@ -208,7 +208,7 @@  odp_schedule_group_t odp_schedule_group_create(const char *name,
 /**
  * Schedule group destroy
  *
- * Destroys a schedule group. All queues belonging to the schedule group must
+ * Destroy a schedule group. All queues belonging to the schedule group must
  * be destroyed before destroying the group. Other operations on this group
  * must not be invoked in parallel.
  *
@@ -220,41 +220,61 @@  odp_schedule_group_t odp_schedule_group_create(const char *name,
 int odp_schedule_group_destroy(odp_schedule_group_t group);
 
 /**
- * Initialize ordered context lock
+ * Look up a schedule group by name
  *
- * Initialize an ordered queue context lock. The lock can be associated only
- * with ordered queues and used only within an ordered synchronization context.
+ * Return the handle of a schedule group from its name
  *
- * @param queue   Ordered queue
- * @param lock    Ordered context lock
+ * @param name   Name of schedule group
+ *
+ * @return Handle of schedule group for specified name
+ * @retval ODP_SCHEDULE_GROUP_INVALID No matching schedule group found
+ */
+odp_schedule_group_t odp_schedule_group_lookup(const char *name);
+
+/**
+ * Join a schedule group
+ *
+ * Join a threadmask to an existing schedule group
+ *
+ * @param group  Schdule group handle
+ * @param mask   Thread mask
  *
  * @retval 0 on success
  * @retval <0 on failure
  */
-int odp_schedule_olock_init(odp_queue_t queue, odp_schedule_olock_t *lock);
+int odp_schedule_group_join(odp_schedule_group_t group,
+			    const odp_thrmask_t *mask);
 
 /**
- * Acquire ordered context lock
+ * Leave a schedule group
+ *
+ * Remove a threadmask from an existing schedule group
+ *
+ * @param group  Schedule group handle
+ * @param mask   Thread mask
  *
- * This call is valid only when holding an ordered synchronization context. The
- * lock is used to protect a critical section that is executed within an
- * ordered context. Threads enter the critical section in the order determined
- * by the context (source queue). Lock ordering is automatically skipped for
- * threads that release the context instead of calling the lock.
+ * @retval 0 on success
+ * @retval <0 on failure
  *
- * @param lock    Ordered context lock
+ * @note Leaving a schedule group means threads in the specified mask will no
+ * longer receive events from queues belonging to the specified schedule
+ * group. This effect is not instantaneous, however, and events that have been
+ * prestaged may still be presented to the masked threads.
  */
-void odp_schedule_olock_lock(odp_schedule_olock_t *lock);
+int odp_schedule_group_leave(odp_schedule_group_t group,
+			     const odp_thrmask_t *mask);
 
 /**
- * Release ordered context lock
+ * Get a schedule group's thrmask
  *
- * This call is valid only when holding an ordered synchronization context.
- * Release a previously locked ordered context lock.
+ * @param      group   Schedule group handle
+ * @param[out] thrmask The current thrmask used for this schedule group
  *
- * @param lock    Ordered context lock
+ * @retval 0  On success
+ * @retval <0 Invalid group specified
  */
-void odp_schedule_olock_unlock(odp_schedule_olock_t *lock);
+int odp_schedule_group_thrmask(odp_schedule_group_t group,
+			       odp_thrmask_t *thrmask);
 
 /**
  * @}