Skip to content

Commit 6ad2a66

Browse files
vsyrjalajlahtine-intel
authored andcommitted
drm/i915: Order OP vs. timeout correctly in __wait_for()
Put the barrier() before the OP so that anything we read out in OP and check in COND will actually be read out after the timeout has been evaluated. Currently the only place where we use OP is __intel_wait_for_register(), but the use there is precisely susceptible to this reordering, assuming the ktime_*() stuff itself doesn't act as a sufficient barrier: __intel_wait_for_register(...) { ... ret = __wait_for(reg_value = intel_uncore_read_notrace(...), (reg_value & mask) == value, ...); ... } Cc: [email protected] Fixes: 1c3c1dc ("drm/i915: Add compiler barrier to wait_for") Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patch.msgid.link/[email protected] Reviewed-by: Jani Nikula <[email protected]> (cherry picked from commit a464bac) Signed-off-by: Joonas Lahtinen <[email protected]>
1 parent 08441f1 commit 6ad2a66

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/gpu/drm/i915/i915_wait_util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
might_sleep(); \
2626
for (;;) { \
2727
const bool expired__ = ktime_after(ktime_get_raw(), end__); \
28-
OP; \
2928
/* Guarantee COND check prior to timeout */ \
3029
barrier(); \
30+
OP; \
3131
if (COND) { \
3232
ret__ = 0; \
3333
break; \

0 commit comments

Comments
 (0)