Skip to content

Commit ccfdbaa

Browse files
committed
RDMA/uverbs: Move IB_EVENT_DEVICE_FATAL to destroy_uobj
When multiple async FDs were allowed to exist the idea was for all broadcast events to be delivered to all async FDs, however IB_EVENT_DEVICE_FATAL was missed. Instead of having ib_uverbs_free_hw_resources() special case the global async_fd, have it cause the event during the uobject destruction. Every async fd is now a uobject so simply generate the IB_EVENT_DEVICE_FATAL while destroying the async fd uobject. This ensures every async FD gets a copy of the event. Fixes: d680e88 ("RDMA/core: Add UVERBS_METHOD_ASYNC_EVENT_ALLOC") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Yishai Hadas <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent c485b19 commit ccfdbaa

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

drivers/infiniband/core/uverbs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ void ib_uverbs_release_ucq(struct ib_uverbs_completion_event_file *ev_file,
228228
struct ib_ucq_object *uobj);
229229
void ib_uverbs_release_uevent(struct ib_uevent_object *uobj);
230230
void ib_uverbs_release_file(struct kref *ref);
231+
void ib_uverbs_async_handler(struct ib_uverbs_async_event_file *async_file,
232+
__u64 element, __u64 event,
233+
struct list_head *obj_list, u32 *counter);
231234

232235
void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context);
233236
void ib_uverbs_cq_event_handler(struct ib_event *event, void *context_ptr);

drivers/infiniband/core/uverbs_main.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,9 @@ void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context)
386386
kill_fasync(&ev_queue->async_queue, SIGIO, POLL_IN);
387387
}
388388

389-
static void
390-
ib_uverbs_async_handler(struct ib_uverbs_async_event_file *async_file,
391-
__u64 element, __u64 event, struct list_head *obj_list,
392-
u32 *counter)
389+
void ib_uverbs_async_handler(struct ib_uverbs_async_event_file *async_file,
390+
__u64 element, __u64 event,
391+
struct list_head *obj_list, u32 *counter)
393392
{
394393
struct ib_uverbs_event *entry;
395394
unsigned long flags;
@@ -1187,9 +1186,6 @@ static void ib_uverbs_free_hw_resources(struct ib_uverbs_device *uverbs_dev,
11871186
*/
11881187
mutex_unlock(&uverbs_dev->lists_mutex);
11891188

1190-
ib_uverbs_async_handler(READ_ONCE(file->async_file), 0,
1191-
IB_EVENT_DEVICE_FATAL, NULL, NULL);
1192-
11931189
uverbs_destroy_ufile_hw(file, RDMA_REMOVE_DRIVER_REMOVE);
11941190
kref_put(&file->ref, ib_uverbs_release_file);
11951191

drivers/infiniband/core/uverbs_std_types_async_fd.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ static int uverbs_async_event_destroy_uobj(struct ib_uobject *uobj,
2626
container_of(uobj, struct ib_uverbs_async_event_file, uobj);
2727

2828
ib_unregister_event_handler(&event_file->event_handler);
29+
30+
if (why == RDMA_REMOVE_DRIVER_REMOVE)
31+
ib_uverbs_async_handler(event_file, 0, IB_EVENT_DEVICE_FATAL,
32+
NULL, NULL);
2933
return 0;
3034
}
3135

0 commit comments

Comments
 (0)