drm/i915/gt: Use proper sleeping functions for timeouts shorter than 20ms
authorAndi Shyti <andi.shyti@linux.intel.com>
Fri, 14 Mar 2025 02:12:24 +0000 (03:12 +0100)
committerAndi Shyti <andi.shyti@linux.intel.com>
Wed, 19 Mar 2025 01:41:17 +0000 (02:41 +0100)
msleep is very imprecise for timeouts shorter than 20
milliseconds and most probably will sleep longer. Use
uslee_range() instead.

Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250314021225.11813-5-andi.shyti@linux.intel.com
drivers/gpu/drm/i915/gt/selftest_rc6.c
drivers/gpu/drm/i915/gt/selftest_tlb.c

index 27b6d51ef1454f38713718042f99088f30391f24..1f8bc5ac20c256b890aa22b869c8610e3341fa4c 100644 (file)
@@ -60,7 +60,8 @@ int live_rc6_manual(void *arg)
 
        /* Force RC6 off for starters */
        __intel_rc6_disable(rc6);
-       msleep(1); /* wakeup is not immediate, takes about 100us on icl */
+       /* wakeup is not immediate, takes about 100us on icl */
+       usleep_range(1000, 2000);
 
        res[0] = rc6_residency(rc6);
 
index 3941f2d6fa47d72595b6ac13d028ce637ec1a725..69ed946a39e5c84c09247b7759604c95112e2886 100644 (file)
@@ -143,7 +143,7 @@ pte_tlbinv(struct intel_context *ce,
        if (ce->engine->class == OTHER_CLASS)
                msleep(200);
        else
-               msleep(10);
+               usleep_range(10000, 20000);
 
        if (va == vb) {
                if (!i915_request_completed(rq)) {