Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpu: host1x: Do not use mapping cache for job submissions

Buffer mappings used in job submissions are usually small and not
rapidly reused as opposed to framebuffers (which are usually large and
rapidly reused, for example when page-flipping between double-buffered
framebuffers). Avoid going through the mapping cache for these buffers
since the cache would also lead to leaks if nobody is ever releasing
the cache's last reference. For DRM/KMS these last references are
dropped when the framebuffers are removed and therefore no longer
needed.

While at it, also add a note about the need to explicitly remove the
final reference to the mapping in the cache.

Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>

+7 -2
+2 -2
drivers/gpu/host1x/job.c
··· 175 175 goto unpin; 176 176 } 177 177 178 - map = host1x_bo_pin(dev, bo, direction, &client->cache); 178 + map = host1x_bo_pin(dev, bo, direction, NULL); 179 179 if (IS_ERR(map)) { 180 180 err = PTR_ERR(map); 181 181 goto unpin; ··· 222 222 goto unpin; 223 223 } 224 224 225 - map = host1x_bo_pin(host->dev, g->bo, DMA_TO_DEVICE, &host->cache); 225 + map = host1x_bo_pin(host->dev, g->bo, DMA_TO_DEVICE, NULL); 226 226 if (IS_ERR(map)) { 227 227 err = PTR_ERR(map); 228 228 goto unpin;
+5
include/linux/host1x.h
··· 31 31 * struct host1x_bo_cache - host1x buffer object cache 32 32 * @mappings: list of mappings 33 33 * @lock: synchronizes accesses to the list of mappings 34 + * 35 + * Note that entries are not periodically evicted from this cache and instead need to be 36 + * explicitly released. This is used primarily for DRM/KMS where the cache's reference is 37 + * released when the last reference to a buffer object represented by a mapping in this 38 + * cache is dropped. 34 39 */ 35 40 struct host1x_bo_cache { 36 41 struct list_head mappings;