Thread (12 messages) flat view 12 messages, 3 authors, 2016-06-06

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

From: Jesper Dangaard Brouer <hidden>
Date: 2016-06-03 17:38:56
Also in: kvm, lkml

On Thu, 2 Jun 2016 19:08:18 +0300 "Michael S. Tsirkin" [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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@redhat.com>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help