Re: [PATCH 12/14] scsi: NCR5380: Remove in_interrupt().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Finn,

Am 30.11.2020 um 13:15 schrieb Finn Thain:
On Sun, 29 Nov 2020, Michael Schmitz wrote:

Am 28.11.20 um 10:48 schrieb Finn Thain:
On Sat, 28 Nov 2020, Finn Thain wrote:

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index d654a6cc4162..739def70cffb 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -223,7 +223,10 @@ static int NCR5380_poll_politely2(struct NCR5380_hostdata *hostdata,
 		cpu_relax();
 	} while (n--);

-	if (irqs_disabled() || in_interrupt())
+	/* We can't sleep when local irqs are disabled and callers ensure
+	 * that local irqs are disabled whenever we can't sleep.
+	 */
+	if (irqs_disabled())
 		return -ETIMEDOUT;

 	/* Repeatedly sleep for 1 ms until deadline */

Michael, Andreas, would you please confirm that this is workable on
Atari? The driver could sleep when IPL == 2 because
arch_irqs_disabled_flags() would return false (on Atari). I'm
wondering whether that would deadlock.

Pretty sure this would deadlock when in interrupt context here.

When in interrupt context, irqs_disabled() is true due to
spinlock_irqsave/restore() in NCR5380_intr().

OK.

My question was really about what would happen if we sleep with IPL == 2.

All relevant system interrupts are at higher priority (5 or 6). Both timer and SCSI / DMA completion interrupt in particular are at IPL 6 and won't be blocked when sleeping with IPL == 2. That's what I meant by 'IPL 2 is perfectly OK' below.

Otherwise, IPL 2 is perfectly OK (which is why
arch_irqs_disabled_flags() returns false in that case).

If you want to be 100% certain, I can give this one a spin.


Please only test it if you think it will work.

With your explanation above, I'm now quite certain your patch will work. I've not seen deadlocks in softirq context since you rewrote the driver so it will no more sleep waiting for the ST-DMA lock.

Cheers,

	Michael



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux