scsi: ufs: fix race a condition between rls handler and err handler
In below call stack, rls handler and err handler are both scheduled but rls
handler is queued in front of err handler. In this scenario, rls handler is
waiting for err handler to recovery the link back to active. However, as
rls handler and err handler are on the same work queue, err handler can
only be executed after rls handler returns. In order to avoid this race
condition, rls work needs to return first when it finds the host state is
no longer functional, which means err handler has been scheduled due to
other reasons.
B::v.f_/task_0xFFFFFFE2B3BC1180
...
-020|arch_local_irq_restore
-020|__raw_spin_unlock_irqrestore
-020|raw_spin_unlock_irqrestore
-021|spin_unlock_irqrestore
-021|ufshcd_hold
-022|ufshcd_hold_all
-023|ufshcd_wait_for_doorbell_clr
-024|ufshcd_rls_handler
-025|__read_once_size
-025|static_key_count
-025|static_key_false
-025|trace_workqueue_execute_end
-025|process_one_work
-026|__read_once_size
-026|list_empty
-026|worker_thread
-027|kthread
-028|ret_from_fork
---|end of frame
B::v.f_/task_0xFFFFFFE1D1674480
-000|__switch_to
-001|__schedule
-002|schedule
-003|schedule_timeout
-004|do_wait_for_common
-005|wait_for_common
-006|wait_for_completion
-007|flush_work
-008|ufshcd_link_recovery
-009|ufshcd_uic_hibern8_exit
-010|ufshcd_is_card_online
-010|ufshcd_resume
-011|ufshcd_system_resume
-012|ufshcd_pltfrm_resume
-013|platform_pm_resume
-014|__read_once_size
-014|static_key_count
-014|static_key_false
-014|trace_device_pm_callback_end
-014|dpm_run_callback
-015|device_resume
...
---|end of frame
Change-Id: Ib5cb16b582e1605d8dea4b1c33acff8172339f50
Signed-off-by:
Can Guo <cang@codeaurora.org>
Loading
Please register or sign in to comment