• Chris Wilson's avatar
    drm/i915/execlists: Check preempt-timeout target before submit_ports · 68ace460
    Chris Wilson authored
    We evaluate *active, which is a pointer into execlists->inflight[]
    during dequeue to decide how long a preempt-timeout we need to apply.
    However, as soon as we do the submit_ports, the HW may send its ACK
    interrupt causing us to promote execlists->pending[] tp
    execlists->inflight[], overwriting the value of *active. We know *active
    is only stable until we submit (as we only submit when there is no
    pending promotion).
    
    [   16.102328] BUG: KCSAN: data-race in execlists_dequeue+0x1449/0x1600 [i915]
    [   16.102356]
    [   16.102375] race at unknown origin, with read to 0xffff8881e9500488 of 8 bytes by task 429 on cpu 1:
    [   16.102780]  execlists_dequeue+0x1449/0x1600 [i915]
    [   16.103160]  __execlists_submission_tasklet+0x48/0x60 [i915]
    [   16.103540]  execlists_submit_request+0x38e/0x3c0 [i915]
    [   16.103940]  submit_notify+0x8f/0xc0 [i915]
    [   16.104308]  __i915_sw_fence_complete+0x61/0x420 [i915]
    [   16.104683]  i915_sw_fence_complete+0x58/0x80 [i915]
    [   16.105054]  i915_sw_fence_commit+0x16/0x20 [i915]
    [   16.105457]  __i915_request_queue+0x60/0x70 [i915]
    [   16.105843]  i915_gem_do_execbuffer+0x2d6b/0x4230 [i915]
    [   16.106227]  i915_gem_execbuffer2_ioctl+0x2b0/0x580 [i915]
    [   16.106257]  drm_ioctl_kernel+0xe9/0x130
    [   16.106279]  drm_ioctl+0x27d/0x45e
    [   16.106311]  ksys_ioctl+0x89/0xb0
    [   16.106336]  __x64_sys_ioctl+0x42/0x60
    [   16.106370]  do_syscall_64+0x6e/0x2c0
    [   16.106397]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
    Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20200426094231.21995-1-chris@chris-wilson.co.uk
    68ace460
intel_lrc.c 158 KB