Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mmc: Speed up reboot with an absent card #6747

Draft
wants to merge 3 commits into
base: rpi-6.12.y
Choose a base branch
from

Conversation

pelwell
Copy link
Contributor

@pelwell pelwell commented Mar 28, 2025

On devices with no card detect mechanism, the host ends up polling for the insertion of a card. This polling happens at multiple frequencies and with many steps (SDIO, SD, MMC), some of which involve timeouts. If a reboot is requested during one of those scans, it will stall, pointlessly, for up to a minute while it completes.

Attempt to short circuit the rescan if the MMC interface is being removed.

See: #6647

@pelwell
Copy link
Contributor Author

pelwell commented Mar 28, 2025

N.B.:

  1. This is Friday afternoon patch, posted so that people can take a look at it.
  2. Even with this patch there can be stalls of up to 10 seconds - however long it takes for the current outstanding command to timeout.

@hasan-akbulak
Copy link

Testing with cm5 during startup still getting stuck on systemd-journald.socket for 30-60 seconds and dtparam=sd=off is not detected. seems to be unsuccessfully halting/rebooting without sd card present. still gets stuck for amount a minute. And twice encountering a error like this:

Afbeelding van WhatsApp op 2025-03-31 om 10 07 15_bb5dab3d

Problem could have occured from the system being unstable and hanging often even when using simple commands like dmesg.

pelwell added 3 commits March 31, 2025 11:35
On devices with no card detect mechanism, the host ends up polling for
the insertion of a card. This polling happens at multiple frequencies
and with many steps (SDIO, SD, MMC), some of which involve timeouts.
If a reboot is requested during one of those scans, it will stall,
pointlessly, for up to a minute while it completes.

Attempt to short circuit the rescan if the MMC interface is being
removed.

Signed-off-by: Phil Elwell <[email protected]>
Reduce the maximum time it takes to get to reboot by decreasing the
default SDHCI timeout to 5 seconds.

Signed-off-by: Phil Elwell <[email protected]>
Two days into running a reboot test over the weekend, the SDHCI driver
hit a NULL pointer in sdhci_needs_reset. It's not clear how that has
been added by the changes for a faster reboot, but guard against it
explicitly.

Signed-off-by: Phil Elwell <[email protected]>
@pelwell
Copy link
Contributor Author

pelwell commented Mar 31, 2025

That looks like a new crash - I've added a fix for that and another one to this PR, as well as hopefully reducing the maximum stall to 5 seconds.

Wait another 40 minutes before trying to update.

@hasan-akbulak
Copy link

still stalling on systemd-journal.socket when booting

ssh takes about 30 seconds to connect.

however when booted stalls are less than 5 seconds for commands and halting and when actually halting/rebooting no stalls
after disabling wifi bt and sd card ofc.

still sometimes small hangs with commands for 2 seconds during halt/shutdown for example trigger happy when pressing power button

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants