scsi: ufshcd: Fix race between clk scaling and ungate work
The ungate work turns on the clock before it exits hibern8,
if the link was put in hibern8 during clock gating work.
There occurs a race condition when clock scaling work calls
ufshcd_hold() to make sure low power states cannot be entered,
but that returns by checking only whether the clocks are on.
This causes the clock scaling work to issue UIC commands when
the link is in hibern8 causing failures. Make sure we exit
hibern8 state before returning from ufshcd_hold().
Callstacks for race condition:
ufshcd_scale_gear+0x120/0x138
ufshcd_devfreq_scale+0x98/0x154
ufshcd_devfreq_target+0x14c/0x250
update_devfreq+0xc4/0x10c
devfreq_monitor+0x34/0x90
process_one_work+0x24c/0x430
worker_thread+0x2e0/0x408
kthread+0x100/0x108
ret_from_fork+0x10/0x40
ufshcd_uic_hibern8_exit+0x128/0x1f0
ufshcd_ungate_work+0xec/0x148
process_one_work+0x24c/0x430
worker_thread+0x2e0/0x408
kthread+0x100/0x108
ret_from_fork+0x10/0x40
CRs-Fixed: 1036530
Change-Id: I7f430abfb2a545ac97dee488a696a89cd18214f1
Signed-off-by:
Venkat Gopalakrishnan <venkatg@codeaurora.org>
Loading
Please register or sign in to comment