Re: [Nouveau] [PATCH v4 2/6] drm/nouveau: map pages using DMA API on platform devices

From: Lucas Stach
Date: Fri Jul 11 2014 - 05:55:14 EST

Am Freitag, den 11.07.2014, 11:57 +0900 schrieb Alexandre Courbot:
> >> Yeah, I am not familiar with i915 but it seems like we are on a similar boat
> >> here (excepted ARM is more constrained as to its memory mappings). The
> >> strategy in this series is, map buffers used by user-space cached and
> >> explicitly synchronize them (since the ownership transition from user to GPU
> >> is always clearly performed by syscalls), and use coherent mappings for
> >> buffers used by the kernel which are accessed more randomly. This has solved
> >> all our coherency issues and resulted in the best performance so far.
> > I wonder if we might want to use unsnooped cached mappings of pages on
> > non-ARM platforms also, to avoid the overhead of the cache snooping?
> You might want to indeed, now that coherency is guaranteed by the sync
> functions originally introduced by Lucas. The only issue I could see is
> that they always invalidate the full buffer whereas bus snooping only
> affects pages that are actually touched. Someone would need to try this
> on a desktop machine and see how it affects performance.
> I'd be all for it though, since it would also allow us to get rid of
> this ungraceful nv_device_is_cpu_coherent() function and result in
> simplifying nouveau_bo.c a bit.

This will need some testing to get hard numbers, but I suspect that
invalidating the whole buffer isn't to bad as the prefetch machinery
works very well with the access patterns we see in graphics drivers.

Flushing out the whole buffer should be even less problematic, as it
will only flush out dirty lines that would need to be flushed on GPU
read snooping anyways.

In the long run we might want a separate cpu prepare/finish ioctl where
we can indicate the area of interest. This might help to avoid some of
the invalidate overhead especially for userspace suballocated buffers.


Pengutronix e.K. | Lucas Stach |
Industrial Linux Solutions | |

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at