Re: [PATCH v4] drm/i915: Synchronize active and retire callbacks

From: Sultan Alsawaf
Date: Tue Apr 14 2020 - 10:43:36 EST


On Tue, Apr 14, 2020 at 09:23:56AM +0100, Chris Wilson wrote:
> Quoting Sultan Alsawaf (2020-04-14 07:13:12)
> > Chris,
> >
> > Could you please take a look at this? This really is quite an important fix.
>
> It's crazy. See a266bf420060 for a patch that should be applied to v5.4
> -Chris

What? a266bf420060 was part of 5.4.0-rc7, so it's already in 5.4. And if you
read the commit message, you would see that the problem in question affects
Linus' tree.

You can break i915 in 5.6 by just adding a small delay:

diff --git a/drivers/gpu/drm/i915/gt/intel_ring.c b/drivers/gpu/drm/i915/gt/intel_ring.c
index 6ff803f397c4..3a7968effdfd 100644
--- a/drivers/gpu/drm/i915/gt/intel_ring.c
+++ b/drivers/gpu/drm/i915/gt/intel_ring.c
@@ -10,6 +10,7 @@
#include "intel_engine.h"
#include "intel_ring.h"
#include "intel_timeline.h"
+#include <linux/delay.h>

unsigned int intel_ring_update_space(struct intel_ring *ring)
{
@@ -92,6 +93,9 @@ void intel_ring_unpin(struct intel_ring *ring)
else
i915_gem_object_unpin_map(vma->obj);

+ mdelay(1);
+ ring->vaddr = NULL;
+
i915_vma_make_purgeable(vma);
i915_vma_unpin(vma);
}

This is how I reproduced the race in question. I can't even reach the greeter on
my laptop with this, because i915 dies before that.

Sultan