[PATCH v3] scsi: ufs: correct ufshcd_shutdown flow
Bart Van Assche
bvanassche at acm.org
Mon Jul 25 10:07:46 PDT 2022
On 7/24/22 20:47, Peter Wang wrote:
> Because kernel_restart is export, and mediatek may call kernel_restart
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Is this code upstream?
> while shutdown is on going.
> EXPORT_SYMBOL_GPL(kernel_restart);
> kernel_restart -> kernel_restart_prepare -> device_shutdown
>
> So, there may have two thread execute device_shutdown concurrently.
> And the list_lock in device_shutdown function is not protect shutdown
> callback function,
> caused two callback function(ufshcd_shutdown/ufshcd_wl_shutdown) could
> run concurrently.
>
> Here is the error log that two thread in device_shutdown.
> [37684.002227] [T1500641] platform +platform:112b0000.ufshci
> kpoc_charger: ufshcd-mtk 112b0000.ufshci: [name:core&]shutdown
> [37684.002264] [T1600339] scsi +scsi:0:0:0:49488 charger_thread:
> ufs_device_wlun 0:0:0:49488: [name:core&]shutdown
Hi Peter,
I had not yet taken a look at the kernel_restart() function. Now that I
have taken a look, it seems to me that kernel_restart() calls must be
serialized via the system_transition_mutex. Please make sure that the
kernel_restart() calls are serialized.
Thanks,
Bart.
More information about the Linux-mediatek
mailing list