Re: [PATCH v4 2/2] firmware_loader: Abort all upcoming firmware load request once reboot triggered

From: Luis Chamberlain
Date: Thu Oct 26 2023 - 17:17:33 EST


On Thu, Oct 26, 2023 at 07:57:39PM +0530, Mukesh Ojha wrote:
> There could be following scenario where there is a ongoing reboot
> is going from processA which tries to call all the reboot notifier
> callback and one of them is firmware reboot call which tries to
> abort all the ongoing firmware userspace request under fw_lock but
> there could be another processB which tries to do request firmware,
> which came just after abort done from ProcessA and ask for userspace
> to load the firmware and this can stop the ongoing reboot ProcessA
> to stall for next 60s(default timeout) which may not be expected
> behaviour everyone like to see, instead we should abort any firmware
> load request which came once firmware knows about the reboot through
> notification.
>
> ProcessA ProcessB
>
> kernel_restart_prepare
> blocking_notifier_call_chain
> fw_shutdown_notify
> kill_pending_fw_fallback_reqs
> __fw_load_abort
> fw_state_aborted request_firmware
> __fw_state_set firmware_fallback_sysfs
> ... fw_load_from_user_helper
> .. ...
> . ..
> usermodehelper_read_trylock
> fw_load_sysfs_fallback
> fw_sysfs_wait_timeout
> usermodehelper_disable
> __usermodehelper_disable
> down_write()
>
> Signed-off-by: Mukesh Ojha <quic_mojha@xxxxxxxxxxx>
> ---

Acked-by: Luis Chamberlain <mcgrof@xxxxxxxxxx>

Luis