• Daniel Jurgens's avatar
    IB/core: Don't register each MAD agent for LSM notifier · c66f6741
    Daniel Jurgens authored
    When creating many MAD agents in a short period of time, receive packet
    processing can be delayed long enough to cause timeouts while new agents
    are being added to the atomic notifier chain with IRQs disabled.  Notifier
    chain registration and unregstration is an O(n) operation. With large
    numbers of MAD agents being created and destroyed simultaneously the CPUs
    spend too much time with interrupts disabled.
    
    Instead of each MAD agent registering for it's own LSM notification,
    maintain a list of agents internally and register once, this registration
    already existed for handling the PKeys. This list is write mostly, so a
    normal spin lock is used vs a read/write lock. All MAD agents must be
    checked, so a single list is used instead of breaking them down per
    device.
    
    Notifier calls are done under rcu_read_lock, so there isn't a risk of
    similar packet timeouts while checking the MAD agents security settings
    when notified.
    Signed-off-by: default avatarDaniel Jurgens <danielj@mellanox.com>
    Reviewed-by: default avatarParav Pandit <parav@mellanox.com>
    Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
    Acked-by: default avatarPaul Moore <paul@paul-moore.com>
    Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
    c66f6741
device.c 37.4 KB