On Sun, Oct 20, 2019 at 09:54:25AM +0300, Leon Romanovsky wrote: > diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c > index 2f89c4d64b73..e9ab1289c224 100644 > +++ b/drivers/infiniband/core/device.c > @@ -1951,15 +1951,7 @@ void ib_unregister_event_handler(struct ib_event_handler *event_handler) > } > EXPORT_SYMBOL(ib_unregister_event_handler); > > -/** > - * ib_dispatch_event - Dispatch an asynchronous event > - * @event:Event to dispatch > - * > - * Low-level drivers must call ib_dispatch_event() to dispatch the > - * event to all registered event handlers when an asynchronous event > - * occurs. > - */ > -void ib_dispatch_event(struct ib_event *event) > +void ib_dispatch_cache_event_clients(struct ib_event *event) > { no kdoc for this? > unsigned long flags; > struct ib_event_handler *handler; > @@ -1971,6 +1963,22 @@ void ib_dispatch_event(struct ib_event *event) > > spin_unlock_irqrestore(&event->device->event_handler_lock, flags); > } > + > +/** > + * ib_dispatch_event - Dispatch an asynchronous event > + * @event:Event to dispatch > + * > + * Low-level drivers must call ib_dispatch_event() to dispatch the > + * event to all registered event handlers when an asynchronous event > + * occurs. > + */ > +void ib_dispatch_event(struct ib_event *event) > +{ > + if (ib_is_cache_update_event(event)) > + ib_enqueue_cache_update_event(event); > + else > + ib_dispatch_cache_event_clients(event); > +} > EXPORT_SYMBOL(ib_dispatch_event); It seems like there is now some big mess here, many of the users of events, including cache, acctually do need a blocking context to do their work, while this function is supposed to be atomic context for the driver. So, after this change, many event types are now guarenteed to be called from a blocking context in a WQ - but we still go ahead and do silly things like launch more work to get into blocking contexts from the other users Thus I'm wondering if this wouldn't be better off just always pushing events into a wq and running the notifier subscriptions sequentially? Jason