@@ -42,7 +42,6 @@ struct kfd_smi_client {
42
42
struct rcu_head rcu ;
43
43
pid_t pid ;
44
44
bool suser ;
45
- u32 drop_count ;
46
45
};
47
46
48
47
#define KFD_MAX_KFIFO_SIZE 8192
@@ -104,28 +103,12 @@ static ssize_t kfd_smi_ev_read(struct file *filep, char __user *user,
104
103
}
105
104
to_copy = min (size , to_copy );
106
105
ret = kfifo_out (& client -> fifo , buf , to_copy );
106
+ spin_unlock (& client -> lock );
107
107
if (ret <= 0 ) {
108
- spin_unlock (& client -> lock );
109
108
ret = - EAGAIN ;
110
109
goto ret_err ;
111
110
}
112
111
113
- if (client -> drop_count ) {
114
- char msg [KFD_SMI_EVENT_MSG_SIZE ];
115
- int len ;
116
-
117
- len = snprintf (msg , sizeof (msg ), "%x " , KFD_SMI_EVENT_DROPPED_EVENT );
118
- len += snprintf (msg + len , sizeof (msg ) - len ,
119
- KFD_EVENT_FMT_DROPPED_EVENT (ktime_get_boottime_ns (),
120
- client -> pid , client -> drop_count ));
121
- if (kfifo_avail (& client -> fifo ) >= len ) {
122
- kfifo_in (& client -> fifo , msg , len );
123
- client -> drop_count = 0 ;
124
- }
125
- }
126
-
127
- spin_unlock (& client -> lock );
128
-
129
112
ret = copy_to_user (user , buf , to_copy );
130
113
if (ret ) {
131
114
ret = - EFAULT ;
@@ -199,15 +182,13 @@ static void add_event_to_kfifo(pid_t pid, struct kfd_node *dev,
199
182
list_for_each_entry_rcu (client , & dev -> smi_clients , list ) {
200
183
if (!kfd_smi_ev_enabled (pid , client , smi_event ))
201
184
continue ;
202
-
203
185
spin_lock (& client -> lock );
204
- if (! client -> drop_count && kfifo_avail (& client -> fifo ) >= len ) {
186
+ if (kfifo_avail (& client -> fifo ) >= len ) {
205
187
kfifo_in (& client -> fifo , event_msg , len );
206
188
wake_up_all (& client -> wait_queue );
207
189
} else {
208
- client -> drop_count ++ ;
209
- pr_debug ("smi_event(EventID: %u): no space left drop_count %d\n" ,
210
- smi_event , client -> drop_count );
190
+ pr_debug ("smi_event(EventID: %u): no space left\n" ,
191
+ smi_event );
211
192
}
212
193
spin_unlock (& client -> lock );
213
194
}
0 commit comments