diff options
author | Anton Ivanov <anton.ivanov@cambridgegreys.com> | 2024-07-05 11:53:31 +0100 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2024-09-12 19:56:05 +0200 |
commit | 612a8c8e0b43ba7e3d0e51f6f76a5fec4912d439 (patch) | |
tree | 6adf0c626cbe8012f7bfd6c965a8807c8b9db59a /arch/um/drivers/vector_kern.h | |
parent | ec24b988eb26e21f37707d090ec3ab53c51fd386 (diff) |
um: vector: Replace locks guarding queue depth with atomics
UML vector drivers use ring buffer structures which map
preallocated skbs onto mmsg vectors for use with sendmmsg
and recvmmsg. They are designed around a single consumer,
single producer pattern allowing simultaneous enqueue and
dequeue.
Lock debugging with preemption showed possible races when
locking the queue depth. This patch addresses this by
removing extra locks, adding barriers and making queue
depth inc/dec and access atomic.
Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um/drivers/vector_kern.h')
-rw-r--r-- | arch/um/drivers/vector_kern.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/um/drivers/vector_kern.h b/arch/um/drivers/vector_kern.h index 806df551be0b..417834793658 100644 --- a/arch/um/drivers/vector_kern.h +++ b/arch/um/drivers/vector_kern.h @@ -14,6 +14,7 @@ #include <linux/ctype.h> #include <linux/workqueue.h> #include <linux/interrupt.h> +#include <asm/atomic.h> #include "vector_user.h" @@ -44,7 +45,8 @@ struct vector_queue { struct net_device *dev; spinlock_t head_lock; spinlock_t tail_lock; - int queue_depth, head, tail, max_depth, max_iov_frags; + atomic_t queue_depth; + int head, tail, max_depth, max_iov_frags; short options; }; |