Thread (22 messages) 22 messages, 2 authors, 2019-11-08

Re: [RFC PATCH 04/14] pipe: Add O_NOTIFICATION_PIPE [ver #2]

From: David Howells <dhowells@redhat.com>
Date: 2019-11-08 06:43:02
Also in: keyrings, linux-api, linux-fsdevel, linux-security-module, linux-usb, lkml

Andy Lutomirski [off-list ref] wrote:
I can open a normal pipe from userspace (with pipe() or pipe2()), and
I can have two threads.  One thread writes to the pipe with write().
The other thread writes with splice().  Everything works fine.
Yes.  Every operation you do on a pipe from userspace is serialised with the
pipe mutex - and both ends share the same pipe.
What's special about notifications?
The post_notification() cannot take the pipe mutex.  It has to be callable
from softirq context.  Linus's idea is that when you're actually altering the
ring pointers you should hold the wake-queue spinlock, and post_notification()
holds the wake queue spinlock for the duration of the operation.

This means that post_notification() can be writing to the pipe whilst a
userspace-invoked operation is holding the pipe mutex and is also doing
something to the ring.

David
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help