[PATCH v2] drm/i915: Do not disable preemption for resets

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Wed Sep 27 10:44:31 UTC 2023


On 26/09/2023 11:26, Andi Shyti wrote:
> Hi Tvrtko,
> 
> On Tue, Sep 26, 2023 at 11:08:55AM +0100, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>>
>> Commit ade8a0f59844 ("drm/i915: Make all GPU resets atomic") added a
>> preempt disable section over the hardware reset callback to prepare the
>> driver for being able to reset from atomic contexts.
>>
>> In retrospect I can see that the work item at a time was about removing
>> the struct mutex from the reset path. Code base also briefly entertained
>> the idea of doing the reset under stop_machine in order to serialize
>> userspace mmap and temporary glitch in the fence registers (see
>> eb8d0f5af4ec ("drm/i915: Remove GPU reset dependence on struct_mutex"),
>> but that never materialized and was soon removed in 2caffbf11762
>> ("drm/i915: Revoke mmaps and prevent access to fence registers across
>> reset") and replaced with a SRCU based solution.
>>
>> As such, as far as I can see, today we still have a requirement that
>> resets must not sleep (invoked from submission tasklets), but no need to
>> support invoking them from a truly atomic context.
>>
>> Given that the preemption section is problematic on RT kernels, since the
>> uncore lock becomes a sleeping lock and so is invalid in such section,
>> lets try and remove it. Potential downside is that our short waits on GPU
>> to complete the reset may get extended if CPU scheduling interferes, but
>> in practice that probably isn't a deal breaker.
>>
>> In terms of mechanics, since the preemption disabled block is being
>> removed we just need to replace a few of the wait_for_atomic macros into
>> busy looping versions which will work (and not complain) when called from
>> non-atomic sections.
>>
>> v2:
>>   * Fix timeouts which are now in us. (Andi)
>>   * Update one comment as a drive by. (Andi)
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>> Cc: Chris Wilson <chris.p.wilson at intel.com>
>> Cc: Paul Gortmaker <paul.gortmaker at windriver.com>
>> Cc: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
>> Cc: Andi Shyti <andi.shyti at linux.intel.com>
> 
> Reviewed-by: Andi Shyti <andi.shyti at linux.intel.com>

Thank you, pushed to drm-intel-gt-next!

Regards,

Tvrtko


More information about the dri-devel mailing list