Skip to content

Commit 4d7acc8

Browse files
committed
Revert "nouveau: push event block/allowing out of the fence context"
This reverts commit eacabb5. This commit causes some regressions in desktop usage, this will reintroduce the original deadlock in DRI_PRIME situations, I've got an idea to fix it by offloading to a workqueue in a different spot, however this code has a race condition where we sometimes miss interrupts so I'd like to fix that as well. Cc: [email protected] Signed-off-by: Dave Airlie <[email protected]>
1 parent 9c4a112 commit 4d7acc8

File tree

2 files changed

+6
-27
lines changed

2 files changed

+6
-27
lines changed

drivers/gpu/drm/nouveau/nouveau_fence.c

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ nouveau_fence_signal(struct nouveau_fence *fence)
6262
if (test_bit(DMA_FENCE_FLAG_USER_BITS, &fence->base.flags)) {
6363
struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
6464

65-
if (atomic_dec_and_test(&fctx->notify_ref))
65+
if (!--fctx->notify_ref)
6666
drop = 1;
6767
}
6868

@@ -103,7 +103,6 @@ nouveau_fence_context_kill(struct nouveau_fence_chan *fctx, int error)
103103
void
104104
nouveau_fence_context_del(struct nouveau_fence_chan *fctx)
105105
{
106-
cancel_work_sync(&fctx->allow_block_work);
107106
nouveau_fence_context_kill(fctx, 0);
108107
nvif_event_dtor(&fctx->event);
109108
fctx->dead = 1;
@@ -168,18 +167,6 @@ nouveau_fence_wait_uevent_handler(struct nvif_event *event, void *repv, u32 repc
168167
return ret;
169168
}
170169

171-
static void
172-
nouveau_fence_work_allow_block(struct work_struct *work)
173-
{
174-
struct nouveau_fence_chan *fctx = container_of(work, struct nouveau_fence_chan,
175-
allow_block_work);
176-
177-
if (atomic_read(&fctx->notify_ref) == 0)
178-
nvif_event_block(&fctx->event);
179-
else
180-
nvif_event_allow(&fctx->event);
181-
}
182-
183170
void
184171
nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_chan *fctx)
185172
{
@@ -191,7 +178,6 @@ nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_cha
191178
} args;
192179
int ret;
193180

194-
INIT_WORK(&fctx->allow_block_work, nouveau_fence_work_allow_block);
195181
INIT_LIST_HEAD(&fctx->flip);
196182
INIT_LIST_HEAD(&fctx->pending);
197183
spin_lock_init(&fctx->lock);
@@ -535,19 +521,15 @@ static bool nouveau_fence_enable_signaling(struct dma_fence *f)
535521
struct nouveau_fence *fence = from_fence(f);
536522
struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
537523
bool ret;
538-
bool do_work;
539524

540-
if (atomic_inc_return(&fctx->notify_ref) == 0)
541-
do_work = true;
525+
if (!fctx->notify_ref++)
526+
nvif_event_allow(&fctx->event);
542527

543528
ret = nouveau_fence_no_signaling(f);
544529
if (ret)
545530
set_bit(DMA_FENCE_FLAG_USER_BITS, &fence->base.flags);
546-
else if (atomic_dec_and_test(&fctx->notify_ref))
547-
do_work = true;
548-
549-
if (do_work)
550-
schedule_work(&fctx->allow_block_work);
531+
else if (!--fctx->notify_ref)
532+
nvif_event_block(&fctx->event);
551533

552534
return ret;
553535
}

drivers/gpu/drm/nouveau/nouveau_fence.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#define __NOUVEAU_FENCE_H__
44

55
#include <linux/dma-fence.h>
6-
#include <linux/workqueue.h>
76
#include <nvif/event.h>
87

98
struct nouveau_drm;
@@ -46,9 +45,7 @@ struct nouveau_fence_chan {
4645
char name[32];
4746

4847
struct nvif_event event;
49-
struct work_struct allow_block_work;
50-
atomic_t notify_ref;
51-
int dead, killed;
48+
int notify_ref, dead, killed;
5249
};
5350

5451
struct nouveau_fence_priv {

0 commit comments

Comments
 (0)