Skip to content

Commit

Permalink
drm/nouveau/fifo/gf100-: protect channel preempt with subdev mutex
Browse files Browse the repository at this point in the history
This avoids an issue that occurs when we're attempting to preempt multiple
channels simultaneously.  HW seems to ignore preempt requests while it's
still processing a previous one, which, well, makes sense.

Fixes random "fifo: SCHED_ERROR 0d []" + GPCCS page faults during parallel
piglit runs on (at least) GM107.

Signed-off-by: Ben Skeggs <[email protected]>
Cc: [email protected]
  • Loading branch information
Ben Skeggs committed Nov 7, 2016
1 parent e137040 commit b27add1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 6 additions & 3 deletions drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogf100.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,20 @@ gf100_fifo_gpfifo_engine_fini(struct nvkm_fifo_chan *base,
struct nvkm_gpuobj *inst = chan->base.inst;
int ret = 0;

mutex_lock(&subdev->mutex);
nvkm_wr32(device, 0x002634, chan->base.chid);
if (nvkm_msec(device, 2000,
if (nvkm_rd32(device, 0x002634) == chan->base.chid)
break;
) < 0) {
nvkm_error(subdev, "channel %d [%s] kick timeout\n",
chan->base.chid, chan->base.object.client->name);
ret = -EBUSY;
if (suspend)
return ret;
ret = -ETIMEDOUT;
}
mutex_unlock(&subdev->mutex);

if (ret && suspend)
return ret;

if (offset) {
nvkm_kmap(inst);
Expand Down
8 changes: 5 additions & 3 deletions drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogk104.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,20 @@ gk104_fifo_gpfifo_kick(struct gk104_fifo_chan *chan)
struct nvkm_subdev *subdev = &fifo->base.engine.subdev;
struct nvkm_device *device = subdev->device;
struct nvkm_client *client = chan->base.object.client;
int ret = 0;

mutex_lock(&subdev->mutex);
nvkm_wr32(device, 0x002634, chan->base.chid);
if (nvkm_msec(device, 2000,
if (!(nvkm_rd32(device, 0x002634) & 0x00100000))
break;
) < 0) {
nvkm_error(subdev, "channel %d [%s] kick timeout\n",
chan->base.chid, client->name);
return -EBUSY;
ret = -ETIMEDOUT;
}

return 0;
mutex_unlock(&subdev->mutex);
return ret;
}

static u32
Expand Down

0 comments on commit b27add1

Please sign in to comment.