linux_dsm_epyc7002/drivers/gpu/drm/i915/selftests
Daniel Vetter f86dbacb30 drm/i915: Switch obj->mm.lock lockdep annotations on its head
The trouble with having a plain nesting flag for locks which do not
naturally nest (unlike block devices and their partitions, which is
the original motivation for nesting levels) is that lockdep will
never spot a true deadlock if you screw up.

This patch is an attempt at trying better, by highlighting a bit more
of the actual nature of the nesting that's going on. Essentially we
have two kinds of objects:

- objects without pages allocated, which cannot be on any lru and are
  hence inaccessible to the shrinker.

- objects which have pages allocated, which are on an lru, and which
  the shrinker can decide to throw out.

For the former type of object, memory allocations while holding
obj->mm.lock are permissible. For the latter they are not. And
get/put_pages transitions between the two types of objects.

This is still not entirely fool-proof since the rules might change.
But as long as we run such a code ever at runtime lockdep should be
able to observe the inconsistency and complain (like with any other
lockdep class that we've split up in multiple classes). But there are
a few clear benefits:

- We can drop the nesting flag parameter from
  __i915_gem_object_put_pages, because that function by definition is
  never going allocate memory, and calling it on an object which
  doesn't have its pages allocated would be a bug.

- We strictly catch more bugs, since there's not only one place in the
  entire tree which is annotated with the special class. All the
  other places that had explicit lockdep nesting annotations we're now
  going to leave up to lockdep again.

- Specifically this catches stuff like calling get_pages from
  put_pages (which isn't really a good idea, if we can call get_pages
  so could the shrinker). I've seen patches do exactly that.

Of course I fully expect CI will show me for the fool I am with this
one here :-)

v2: There can only be one (lockdep only has a cache for the first
subclass, not for deeper ones, and we don't want to make these locks
even slower). Still separate enums for better documentation.

Real fix: don't forget about phys objs and pin_map(), and fix the
shrinker to have the right annotations ... silly me.

v3: Forgot usertptr too ...

v4: Improve comment for pages_pin_count, drop the IMPORTANT comment
and instead prime lockdep (Chris).

v5: Appease checkpatch, no double empty lines (Chris)

v6: More rebasing over selftest changes. Also somehow I forgot to
push this patch :-/

Also format comments consistently while at it.

v7: Fix typo in commit message (Joonas)

Also drop the priming, with the lmem merge we now have allocations
while holding the lmem lock, which wreaks the generic priming I've
done in earlier patches. Should probably be resurrected when lmem is
fixed. See

commit 232a6ebae4
Author: Matthew Auld <matthew.auld@intel.com>
Date:   Tue Oct 8 17:01:14 2019 +0100

    drm/i915: introduce intel_memory_region

I'm keeping the priming patch locally so it wont get lost.

Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: "Tang, CQ" <cq.tang@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v5)
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v6)
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191105090148.30269-1-daniel.vetter@ffwll.ch
[mlankhorst: Fix commit typos pointed out by Michael Ruhl]
2019-11-07 09:58:11 +01:00
..
i915_active.c drm/i915/selftests: Flush all active callbacks 2019-11-02 08:34:53 +00:00
i915_buddy.c drm/i915/selftests: cond_resched() within the longer buddy tests 2019-08-29 19:19:50 +01:00
i915_gem_evict.c drm/i915/selftests: Convert eviction selftests to gt/ggtt 2019-10-22 12:16:42 +01:00
i915_gem_gtt.c drm/i915/selftests: check for missing aperture 2019-10-29 10:35:47 +00:00
i915_gem.c drm/i915/gt: Call intel_gt_sanitize() directly 2019-11-01 14:47:36 +00:00
i915_live_selftests.h drm/i915: support creating LMEM objects 2019-10-25 22:55:31 +01:00
i915_mock_selftests.h drm/i915: introduce intel_memory_region 2019-10-08 20:49:55 +01:00
i915_perf.c drm/i915/perf: ensure selftests select valid format 2019-10-29 18:58:07 +00:00
i915_random.c drm/i915/selftests: Extract random_offset() for use with a prng 2019-10-02 15:30:44 +01:00
i915_random.h drm/i915/selftests: Extract random_offset() for use with a prng 2019-10-02 15:30:44 +01:00
i915_request.c drm/i915/selftests: Spin on all engines simultaneously 2019-11-01 13:06:35 +00:00
i915_selftest.c drm/i915/selftests: Tweak the default subtest runtime 2019-10-25 11:54:37 +01:00
i915_sw_fence.c
i915_syncmap.c
i915_vma.c drm/i915: Move context management under GEM 2019-10-04 15:39:34 +01:00
igt_atomic.h drm/i915/selftests: Split igt_atomic_reset testcase 2019-05-23 21:53:26 +01:00
igt_flush_test.c drm/i915: Move request runtime management onto gt 2019-10-04 15:39:26 +01:00
igt_flush_test.h drm/i915: Drop struct_mutex from around i915_retire_requests() 2019-10-04 15:39:17 +01:00
igt_live_test.c drm/i915/selftests: Use GT engines in igt_live_test 2019-10-22 12:16:42 +01:00
igt_live_test.h
igt_reset.c drm/i915: Pass in intel_gt at some for_each_engine sites 2019-10-18 00:06:27 +01:00
igt_reset.h drm/i915/gt: Use intel_gt as the primary object for handling resets 2019-07-12 21:06:56 +01:00
igt_spinner.c drm/i915/selftests: Spin on all engines simultaneously 2019-11-01 13:06:35 +00:00
igt_spinner.h drm/i915/selftests: Pass intel_context to igt_spinner 2019-07-31 09:45:27 +01:00
intel_memory_region.c drm/i915: Switch obj->mm.lock lockdep annotations on its head 2019-11-07 09:58:11 +01:00
intel_uncore.c drm/i915/selftests: Move uncore fw selftests to operate on intel_gt 2019-10-22 20:44:52 +01:00
lib_sw_fence.c drm/i915: Propagate fence errors 2019-08-18 12:38:09 +01:00
lib_sw_fence.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 428 2019-06-05 17:37:16 +02:00
mock_drm.c
mock_drm.h
mock_gem_device.c drm/i915/gt: Call intel_gt_sanitize() directly 2019-11-01 14:47:36 +00:00
mock_gem_device.h
mock_gtt.c drm/i915/gt: Call intel_gt_sanitize() directly 2019-11-01 14:47:36 +00:00
mock_gtt.h drm/i915: Rename i915_hw_ppgtt to i915_ppgtt 2019-06-11 11:44:32 +01:00
mock_region.c drm/i915/gem: Distinguish each object type 2019-10-22 16:23:32 +01:00
mock_region.h drm/i915: introduce intel_memory_region 2019-10-08 20:49:55 +01:00
mock_request.c drm/i915/selftests: Pass intel_context to mock_request 2019-08-08 13:44:31 +01:00
mock_request.h drm/i915/selftests: Pass intel_context to mock_request 2019-08-08 13:44:31 +01:00
mock_uncore.c drm/i915/selftests: Assign the intel_runtime_pm pointer for mock_uncore 2019-10-08 16:21:50 +01:00
mock_uncore.h drm/i915/selftests: Assign the intel_runtime_pm pointer for mock_uncore 2019-10-08 16:21:50 +01:00
scatterlist.c drm/i915: Pull scatterlist utils out of i915_gem.h 2019-05-28 12:45:29 +01:00