[Q] mmc host cleanup sequence - how to prevent races

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

 



Hi all

I am uncertain about the correct mmc host clean up order, namely what 
should happen first: interrupt handlers freed or mmc_remove_host() called?

First freeing interrupts doesn't seem to be a good idea. mmc_remove_host() 
can be waiting for interrupts, which then deadlocks. So, interrupts must 
be freed after mmc_remove_host(). But that creates a window, during which 
if an interrupt occurs, bad things can happen(TM). But normal MMC 
interrupts are not supposed to happen after mmc_remove_host() returns - no 
more requests will be flying. But there are two more kinds of interrupts, 
that still can happen in that window: hotplug and SDIO. To prevent 
hotplug, e.g., the sdhci driver, calls sdhci_disable_card_detection(). 
That helps against that race, but - what if we then miss a card eject 
between that call and mmc_remove_host()? Won't the core then try to 
communicate with a card, that's gone?

And then SDIO. We could do a similar thing - prohibit processing of SDIO 
interrupts before calling mmc_remove_host(). But could it be the case, 
that a higher level kernel driver is waiting for that SDIO interrupt, and 
then mmc_remove_host() will be waiting for that driver to release the card 
(if anything like that is happening in mmc?), and they will deadlock?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux