Skip to contentSkip to conversation

e100 driver spinning delay blocking ksoftirqd?

DISCUSSION Stanislav Meduna 1 participant 2 messages May 2, 2013 – May 4, 2013

lore
Share & tools
lore
#0 lore raw

Hi,

drivers/net/ethernet/intel/e100.c:

for (i = 0; i < 100; i++) {
	udelay(20);
	if ((data_out = ioread32(&nic->csr->mdi_ctrl)) & mdi_ready)
		break;
	}

On my system this calls delay_tsc and if I understand this correctly, this will block ksoftirqd and everything having a lower priority for up to 2 ms. Which is what I am seeing in my traces - this loop most probably causes the ~1 ms latencies I am regularly seeing.

Is there something that can be done about it except trying the split softirq feature? I need to have the timers above some of my threads, but I don't like the networking blocking them...

Anyone has some experiences/hints for using e100 with linux-rt?

The kernel is the current 3.4-rt one.

Thanks

Signature · 1 line
                                       Stano
#1 lore raw

e100: usleep in timer context legal?

Hi,

drivers/net/ethernet/intel/e100.c has a following construct:

static u16 mdio_ctrl_hw(struct nic *nic, ...
...
spin_lock_irqsave(&nic->mdio_lock, flags);
...
udelay(20);
...
spin_unlock_irqrestore(&nic->mdio_lock, flags);

This function is indirectly called from
static void e100_watchdog(unsigned long data)

which is a timer. So if I understand it correctly, this will be called as a softirq. There is also another path - e.g. via ioctl() - where this will be called in the thread context.

Is this legal? From googling I am a bit confused, I think it is (usleep is not really "blocking" and under RT it is always (?) processed in a thread context), but I'd like to check. I am mostly a userspace developer and I admit I do not yet know all the fine differences in hard-irq, soft-irq, when are soft-irqs processed etc).

I am still hunting livelock issues where the RT throttler activates and after 1-3 seconds all is OK again; so far I have been unable to capture a trace of it, as it is strongly timing-dependent and nearly never happens in a lab :( Due to an oversight in our code we are calling the mdio_ctrl_hw really often (but not more often the udelays can handle), so I suspect it can be related.

Thanks

Signature · 1 line
                                       Stano