On Wed, Nov 25, 2020 at 5:56 PM Michel Dänzer michel@daenzer.net wrote:
On 2020-11-25 1:57 p.m., Christian König wrote:
Well thinking more about this, it seems to be a another really good argument why mapping pages from DMA-bufs into application address space directly is a very bad idea :)
Apologies for going off on a tangent here...
Since allowing userspace mmap with dma-buf fds seems to be a trap in general[0], I wonder if there's any way we could stop supporting that?
[0] E.g. mutter had to disable handing out dma-bufs for screen capture by default with non-i915 for now, because in particular with discrete GPUs, direct CPU reads can be unusably slow (think single-digit frames per second), and of course there's other userspace which goes "ooh, dma-buf, let's map and read!".
I think a pile of applications (cros included) use it to do uploads across process boundaries. Think locked down jpeg decoder and stuff like that. For that use-case it seems to work ok.
But yeah don't read from dma-buf. I'm pretty sure it's dead slow on almost everything, except integrated gpu which have A) a coherent fabric with the gpu and B) that fabric is actually faster for rendering in general, not just for dedicated buffers allocated for down/upload. -Daniel