Skip to content

Commit 7576c4c

Browse files
committed
drm/nouveau: chan: provide nouveau_channel_kill()
The new VM_BIND UAPI implementation introduced in subsequent commits will allow asynchronous jobs processing push buffers and emitting fences. If a job times out, we need a way to recover from this situation. For now, simply kill the channel to unblock all hung up jobs and signal userspace that the device is dead on the next EXEC or VM_BIND ioctl. Reviewed-by: Dave Airlie <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent f124eef commit 7576c4c

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

drivers/gpu/drm/nouveau/nouveau_chan.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,24 @@ MODULE_PARM_DESC(vram_pushbuf, "Create DMA push buffers in VRAM");
4040
int nouveau_vram_pushbuf;
4141
module_param_named(vram_pushbuf, nouveau_vram_pushbuf, int, 0400);
4242

43+
void
44+
nouveau_channel_kill(struct nouveau_channel *chan)
45+
{
46+
atomic_set(&chan->killed, 1);
47+
if (chan->fence)
48+
nouveau_fence_context_kill(chan->fence, -ENODEV);
49+
}
50+
4351
static int
4452
nouveau_channel_killed(struct nvif_event *event, void *repv, u32 repc)
4553
{
4654
struct nouveau_channel *chan = container_of(event, typeof(*chan), kill);
4755
struct nouveau_cli *cli = (void *)chan->user.client;
4856

4957
NV_PRINTK(warn, cli, "channel %d killed!\n", chan->chid);
50-
atomic_set(&chan->killed, 1);
51-
if (chan->fence)
52-
nouveau_fence_context_kill(chan->fence, -ENODEV);
58+
59+
if (unlikely(!atomic_read(&chan->killed)))
60+
nouveau_channel_kill(chan);
5361

5462
return NVIF_EVENT_DROP;
5563
}

drivers/gpu/drm/nouveau/nouveau_chan.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ int nouveau_channel_new(struct nouveau_drm *, struct nvif_device *, bool priv,
6666
u32 vram, u32 gart, struct nouveau_channel **);
6767
void nouveau_channel_del(struct nouveau_channel **);
6868
int nouveau_channel_idle(struct nouveau_channel *);
69+
void nouveau_channel_kill(struct nouveau_channel *);
6970

7071
extern int nouveau_vram_pushbuf;
7172

0 commit comments

Comments
 (0)