]> git.baikalelectronics.ru Git - kernel.git/commit
drm/vmwgfx: Refactor ttm reference object hashtable to use linux/hashtable.
authorMaaz Mombasawala <mombasawalam@vmware.com>
Sat, 22 Oct 2022 04:02:29 +0000 (00:02 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:58:28 +0000 (11:58 +0100)
commita6bc57a960a11434cd105acc10c1a6d6ca26d5b3
tree6637e93cb3bbf7f6e4546ba618be663182616dd1
parent8752fdeeb74911b6cc0fc842abfa6c9fb755d89c
drm/vmwgfx: Refactor ttm reference object hashtable to use linux/hashtable.

[ Upstream commit e7ab9573edfb4783402d63a47810dbc6a7d59b3e ]

This is part of an effort to move from the vmwgfx_open_hash hashtable to
linux/hashtable implementation.
Refactor the ref_hash hashtable, used for fast lookup of reference objects
associated with a ttm file.
This also exposed a problem related to inconsistently using 32-bit and
64-bit keys with this hashtable. The hash function used changes depending
on the size of the type, and results are not consistent across numbers,
for example, hash_32(329) = 329, but hash_long(329) = 328. This would
cause the lookup to fail for objects already in the hashtable, since keys
of different sizes were being passed during adding and lookup. This was
not an issue before because vmwgfx_open_hash always used hash_long.
Fix this by always using 64-bit keys for this hashtable, which means that
hash_long is always used.

Signed-off-by: Maaz Mombasawala <mombasawalam@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
Signed-off-by: Zack Rusin <zackr@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221022040236.616490-11-zack@kde.org
Stable-dep-of: 1ed759639c37 ("drm/vmwgfx: Remove rcu locks from user resources")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/vmwgfx/ttm_object.c
drivers/gpu/drm/vmwgfx/ttm_object.h
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c