<qyliss>
Hmm, VIRTWL_IOCTL_RECV doesn't take flags
<qyliss>
So I couldn't even easily extend it to support MSG_DONTWAIT
<qyliss>
This is really annoying because the virtio_wl kernel module does support nonblocking reads, if the whole socket is O_NONBLOCK
<qyliss>
puck: how bad an idea would it be to make Wayland fcntl O_NONBLOCK before reading if it can't use MSG_DONTWAIT, and then set it back after?
pinkieval has quit [Ping timeout: 240 seconds]
pinkieval has joined #spectrum
<puck>
qyliss: i have No Idea
<puck>
to some degree adding support for flags onto the ioctl seems like it'd be a little more useful in general, but hey :p
<qyliss>
Yeah but then I have to write kernel code
<qyliss>
And probably fix sommelier
<qyliss>
I guess I can try the O_NONBLOCK way for now, and if we get Wayland freezes we'll know that's the likely culprit
<qyliss>
And I can go back and add flag support later once this all works
<qyliss>
(And I have more runway)
<qyliss>
A long-shot kernel goal would be to have normal recvmsg(2) work on virtio_wl fds
<qyliss>
I don't think there's any reason in principal it couldn't be done
<qyliss>
And would save a lot of patching
<MichaelRaskin>
Ideally upstream eventually mainlines virtio_wl as a socket transport comparable to TCP/IP sockets…
<MichaelRaskin>
Some day…
<MichaelRaskin>
(and without losing support for sending memfd's)
<qyliss>
Yeah, ideally it would be an extension to vsock or something
<qyliss>
I don't think they'd mainline it without memfd support though -- otherwise it's basically exactly the same as vsock
<puck>
qyliss: yeah, my suspicion is that there is no recvmsg support because it doesn't support arbitrary FD passing or so
<puck>
so using it with a plain wayland client wouldn't work
<qyliss>
Oh, because Sommelier has to do magic?
<puck>
yeah, like, you need to create memfds in a certain way
<qyliss>
Well you can't create memfds, AIUI
<qyliss>
only the host can
<qyliss>
If there's a way to create memfds from a guest and I've missed it, that, uh, changes things
<qyliss>
so please lmk if I'm wrong
<qyliss>
Hmm, I wonder if reading from a hungup virtio_wl socket triggers SIGPIPE/EPIPE
<qyliss>
It doesn't look like it does, from the implementation
<qyliss>
Which is convenient because Wayland wants to pass MSG_NOSIGNAL
<qyliss>
I suppose it's maybe possible that that is handled somewhere else in the kernel, but I don't really see how EPIPE at least would end up being returned
<qyliss>
Actually virtwl_vfd_send doesn't seem to check for hungup at all