Re: [PATCH] drm/i915/selftests: Fix dependency of some timeouts on HZ

2024-03-05 Thread Andi Shyti
Hi Janusz,

On Thu, Feb 22, 2024 at 12:32:40PM +0100, Janusz Krzysztofik wrote:
> Third argument of i915_request_wait() accepts a timeout value in jiffies.
> Most users pass either a simple HZ based expression, or a result of
> msecs_to_jiffies(), or MAX_SCHEDULE_TIMEOUT, or a very small number not
> exceeding 4 if applicable as that value.  However, there is one user --
> intel_selftest_wait_for_rq() -- that passes a WAIT_FOR_RESET_TIME symbol,
> defined as a large constant value that most probably represents a desired
> timeout in ms.  While that usage results in the intended value of timeout
> on usual x86_64 kernel configurations, it is not portable across different
> architectures and custom kernel configs.
> 
> Rename the symbol to clearly indicate intended units and convert it to
> jiffies before use.
> 
> Fixes: 3a4bfa091c46 ("drm/i915/selftest: Fix workarounds selftest for GuC 
> submission")
> Signed-off-by: Janusz Krzysztofik 
> Cc: Rahul Kumar Singh 
> Cc: John Harrison 
> Cc: Matthew Brost 

pushed in drm-intel-gt-next.

Thank you,
Andi


Re: [PATCH] drm/i915/selftests: Fix dependency of some timeouts on HZ

2024-02-29 Thread Andi Shyti
Hi Janusz,

On Thu, Feb 22, 2024 at 12:32:40PM +0100, Janusz Krzysztofik wrote:
> Third argument of i915_request_wait() accepts a timeout value in jiffies.
> Most users pass either a simple HZ based expression, or a result of
> msecs_to_jiffies(), or MAX_SCHEDULE_TIMEOUT, or a very small number not
> exceeding 4 if applicable as that value.  However, there is one user --
> intel_selftest_wait_for_rq() -- that passes a WAIT_FOR_RESET_TIME symbol,
> defined as a large constant value that most probably represents a desired
> timeout in ms.  While that usage results in the intended value of timeout
> on usual x86_64 kernel configurations, it is not portable across different
> architectures and custom kernel configs.
> 
> Rename the symbol to clearly indicate intended units and convert it to
> jiffies before use.
> 
> Fixes: 3a4bfa091c46 ("drm/i915/selftest: Fix workarounds selftest for GuC 
> submission")
> Signed-off-by: Janusz Krzysztofik 
> Cc: Rahul Kumar Singh 
> Cc: John Harrison 
> Cc: Matthew Brost 

Reviewed-by: Andi Shyti 

Thanks,
Andi


[PATCH] drm/i915/selftests: Fix dependency of some timeouts on HZ

2024-02-22 Thread Janusz Krzysztofik
Third argument of i915_request_wait() accepts a timeout value in jiffies.
Most users pass either a simple HZ based expression, or a result of
msecs_to_jiffies(), or MAX_SCHEDULE_TIMEOUT, or a very small number not
exceeding 4 if applicable as that value.  However, there is one user --
intel_selftest_wait_for_rq() -- that passes a WAIT_FOR_RESET_TIME symbol,
defined as a large constant value that most probably represents a desired
timeout in ms.  While that usage results in the intended value of timeout
on usual x86_64 kernel configurations, it is not portable across different
architectures and custom kernel configs.

Rename the symbol to clearly indicate intended units and convert it to
jiffies before use.

Fixes: 3a4bfa091c46 ("drm/i915/selftest: Fix workarounds selftest for GuC 
submission")
Signed-off-by: Janusz Krzysztofik 
Cc: Rahul Kumar Singh 
Cc: John Harrison 
Cc: Matthew Brost 
---
 drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c 
b/drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c
index 2990dd4d4a0d8..e14ac0ab1314d 100644
--- a/drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c
+++ b/drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c
@@ -3,6 +3,8 @@
  * Copyright © 2021 Intel Corporation
  */
 
+#include 
+
 //#include "gt/intel_engine_user.h"
 #include "gt/intel_gt.h"
 #include "i915_drv.h"
@@ -12,7 +14,7 @@
 
 #define REDUCED_TIMESLICE  5
 #define REDUCED_PREEMPT10
-#define WAIT_FOR_RESET_TIME1
+#define WAIT_FOR_RESET_TIME_MS 1
 
 struct intel_engine_cs *intel_selftest_find_any_engine(struct intel_gt *gt)
 {
@@ -91,7 +93,7 @@ int intel_selftest_wait_for_rq(struct i915_request *rq)
 {
long ret;
 
-   ret = i915_request_wait(rq, 0, WAIT_FOR_RESET_TIME);
+   ret = i915_request_wait(rq, 0, 
msecs_to_jiffies(WAIT_FOR_RESET_TIME_MS));
if (ret < 0)
return ret;
 

base-commit: 661a9b14c215bc3ba24badcac80ce4eb3f57d3ff
-- 
2.43.0