Re: [PATCH RFC v7 1/5] ptr_ring: array based FIFO for pointers

From: Jesper Dangaard Brouer
Date: Fri Jun 03 2016 - 13:38:58 EST



On Thu, 2 Jun 2016 19:08:18 +0300 "Michael S. Tsirkin" <mst@xxxxxxxxxx> wrote:

> A simple array based FIFO of pointers. Intended for net stack which
> commonly has a single consumer/producer.
>
> Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
> ---
> include/linux/ptr_ring.h | 264 +++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 264 insertions(+)
> create mode 100644 include/linux/ptr_ring.h
>
> diff --git a/include/linux/ptr_ring.h b/include/linux/ptr_ring.h
> new file mode 100644
> index 0000000..d265d72
> --- /dev/null
> +++ b/include/linux/ptr_ring.h
[...]
> +static inline void *ptr_ring_consume_bh(struct ptr_ring *r)
^^^
> +{
> + void *ptr;
> +
> + spin_lock(&r->consumer_lock);

Ups! should have been spin_lock_bh()

> + ptr = __ptr_ring_consume(r);
> + spin_unlock(&r->consumer_lock);

and spin_unlock_bh()

> +
> + return ptr;
> +}



--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
Author of http://www.iptv-analyzer.org
LinkedIn: http://www.linkedin.com/in/brouer