linux-stable/drivers/gpu/drm/i915/selftests
George Spelvin c43a87f537 drm/i915/selftests: Avoid passing a random 0 into ilog2
igt_mm_config() calls ilog2() on the (pseudo)random 21-bit number
s>>12.  Once in 2 million seeds, this is zero and ilog2 summons
the nasal demons.

There was an attempt to handle this case with a max(), but that's
too late; ms could already be something bizarre.

Given that the low 12 bits of s and ms are always zero, it's a lot
simpler just to divide them by 4096, then everything fits into 32
bits, and we can easily generate a random number 1 <= s <= 0x1fffff.

Fixes: 14d1b9a624 ("drm/i915: buddy allocator")
Signed-off-by: George Spelvin <lkml@sdf.org>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20200325192429.GA8865@SDF.ORG
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
(cherry picked from commit 21118e8e56)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2020-08-19 15:23:36 +03:00
..
i915_active.c drm/i915: Allow for different modes of interruptible i915_active_wait 2020-03-30 18:20:33 +01:00
i915_buddy.c drm/i915/selftests: Avoid passing a random 0 into ilog2 2020-08-19 15:23:36 +03:00
i915_gem.c drm/i915/gt: Pull restoration of GGTT fences underneath the GT 2020-03-16 20:28:28 +00:00
i915_gem_evict.c drm/i915/gem: Drop cached obj->bind_count 2020-04-02 01:17:39 +01:00
i915_gem_gtt.c drm/i915/gem: Give each object class a friendly name 2020-05-29 23:38:29 +01:00
i915_live_selftests.h drm/i915: Fix comments mentioning typo in IS_ENABLED() 2020-06-05 16:28:42 +01:00
i915_mock_selftests.h drm/i915/gt: Incrementally check for rewinding 2020-06-16 11:34:23 +03:00
i915_perf.c drm/i915/selftest: Fix an error code in live_noa_gpr() 2020-07-14 18:16:15 +01:00
i915_perf_selftests.h drm/i915: Fix comments mentioning typo in IS_ENABLED() 2020-06-05 16:28:42 +01:00
i915_random.c
i915_random.h
i915_request.c drm/i915: Move the engine mask to intel_gt_info 2020-07-08 21:07:11 +01:00
i915_selftest.c drm/i915/gem: Implement legacy MI_STORE_DATA_IMM 2020-05-04 15:15:04 +01:00
i915_sw_fence.c
i915_syncmap.c
i915_vma.c drm/i915/execlists: Track inflight CCID 2020-04-28 22:17:36 +01:00
igt_atomic.c
igt_atomic.h
igt_flush_test.c
igt_flush_test.h
igt_live_test.c
igt_live_test.h
igt_mmap.c
igt_mmap.h
igt_reset.c
igt_reset.h
igt_spinner.c drm/i915/selftests: Trim execlists runtime 2020-06-13 10:24:26 +01:00
igt_spinner.h
intel_memory_region.c drm/i915/selftests/perf: watch out for stolen objects 2020-03-23 11:52:34 +00:00
intel_uncore.c
lib_sw_fence.c
lib_sw_fence.h
librapl.c drm/i915/selftests: Move gpu energy measurement into its own little lib 2020-04-17 18:48:51 +01:00
librapl.h drm/i915/selftests: Move gpu energy measurement into its own little lib 2020-04-17 18:48:51 +01:00
mock_drm.h
mock_gem_device.c drm/i915: Copy default modparams to mock i915_device 2020-08-19 15:23:07 +03:00
mock_gem_device.h
mock_gtt.c drm/i915: Export ppgtt_bind_vma 2020-07-03 15:14:35 +01:00
mock_gtt.h
mock_region.c drm/i915/gem: Give each object class a friendly name 2020-05-29 23:38:29 +01:00
mock_region.h
mock_request.c
mock_request.h
mock_uncore.c
mock_uncore.h
scatterlist.c