drm/i915: Fix __intel_wait_for_register_fw to not sleep in atomic
Subsystems (2)
PATCH 1/1 drm/i915: Fix __intel_wait_for_register_fw to not sleep in atomic
The unconditionally fallback to the blocking wait_for resulted in impressive fireworks at boot-up on my snb here. Make sure if we set the slow timeout to 0 that we never ever sleep. The tail of the callchain was
intel_wait_for_register
-> __intel_wait_for_register_fw
-> usleep_range
-> BOOM
It blew up in intel_crt_detect load detection code on the ADPA_CRT_HOTPLUG_FORCE_TRIGGER in the ADPA register.
--- drivers/gpu/drm/i915/intel_uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_uncore.c +1 -1
@@ -1609,7 +1609,7 @@ int __intel_wait_for_register_fw(struct drm_i915_private *dev_priv, ret = -ETIMEDOUT ;if (fast_timeout_us && fast_timeout_us <=20000 ) ret =_wait_for_atomic (done, fast_timeout_us,0 ); -if (ret) +if (ret && slow_timeout_ms) ret =wait_for (done, slow_timeout_ms);if (out_value)
Signature · 6 lines
2.5.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: Fix __intel_wait_for_register_fw to not sleep in atomic
== Series Details ==
== Series Details ==
Series: drm/i915: Fix __intel_wait_for_register_fw to not sleep in atomic
URL : https://patchwork.freedesktop.org/series/24229/
State : failure
== Summary ==
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CHK include/generated/bounds.h
CHK include/generated/timeconst.h
CHK include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CHK kernel/config_data.h
CC [M] drivers/gpu/drm/i915/intel_uncore.o
drivers/gpu/drm/i915/intel_uncore.c: In function ‘__intel_wait_for_register_fw’:
drivers/gpu/drm/i915/intel_uncore.c:1628:14: error: ‘reg_value’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
*out_value = reg_value;
^cc1: all warnings being treated as errorsscripts/Makefile.build:294: recipe for target 'drivers/gpu/drm/i915/intel_uncore.o' failed make[4]: *** [drivers/gpu/drm/i915/intel_uncore.o] Error 1 scripts/Makefile.build:553: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2scripts/Makefile.build:553: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2scripts/Makefile.build:553: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:1002: recipe for target 'drivers' failed
make: *** [drivers] Error 2
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 5 lines · Daniel Vetter
The unconditionally fallback to the blocking
wait_forresulted in impressive fireworks at boot-up on my snb here. Make sure if we set the slow timeout to 0 that we never ever sleep. The tail of the callchain was
Quoted 8 lines
intel_wait_for_register
->__intel_wait_for_register_fw
->usleep_range-> BOOMIt blew up in
intel_crt_detectload detection code on theADPA_CRT_HOTPLUG_FORCE_TRIGGERin the ADPA register.
Hmm, by reading the code, it looks that call stack should be like this:
-> intel_wait_for_register(..., timeout_ms=1000)
-> __intel_wait_for_register_fw(..., fast_us=2, slow_ms=0, NULL); -> wait_for(..., MS=1000)
-> _wait_for(..., US=1000*1000, W=1000)
-> usleep_range(W, 2*W)so the slow_timeout_ms will be 0 in __intel_wait_for_register_fw()
Are you sure that fix below is in right place?
-Michal
Quoted 29 lines
Fixes 0564654340e2 ("drm/i915: Acquire uncore.lock over intel_uncore_wait_for_register()")Cc Chris Wilson <[email protected]>Cc Michal Wajdeczko <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Tvrtko Ursulin <[email protected]>Cc Daniel Vetter <[email protected]>Cc Jani Nikula <[email protected]>Reviewed-by Chris Wilson <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/intel_uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_uncore.c +1
-1@@ -1609,7 +1609,7 @@ int __intel_wait_for_register_fw(struct drm_i915_private *dev_priv, ret = -ETIMEDOUT ;if (fast_timeout_us && fast_timeout_us <=20000 ) ret =_wait_for_atomic (done, fast_timeout_us,0 ); -if (ret) +if (ret && slow_timeout_ms) ret =wait_for (done, slow_timeout_ms);if (out_value)Signature · 1 line
2.5.5
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 20 lines · Michal Wajdeczko
Quoted 5 lines · Daniel Vetter
The unconditionally fallback to the blocking
wait_forresulted in impressive fireworks at boot-up on my snb here. Make sure if we set the slow timeout to 0 that we never ever sleep. The tail of the callchain wasQuoted 8 lines
intel_wait_for_register
->__intel_wait_for_register_fw
->usleep_range-> BOOMIt blew up in
intel_crt_detectload detection code on theADPA_CRT_HOTPLUG_FORCE_TRIGGERin the ADPA register.Hmm, by reading the code, it looks that call stack should be like this:
->
intel_wait_for_register(..., timeout_ms=1000)
->__intel_wait_for_register_fw(..., fast_us=2, slow_ms=0, NULL); ->wait_for(..., MS=1000)
Quoted 6 lines
-> _wait_for(..., US=1000*1000, W=1000) -> usleep_range(W, 2*W)so the
slow_timeout_mswill be 0 in__intel_wait_for_register_fw()Are you sure that fix below is in right place?
The wait_for is _within the __intel_wait_for_register_fw. I've left out the macros because those don't show up in the bt. We do _not_ blow up on the wait_for after the __intel_wait_for_register_fw call in intel_wait_for_register.
-Daniel
Quoted 34 lines
-Michal
Quoted 29 lines
Fixes 0564654340e2 ("drm/i915: Acquire uncore.lock over intel_uncore_wait_for_register()")Cc Chris Wilson <[email protected]>Cc Michal Wajdeczko <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Tvrtko Ursulin <[email protected]>Cc Daniel Vetter <[email protected]>Cc Jani Nikula <[email protected]>Reviewed-by Chris Wilson <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/intel_uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_uncore.c +1
-1@@ -1609,7 +1609,7 @@ int __intel_wait_for_register_fw(struct drm_i915_private *dev_priv, ret = -ETIMEDOUT ;if (fast_timeout_us && fast_timeout_us <=20000 ) ret =_wait_for_atomic (done, fast_timeout_us,0 ); -if (ret) +if (ret && slow_timeout_ms) ret =wait_for (done, slow_timeout_ms);if (out_value)Signature · 1 line
2.5.5
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 24 lines · Daniel Vetter
Quoted 23 lines · Michal Wajdeczko
Quoted 5 lines · Daniel Vetter
The unconditionally fallback to the blocking
wait_forresulted in impressive fireworks at boot-up on my snb here. Make sure if we set the slow timeout to 0 that we never ever sleep. The tail of the callchain wasQuoted 8 lines
intel_wait_for_register
->__intel_wait_for_register_fw
->usleep_range-> BOOMIt blew up in
intel_crt_detectload detection code on theADPA_CRT_HOTPLUG_FORCE_TRIGGERin the ADPA register.Hmm, by reading the code, it looks that call stack should be like this:
->
intel_wait_for_register(..., timeout_ms=1000)
->__intel_wait_for_register_fw(..., fast_us=2, slow_ms=0, NULL); ->wait_for(..., MS=1000)-> _wait_for(..., US=1000*1000, W=1000) -> usleep_range(W, 2*W)
Quoted 8 lines
Quoted 3 lines
so the
slow_timeout_mswill be 0 in__intel_wait_for_register_fw()Are you sure that fix below is in right place?
The
wait_foris_withinthe__intel_wait_for_register_fw. I've left out the macros because those don't show up in the bt. We do _not_ blow up on thewait_forafter the__intel_wait_for_register_fwcall inintel_wait_for_register.
Ok, so the correct call stack is
-> intel_wait_for_register(..., timeout_ms=1000)
-> __intel_wait_for_register_fw(..., fast_us=2, slow_ms=0, NULL);
-> wait_for(..., MS=0)
-> _wait_for(..., US=0, W=1000)
-> usleep_range(W, 2*W)so maybe we should just fix the wait_for/_wait_for macros and do not attempt to sleep when timeout is zero ? It's rather unexpected that even with with timeout MS=0 we will still call usleep_range(1000us, 2000us)
-Michal
Quoted 32 lines
-Daniel
Quoted 30 lines
-Michal
Quoted 25 lines
Fixes 0564654340e2 ("drm/i915: Acquire uncore.lock over intel_uncore_wait_for_register()")Cc Chris Wilson <[email protected]>Cc Michal Wajdeczko <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Tvrtko Ursulin <[email protected]>Cc Daniel Vetter <[email protected]>Cc Jani Nikula <[email protected]>Reviewed-by Chris Wilson <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/intel_uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_uncore.c +1
-1@@ -1609,7 +1609,7 @@ int __intel_wait_for_register_fw(struct drm_i915_private *dev_priv, ret = -ETIMEDOUT ;if (fast_timeout_us && fast_timeout_us <=20000 ) ret =_wait_for_atomic (done, fast_timeout_us,0 ); -if (ret) +if (ret && slow_timeout_ms) ret =wait_for (done, slow_timeout_ms);
Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_uncore.c +0
-0if (out_value)Signature · 1 line
2.5.5Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 37 lines · Michal Wajdeczko
Quoted 24 lines · Daniel Vetter
Quoted 23 lines · Michal Wajdeczko
Quoted 5 lines · Daniel Vetter
The unconditionally fallback to the blocking
wait_forresulted in impressive fireworks at boot-up on my snb here. Make sure if we set the slow timeout to 0 that we never ever sleep. The tail of the callchain wasQuoted 8 lines
intel_wait_for_register
->__intel_wait_for_register_fw
->usleep_range-> BOOMIt blew up in
intel_crt_detectload detection code on theADPA_CRT_HOTPLUG_FORCE_TRIGGERin the ADPA register.Hmm, by reading the code, it looks that call stack should be like this:
->
intel_wait_for_register(..., timeout_ms=1000)
->__intel_wait_for_register_fw(..., fast_us=2, slow_ms=0, NULL); ->wait_for(..., MS=1000)-> _wait_for(..., US=1000*1000, W=1000) -> usleep_range(W, 2*W)Quoted 8 lines
Quoted 3 lines
so the
slow_timeout_mswill be 0 in__intel_wait_for_register_fw()Are you sure that fix below is in right place?
The
wait_foris_withinthe__intel_wait_for_register_fw. I've left out the macros because those don't show up in the bt. We do _not_ blow up on thewait_forafter the__intel_wait_for_register_fwcall inintel_wait_for_register.Ok, so the correct call stack is
->
intel_wait_for_register(..., timeout_ms=1000)
Quoted 8 lines
-> __intel_wait_for_register_fw(..., fast_us=2, slow_ms=0, NULL); -> wait_for(..., MS=0) -> _wait_for(..., US=0, W=1000) -> usleep_range(W, 2*W)so maybe we should just fix the wait_for/_wait_for macros and do not attempt to sleep when timeout is zero ? It's rather unexpected that even with with timeout MS=0 we will still call
usleep_range(1000us, 2000us)
In this case, it was clearly incorrect to do a wait_for_pass at all. In general, those wait_for macros are already complicated enough and the callers of wait_for() must reasonably expect it to sleep and so a seperate dance for timeout==0 seems unjustified.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 43 lines · Chris Wilson
Quoted 42 lines · Michal Wajdeczko
Quoted 24 lines · Daniel Vetter
Quoted 23 lines · Michal Wajdeczko
Quoted 5 lines · Daniel Vetter
The unconditionally fallback to the blocking
wait_forresulted in impressive fireworks at boot-up on my snb here. Make sure if we set the slow timeout to 0 that we never ever sleep. The tail of the callchain wasQuoted 8 lines
intel_wait_for_register
->__intel_wait_for_register_fw
->usleep_range-> BOOMIt blew up in
intel_crt_detectload detection code on theADPA_CRT_HOTPLUG_FORCE_TRIGGERin the ADPA register.Hmm, by reading the code, it looks that call stack should be like this:
->
intel_wait_for_register(..., timeout_ms=1000)
->__intel_wait_for_register_fw(..., fast_us=2, slow_ms=0, NULL); ->wait_for(..., MS=1000)-> _wait_for(..., US=1000*1000, W=1000) -> usleep_range(W, 2*W)Quoted 8 lines
Quoted 3 lines
so the
slow_timeout_mswill be 0 in__intel_wait_for_register_fw()Are you sure that fix below is in right place?
The
wait_foris_withinthe__intel_wait_for_register_fw. I've left out the macros because those don't show up in the bt. We do _not_ blow up on thewait_forafter the__intel_wait_for_register_fwcall inintel_wait_for_register.Ok, so the correct call stack is
->
intel_wait_for_register(..., timeout_ms=1000)-> __intel_wait_for_register_fw(..., fast_us=2, slow_ms=0, NULL); -> wait_for(..., MS=0) -> _wait_for(..., US=0, W=1000) -> usleep_range(W, 2*W)
Quoted 6 lines
Quoted 3 lines
so maybe we should just fix the wait_for/_wait_for macros and do not attempt to sleep when timeout is zero ? It's rather unexpected that even with with timeout MS=0 we will still call
usleep_range(1000us, 2000us)In this case, it was clearly incorrect to do a
wait_for_passat all. In general, thosewait_formacros are already complicated enough and the
Maybe no extra dance is needed, just this:
#define _wait_for(COND, US, W) ({ \
- unsigned long timeout__ = jiffies + usecs_to_jiffies(US) + 1; \
+ unsigned long timeout__ = jiffies + usecs_to_jiffies(US); \
int ret__; \
for (;;) { \
bool expired__ = time_after(jiffies, timeout__); \-Michal
Quoted 6 lines
callers of
wait_for()must reasonably expect it to sleep and so a seperate dance for timeout==0 seems unjustified.
-ChrisSignature · 1 line
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx