Skip to contentSkip to conversation

ne.c msleep not mdelay

PATCH In review David Fries 3 participants 7 messages Aug 30, 2008 – Aug 31, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 ne.c msleep not mdelay

mdelay(10) replaced by msleep(10) to give up the CPU, it's just waiting for an interrupt, so timing isn't critical.

Cc Atsushi Nemoto <[email protected]>
Cc Paul Gortmaker <[email protected]>
---
 drivers/net/ne.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ne.c +1 -1
index b0bf47e..bcbeff7 100644
@@ -529,7 +529,7 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr)
 		outb_p(0x00, ioaddr + EN0_RCNTLO);
 		outb_p(0x00, ioaddr + EN0_RCNTHI);
 		outb_p(E8390_RREAD+E8390_START, ioaddr); /* Trigger it... */
-		mdelay(10);	/* wait 10ms for interrupt to propagate */
+		msleep(10);	/* wait 10ms for interrupt to propagate */
 		outb_p(0x00, ioaddr + EN0_IMR); 		/* Mask it again. */
 		dev->irq = probe_irq_off(cookie);
 		if (ei_debug > 2)
Signature · 1 line
1.4.4.4
#1 lore raw
Quoted 2 lines · On Fri, 29 Aug 2008 21:44:53 -0500 David Fries <[email protected]> wrote:

mdelay(10) replaced by msleep(10) to give up the CPU, it's just waiting for an interrupt, so timing isn't critical.

It is too critical for a reschedule to occur.

NAK this one.

#2 lore raw
Quoted 6 lines · Alan Cox
Quoted 2 lines

mdelay(10) replaced by msleep(10) to give up the CPU, it's just waiting for an interrupt, so timing isn't critical.

It is too critical for a reschedule to occur.

NAK this one.

There are already some msleep() in probe_irq_on() which is called just before here. And this part is not protected by any spinlock or preempt_disable.

So, if rescheduling was dangerous here, we already have potential problems, no?

---
Atsushi Nemoto

#3 lore raw
Quoted 11 lines · Atsushi Nemoto
Quoted 6 lines · Alan Cox
Quoted 2 lines

mdelay(10) replaced by msleep(10) to give up the CPU, it's just waiting for an interrupt, so timing isn't critical.

It is too critical for a reschedule to occur.

NAK this one.

There are already some msleep() in probe_irq_on() which is called just before here. And this part is not protected by any spinlock or preempt_disable.

There is a probing_active mutex. probe_irq_off has the comment "nothing prevents two IRQ probe callers from overlapping." Looks to me like probing_active would prevent multiple probes from happening.

Quoted 2 lines

So, if rescheduling was dangerous here, we already have potential problems, no?

I was just going to make the argument that any task that could be run during msleep, could just as easily run on the other cpu in mdelay (if there was one).

Signature · 2 lines
David Fries <[email protected]>
http://fries.net/~david/ (PGP encryption key available)
#4 lore raw
Quoted 3 lines

I was just going to make the argument that any task that could be run during msleep, could just as easily run on the other cpu in mdelay (if there was one).

ISA bus auto-probing doesn't actually work at all well on SMP. The number of people who have ever been affected by that has always been effectively nil.

#5 lore raw
In reply to Atsushi Nemoto
Quoted 6 lines

There are already some msleep() in probe_irq_on() which is called just before here. And this part is not protected by any spinlock or preempt_disable.

So, if rescheduling was dangerous here, we already have potential problems, no?

Yes we do but I didn't manage to stop the other mistakes getting in when they did. If you take a schedule you get results back from the probe_irq that tend to suck in other random ISA device events (ISA being edge triggered nobody was ever careful about spurious irq)

#6 lore raw
Quoted 7 lines · Alan Cox
Quoted 2 lines

So, if rescheduling was dangerous here, we already have potential problems, no?

Yes we do but I didn't manage to stop the other mistakes getting in when they did. If you take a schedule you get results back from the probe_irq that tend to suck in other random ISA device events (ISA being edge triggered nobody was ever careful about spurious irq)

OK, I see your point. Thanks.

---
Atsushi Nemoto