drm/nouveau/instmem/gk20a: fix race conditions
authorAlexandre Courbot <acourbot@nvidia.com>
Mon, 9 Nov 2015 07:37:53 +0000 (16:37 +0900)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 11 Jan 2016 01:17:40 +0000 (11:17 +1000)
commit338840eed18e05209c0e9f20f818964a66fce053
treedf761423858cb9a629aedc7bbda0003d4b096633
parent5a9e822f8098e6aa7a8305627ca5dd09d87ef846
drm/nouveau/instmem/gk20a: fix race conditions

The LRU list used for recycling CPU mappings was handling concurrency
very poorly. For instance, if an instobj was acquired twice before being
released once, it would end up into the LRU list even though there is
still a client accessing it.

This patch fixes this by properly counting how many clients are
currently using a given instobj.

While at it, we also raise errors when inconsistencies are detected, and
factorize some code.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c