wow IOCTL_GNTDEV_DMABUF_EXP_WAIT_RELEASED is the most hilarious API blunder in t...

@valpackett@treehouse.systems

wow IOCTL_GNTDEV_DMABUF_EXP_WAIT_RELEASED is the most hilarious API blunder in the kernel. I'm not sure if anyone else has actually needed/used it before, but I did, and uh-

so it's a blocking poll for just this one thing, the buffer being released, right? so you have to block an entire thread just on that. great. I've actually tried to use it now, and my first thought was "it has a timeout, i'll just have a thread that loops between all the buffers-to-free and polls each for a second" uhhhhhh soo,,, that the buffer won't be released as long as you hold your fd to it. the fd that you would need to poll again!! oops. actually spawning a whole new thread per released buffer "works" (in a fragile way because you need to close the fd after that thread has started polling, but you have no easy way of knowing it has, so sleep() lol)

well i need this event not only for xen grants but udmabufs too so time to do it properly for all dmabufs… will be my first actual public uapi addition if that gets accepted i guess