Re: [PREEMPT_RT PATCH 1/3] i915: do not call lockdep_assert_irqs_disabled() on PREEMPT_RT

From: Sebastian Andrzej Siewior
Date: Wed Sep 25 2019 - 12:47:17 EST


On 2019-08-19 19:33:17 [-0500], Clark Williams wrote:
> From: Clark Williams <williams@xxxxxxxxxx>
>
> The 'breadcrumb' code in the i915 driver calls lockdep_assert_irqs_disabled()
> when starting some operations. This is valid on a stock kernel
> but on a PREEMPT_RT kernel the spin_lock_irq*() calls to not disable
> interrupts and likewise the spin_unlock_irq*() calls to not enable interrupts.
>
> Conditionalize these calls based on whether PREEMPT_RT_FULL is enabled.
>
> Signed-off-by: Clark Williams <williams@xxxxxxxxxx>
> ---
> drivers/gpu/drm/i915/intel_breadcrumbs.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_breadcrumbs.c b/drivers/gpu/drm/i915/intel_breadcrumbs.c
> index 832cb6b1e9bd..3eef6010ebf6 100644
> --- a/drivers/gpu/drm/i915/intel_breadcrumbs.c
> +++ b/drivers/gpu/drm/i915/intel_breadcrumbs.c
> @@ -101,7 +101,8 @@ __dma_fence_signal__notify(struct dma_fence *fence)
> struct dma_fence_cb *cur, *tmp;
>
> lockdep_assert_held(fence->lock);
> - lockdep_assert_irqs_disabled();
> + if (!IS_ENABLED(CONFIG_PREEMPT_RT_FULL))
> + lockdep_assert_irqs_disabled();
>

Both asserts went in commit c36beba6b296b ("drm/i915: Seal races between
async GPU cancellation, retirement and signaling"). It looks like its
purpose is to ensure that ->lock is acquired and that interrupts are
also disabled because that lock is always acquired with disabled
interrupts. This isn't required, lockdep is clever enough to yell at you
if you manage to use it wrong.
Let me drop that lockdep_assert_irqs_disabled().

Sebastian