• Neil Horman's avatar
    bnx2fc: Improve stats update mechanism · d576a5e8
    Neil Horman authored
    Recently had this warning reported:
    
    [  290.489047] Call Trace:
    [  290.489053]  [<ffffffff8169efec>] dump_stack+0x19/0x1b
    [  290.489055]  [<ffffffff810ac7a9>] __might_sleep+0x179/0x230
    [  290.489057]  [<ffffffff816a4ad5>] mutex_lock_nested+0x55/0x520
    [  290.489061]  [<ffffffffa01b9905>] ? bnx2fc_l2_rcv_thread+0xc5/0x4c0 [bnx2fc]
    [  290.489065]  [<ffffffffa0174c1a>] fc_vport_id_lookup+0x3a/0xa0 [libfc]
    [  290.489068]  [<ffffffffa01b9a6c>] bnx2fc_l2_rcv_thread+0x22c/0x4c0 [bnx2fc]
    [  290.489070]  [<ffffffffa01b9840>] ? bnx2fc_vport_destroy+0x110/0x110 [bnx2fc]
    [  290.489073]  [<ffffffff8109e0cd>] kthread+0xed/0x100
    [  290.489075]  [<ffffffff8109dfe0>] ? insert_kthread_work+0x80/0x80
    [  290.489077]  [<ffffffff816b2fec>] ret_from_fork+0x7c/0xb0
    [  290.489078]  [<ffffffff8109dfe0>] ? insert_kthread_work+0x80/0x80
    
    Its due to the fact that we call a potentially sleeping function from the bnx2fc
    rcv path with preemption disabled (via the get_cpu call embedded in the per-cpu
    variable stats lookup in bnx2fc_l2_rcv_thread.
    
    Easy enough fix, we can just move the stats collection later in the function
    where we are sure we won't preempt or sleep.  This also allows us to not have to
    enable pre-emption when doing a per-cpu lookup, since we're certain not to get
    rescheduled.
    Signed-off-by: default avatarNeil Horman <nhorman@tuxdriver.com>
    Acked-by: default avatarEddie Wai <eddie.wai@broadcom.com>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    d576a5e8
bnx2fc_fcoe.c 71.7 KB