@@ -50,24 +50,14 @@ nouveau_fctx(struct nouveau_fence *fence)
50
50
return container_of (fence -> base .lock , struct nouveau_fence_chan , lock );
51
51
}
52
52
53
- static int
53
+ static void
54
54
nouveau_fence_signal (struct nouveau_fence * fence )
55
55
{
56
- int drop = 0 ;
57
-
58
56
dma_fence_signal_locked (& fence -> base );
59
57
list_del (& fence -> head );
60
58
rcu_assign_pointer (fence -> channel , NULL );
61
59
62
- if (test_bit (DMA_FENCE_FLAG_USER_BITS , & fence -> base .flags )) {
63
- struct nouveau_fence_chan * fctx = nouveau_fctx (fence );
64
-
65
- if (atomic_dec_and_test (& fctx -> notify_ref ))
66
- drop = 1 ;
67
- }
68
-
69
60
dma_fence_put (& fence -> base );
70
- return drop ;
71
61
}
72
62
73
63
static struct nouveau_fence *
@@ -93,8 +83,7 @@ nouveau_fence_context_kill(struct nouveau_fence_chan *fctx, int error)
93
83
if (error )
94
84
dma_fence_set_error (& fence -> base , error );
95
85
96
- if (nouveau_fence_signal (fence ))
97
- nvif_event_block (& fctx -> event );
86
+ nouveau_fence_signal (fence );
98
87
}
99
88
fctx -> killed = 1 ;
100
89
spin_unlock_irqrestore (& fctx -> lock , flags );
@@ -103,8 +92,8 @@ nouveau_fence_context_kill(struct nouveau_fence_chan *fctx, int error)
103
92
void
104
93
nouveau_fence_context_del (struct nouveau_fence_chan * fctx )
105
94
{
106
- cancel_work_sync (& fctx -> allow_block_work );
107
95
nouveau_fence_context_kill (fctx , 0 );
96
+ nvif_event_block (& fctx -> event );
108
97
nvif_event_dtor (& fctx -> event );
109
98
fctx -> dead = 1 ;
110
99
@@ -127,11 +116,10 @@ nouveau_fence_context_free(struct nouveau_fence_chan *fctx)
127
116
kref_put (& fctx -> fence_ref , nouveau_fence_context_put );
128
117
}
129
118
130
- static int
119
+ static void
131
120
nouveau_fence_update (struct nouveau_channel * chan , struct nouveau_fence_chan * fctx )
132
121
{
133
122
struct nouveau_fence * fence ;
134
- int drop = 0 ;
135
123
u32 seq = fctx -> read (chan );
136
124
137
125
while (!list_empty (& fctx -> pending )) {
@@ -140,10 +128,8 @@ nouveau_fence_update(struct nouveau_channel *chan, struct nouveau_fence_chan *fc
140
128
if ((int )(seq - fence -> base .seqno ) < 0 )
141
129
break ;
142
130
143
- drop |= nouveau_fence_signal (fence );
131
+ nouveau_fence_signal (fence );
144
132
}
145
-
146
- return drop ;
147
133
}
148
134
149
135
static int
@@ -160,26 +146,13 @@ nouveau_fence_wait_uevent_handler(struct nvif_event *event, void *repv, u32 repc
160
146
161
147
fence = list_entry (fctx -> pending .next , typeof (* fence ), head );
162
148
chan = rcu_dereference_protected (fence -> channel , lockdep_is_held (& fctx -> lock ));
163
- if (nouveau_fence_update (chan , fctx ))
164
- ret = NVIF_EVENT_DROP ;
149
+ nouveau_fence_update (chan , fctx );
165
150
}
166
151
spin_unlock_irqrestore (& fctx -> lock , flags );
167
152
168
153
return ret ;
169
154
}
170
155
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
-
183
156
void
184
157
nouveau_fence_context_new (struct nouveau_channel * chan , struct nouveau_fence_chan * fctx )
185
158
{
@@ -191,7 +164,6 @@ nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_cha
191
164
} args ;
192
165
int ret ;
193
166
194
- INIT_WORK (& fctx -> allow_block_work , nouveau_fence_work_allow_block );
195
167
INIT_LIST_HEAD (& fctx -> flip );
196
168
INIT_LIST_HEAD (& fctx -> pending );
197
169
spin_lock_init (& fctx -> lock );
@@ -216,6 +188,12 @@ nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_cha
216
188
& args .base , sizeof (args ), & fctx -> event );
217
189
218
190
WARN_ON (ret );
191
+
192
+ /*
193
+ * Always allow non-stall irq events - previously this code tried to
194
+ * enable/disable them, but that just seems racy as nonstall irqs are unlatched.
195
+ */
196
+ nvif_event_allow (& fctx -> event );
219
197
}
220
198
221
199
int
@@ -247,8 +225,7 @@ nouveau_fence_emit(struct nouveau_fence *fence)
247
225
return - ENODEV ;
248
226
}
249
227
250
- if (nouveau_fence_update (chan , fctx ))
251
- nvif_event_block (& fctx -> event );
228
+ nouveau_fence_update (chan , fctx );
252
229
253
230
list_add_tail (& fence -> head , & fctx -> pending );
254
231
spin_unlock_irq (& fctx -> lock );
@@ -271,8 +248,8 @@ nouveau_fence_done(struct nouveau_fence *fence)
271
248
272
249
spin_lock_irqsave (& fctx -> lock , flags );
273
250
chan = rcu_dereference_protected (fence -> channel , lockdep_is_held (& fctx -> lock ));
274
- if (chan && nouveau_fence_update ( chan , fctx ) )
275
- nvif_event_block ( & fctx -> event );
251
+ if (chan )
252
+ nouveau_fence_update ( chan , fctx );
276
253
spin_unlock_irqrestore (& fctx -> lock , flags );
277
254
}
278
255
return dma_fence_is_signaled (& fence -> base );
@@ -530,32 +507,10 @@ static const struct dma_fence_ops nouveau_fence_ops_legacy = {
530
507
.release = nouveau_fence_release
531
508
};
532
509
533
- static bool nouveau_fence_enable_signaling (struct dma_fence * f )
534
- {
535
- struct nouveau_fence * fence = from_fence (f );
536
- struct nouveau_fence_chan * fctx = nouveau_fctx (fence );
537
- bool ret ;
538
- bool do_work ;
539
-
540
- if (atomic_inc_return (& fctx -> notify_ref ) == 0 )
541
- do_work = true;
542
-
543
- ret = nouveau_fence_no_signaling (f );
544
- if (ret )
545
- 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 );
551
-
552
- return ret ;
553
- }
554
-
555
510
static const struct dma_fence_ops nouveau_fence_ops_uevent = {
556
511
.get_driver_name = nouveau_fence_get_get_driver_name ,
557
512
.get_timeline_name = nouveau_fence_get_timeline_name ,
558
- .enable_signaling = nouveau_fence_enable_signaling ,
513
+ .enable_signaling = nouveau_fence_no_signaling ,
559
514
.signaled = nouveau_fence_is_signaled ,
560
515
.release = nouveau_fence_release
561
516
};
0 commit comments