Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
sdhost: command MMC_SEND_EXT_CSD can unmount rootfs #2728
During my investigation about this issue with the upstream version of sdhost, i've found a problem which affects downstream (bcm2835-sdhost.c) and upstream (bcm2835.c).
Steps to reproduce on Raspberry Pi 3B:
Affected kernel versions:
Current investigation results:
after this strange IO errors occur, the ext4 journal is aborted and the rootfs isn't available. The sdhost isn't able to break free from this situation.
As a band-aid for the upstream driver i made the following patch. This avoids the issue but is probably not the best solution. I assume you have (more) documentation about the sdhost controller to identify what's wrong here.
Edit: I apologize but the patch wasn't the right one. Fixed
Thanks for the debug effort on this issue. Using an NFS root partition takes most of the pain out of SD driver errors, and network booting further streamlines the process.
This is not an error I've encountered before since the normal MMC subsystem will avoid sending MMC_SEND_EXT_CSD to an SD card unless forced to. You are correct that we do have at least some documentation for the SDHOST interface, but it wasn't sufficient to stop the writing of the original downstream driver being an exercise in trial and error, and this fix is more of the same.
The active ingredient in your workaround isn't the waiting - without prodding, the controller will remain in the READWAIT state indefinitely - it's setting the FORCE_DATA_MODE bit, which is enough to get the FSM out of the rut.
See #2729 for two possible fixes.
Your patch looks nice.
Btw i tried my patched upstream version against the original issue from Ognian, but this one isn't fixed. The system seems to hang (heartbeat LEDs blinks fast).
Here is the source code to provoke the initial issue:
Okay, after applying ed6ceb0 and https://gist.github.com/pelwell/265baccf92ea4f2d8e47c4f9e1655714 on top of upstream 4.19, the MMC_SEND_EXT_CSD doesn't cause harm anymore on Raspberry Pi 3.
In case of sdmon i'm getting
I also tested sdmon once with current 4.14 723af8f
Maybe this helps