[dpdk-dev] rte_ring: clarify preemptable nature of ring algorithm

Message ID 1527570373-120745-1-git-send-email-honnappa.nagarahalli@arm.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

Honnappa Nagarahalli May 29, 2018, 5:06 a.m. UTC
  rte_ring implementation is not preemptable only under certain circumstances.
This clarification is helpful for data plane and control plane communication
using rte_ring.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>
---
 lib/librte_ring/rte_ring.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
  

Comments

Stephen Hemminger May 30, 2018, 2:39 a.m. UTC | #1
Spinlock has same problem

On Tue, May 29, 2018, 1:06 AM Honnappa Nagarahalli <
honnappa.nagarahalli@arm.com> wrote:

> rte_ring implementation is not preemptable only under certain
> circumstances.
> This clarification is helpful for data plane and control plane
> communication
> using rte_ring.
>
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>
> ---
>  lib/librte_ring/rte_ring.h | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
> index d3d3f7f..2f9c945 100644
> --- a/lib/librte_ring/rte_ring.h
> +++ b/lib/librte_ring/rte_ring.h
> @@ -26,8 +26,13 @@
>   * - Bulk dequeue.
>   * - Bulk enqueue.
>   *
> - * Note: the ring implementation is not preemptable. A lcore must not
> - * be interrupted by another task that uses the same ring.
> + * Note: the ring implementation can block threads from completing their
> + * operation under the following circumstances.
> + * A preempted thread can block other threads (operating on the same ring)
> + * from completing their operations, only if those threads are performing
> + * the same ring operation (enqueue/dequeue) as the preempted thread.
> + * In other words, a preempted consumer thread will not block any producer
> + * threads and vice versa.
>   *
>   */
>
> --
> 2.7.4
>
>
  

Patch

diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
index d3d3f7f..2f9c945 100644
--- a/lib/librte_ring/rte_ring.h
+++ b/lib/librte_ring/rte_ring.h
@@ -26,8 +26,13 @@ 
  * - Bulk dequeue.
  * - Bulk enqueue.
  *
- * Note: the ring implementation is not preemptable. A lcore must not
- * be interrupted by another task that uses the same ring.
+ * Note: the ring implementation can block threads from completing their
+ * operation under the following circumstances.
+ * A preempted thread can block other threads (operating on the same ring)
+ * from completing their operations, only if those threads are performing
+ * the same ring operation (enqueue/dequeue) as the preempted thread.
+ * In other words, a preempted consumer thread will not block any producer
+ * threads and vice versa.
  *
  */