Skip to contentSkip to conversation

mmc_rescan causes severe interrupt latency

DISCUSSION Thomas Otvald Jensen 1 participant 1 message Oct 10, 2013 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

Hi,

I am on an embedded system, and found that we had several ms interrupt delay (causing UART overrun). The problem was identified as part of the mmc_rescan.

Our setup has enabled polling (MMC_CAP_NEEDS_POLL) to detect if an SD card is present. This will cause a periodic rescheduling of mmc_rescan.

mmc_rescan -> mmc_rescan_try_freq -> mmc_power_up -> mmc_set_ios -> host->ops->set_ios(host, ios);

We are using mmc/host/sdhci.c, so host->ops->set_ios(host, ios) -> sdhci_set_ios

And here is the problem:
The routine starts with 'spin_lock_irqsave'. This means I wont get any interrupts until the lock is released. However this may take some time (usually 3-5ms), but when looking at the code - in particular - 'sdhci_set_clock', then I see the comment: /* Wait max 20 ms */. We *still* have interrupts disabled, so it could potentially add further to our delay.

(I know that e.g. sdhci_writew are platform specific, so FYI, I am on a Freescale imx6 platform).

Q: Is this kind of interrupt delay expected (3-5ms)?
Q: Is it acceptable to have a loop with 20ms timeout with interrupts disabled?

Kind regards,
/Thomas