OSDN Git Service

drm/i915/gem: Avoid kmalloc under i915->mm_lock
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 19 Jun 2020 19:40:38 +0000 (20:40 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 30 Jun 2020 18:36:16 +0000 (19:36 +0100)
commit040e123c0b7305a490adb4168b459c342ae7e9b2
tree4229fa52c289e0ae6b703192a138f6a181c701f4
parentf6a7d3952cbed2c1e07d945dbb36f5c34200e9c1
drm/i915/gem: Avoid kmalloc under i915->mm_lock

Rearrange the allocation of the mm_struct registration to avoid
allocating underneath the i915->mm_lock, so that we avoid tainting the
lock (and in turn many other locks that may be held as i915->mm_lock is
taken, and those locks we may want on the free [shrinker] paths). In
doing so, we convert the lookup to be RCU protected by courtesy of
converting the free-worker to be an rcu_work.

v2: Remember to use hash_rcu variants to protect the list iteration from
concurrent add/del.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200619194038.5088-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gem/i915_gem_userptr.c
drivers/gpu/drm/i915/i915_drv.h