• Ahmed S. Darwish's avatar
    scsi: qla4xxx: Remove in_interrupt() · a93c3835
    Ahmed S. Darwish authored
    qla4_82xx_crb_win_lock() spins on a certain hardware state until it's
    updated. At the end of each spin, if in_interrupt() is true, it does 20
    loops of cpu_relax(). Otherwise, it yields the CPU.
    
    The in_interrupt() macro is ill-defined as it does not provide what the
    name suggests, and it does not catch the intended use-case here.
    
    qla4_82xx_crb_win_lock() is always invoked with scsi_qla_host::hw_lock
    acquired, with disabled interrupts. If the caller is in process context, as
    in qla4_82xx_need_reset_handler(), then in_interrupt() will return false
    even though it is not allowed to call schedule().
    
    Remove the in_interrupt() check.
    
    Change qla4_82xx_crb_win_lock() specification to a purely atomic
    function. Mark it as static, remove its forward declaration, and move it
    above its callers. To avoid hammering the PCI bus while spinning, use a 10
    micro-second delay instead of cpu_relax().
    
    Link: https://lore.kernel.org/r/20201126132952.2287996-4-bigeasy@linutronix.de
    Fixes: f4f5df23 ("[SCSI] qla4xxx: Added support for ISP82XX")
    Cc: Nilesh Javali <njavali@marvell.com>
    Cc: Manish Rangankar <mrangankar@marvell.com>
    Cc: <GR-QLogic-Storage-Upstream@marvell.com>
    Reviewed-by: default avatarDaniel Wagner <dwagner@suse.de>
    Signed-off-by: default avatarAhmed S. Darwish <a.darwish@linutronix.de>
    Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    a93c3835
ql4_nx.c 115 KB