On Wed, Nov 22, 2023 at 12:22:12PM +0100, Oleksij Rempel wrote: > Some puzzle parts are now mainline, for example regulator framework > can be configured to detect under-voltage events and execute > hw_protection_shutdown(). So far it worked good enough to complete > mmc_poweroff_notify() withing 100ms window. The problem is, the chance to > execute mmc_poweroff_notify() depends on kernel configuration. If there are too > many drivers and devices, mmc_poweroff_notify() will be not executed in time. > For now, I workaround it by registering a reboot notifier for mmc shutdown. > It works, because kernel_power_off() is executing all registered reboot > notifiers at first place and there are no other slow reboot notifiers. > But, it seems to be not reliable enough. Probably notifier prioritization > is needed to make it more predictable. > So far, I have two variants to implement it in more predictable way: > variant 1 - forward the under-voltage notification to the mmc framework and > execute mmc_poweroff_notify() or bus shutdown. > variant 2 - use reboot notifier and introduce reboot notifier prioritization. > Are there other options? What are your preferences? My instinct is that we want to have prioritisation scheme rather than something MMC specific, I'd guess that this issue applies in some way to at least most storage. It's not a super strongly held opinion though.
Attachment:
signature.asc
Description: PGP signature