]> asedeno.scripts.mit.edu Git - linux.git/commit
IB/core: Let IB core distribute cache update events
authorParav Pandit <parav@mellanox.com>
Thu, 12 Dec 2019 11:30:22 +0000 (13:30 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 8 Jan 2020 00:18:10 +0000 (20:18 -0400)
commit6b57cea9221b0247ad5111b348522625e489a8e4
tree18f23c2313210f83c6ea1b47ffd9c58656d56c28
parent4cca96a8d9da0ed8217cfdf2aec0c3c8b88e8911
IB/core: Let IB core distribute cache update events

Currently when the low level driver notifies Pkey, GID, and port change
events they are notified to the registered handlers in the order they are
registered.

IB core and other ULPs such as IPoIB are interested in GID, LID, Pkey
change events.

Since all GID queries done by ULPs are serviced by IB core, and the IB
core deferes cache updates to a work queue, it is possible for other
clients to see stale cache data when they handle their own events.

For example, the below call tree shows how ipoib will call
rdma_query_gid() concurrently with the update to the cache sitting in the
WQ.

mlx5_ib_handle_event()
  ib_dispatch_event()
    ib_cache_event()
       queue_work() -> slow cache update

    [..]
    ipoib_event()
     queue_work()
       [..]
       work handler
         ipoib_ib_dev_flush_light()
           __ipoib_ib_dev_flush()
              ipoib_dev_addr_changed_valid()
                rdma_query_gid() <- Returns old GID, cache not updated.

Move all the event dispatch to a work queue so that the cache update is
always done before any clients are notified.

Fixes: f35faa4ba956 ("IB/core: Simplify ib_query_gid to always refer to cache")
Link: https://lore.kernel.org/r/20191212113024.336702-3-leon@kernel.org
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/cache.c
drivers/infiniband/core/core_priv.h
drivers/infiniband/core/device.c
include/rdma/ib_verbs.h