Commit a6461ad2 authored by Philippe Gerum's avatar Philippe Gerum
Browse files

evl/xbuf: convert inbound buffer lock to hard lock

The data protected by the inbound (oob -> in-band traffic) buffer lock
is frequently accessed from the in-band stage by design, where hard
irqs should be disabled. Conversely, the out-of-band sections are
short enough to bear with interrupt-free execution. Therefore we would
not generally benefit from the preemption disabling feature we are
going to add to the EVL-specific spinlock. Make it a hard lock to
clarify the intent.
Signed-off-by: default avatarPhilippe Gerum <>
parent 6bec969a
......@@ -17,7 +17,6 @@
#include <evl/clock.h>
#include <evl/xbuf.h>
#include <evl/memory.h>
#include <evl/lock.h>
#include <evl/factory.h>
#include <evl/sched.h>
#include <evl/poll.h>
......@@ -47,7 +46,7 @@ struct xbuf_inbound { /* oob_write->read */
struct evl_flag o_event;
struct irq_work irq_work;
struct xbuf_ring ring;
evl_spinlock_t lock;
hard_spinlock_t lock;
struct xbuf_outbound { /* write->oob_read */
......@@ -300,7 +299,7 @@ static unsigned long inbound_lock(struct xbuf_ring *ring)
struct evl_xbuf *xbuf = container_of(ring, struct evl_xbuf, ibnd.ring);
unsigned long flags;
evl_spin_lock_irqsave(&xbuf->ibnd.lock, flags);
raw_spin_lock_irqsave(&xbuf->ibnd.lock, flags);
return flags;
......@@ -309,7 +308,7 @@ static void inbound_unlock(struct xbuf_ring *ring, unsigned long flags)
struct evl_xbuf *xbuf = container_of(ring, struct evl_xbuf, ibnd.ring);
evl_spin_unlock_irqrestore(&xbuf->ibnd.lock, flags);
raw_spin_unlock_irqrestore(&xbuf->ibnd.lock, flags);
static int inbound_wait_input(struct xbuf_ring *ring, size_t len, size_t avail)
......@@ -678,7 +677,7 @@ xbuf_factory_build(struct evl_factory *fac, const char __user *u_name,
/* Inbound traffic: oob_write() -> read(). */
init_irq_work(&xbuf->ibnd.irq_work, resume_inband_reader);
xbuf->ibnd.ring.bufmem = i_bufmem;
xbuf->ibnd.ring.bufsz = attrs.i_bufsz;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment