Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 702f44e9 authored by Can Guo's avatar Can Guo
Browse files

scsi: ufs: fix scheduling while atomic



UFS queuecommand should never sleep or be scheduled out because it holds
the queue_lock of request queue. Thus, when queuecommand calls the async
version of ufshcd_hold to ungate the clock, it should directly return if
the clock or link state is not ready. Below scheduling while atomic error
is thrown out because the UFS clock gating state is already CLKS_ON, but
the link state is still in hibern8.

[10336.807764] BUG: scheduling while atomic: Thread-6/9423/0x00000002
[10336.807898] ------------[ cut here ]------------
[10336.807916] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[10336.808621] Call trace:
[10336.808633]  __schedule_bug+0x4c/0x60
[10336.808647]  __schedule+0x9b0/0xc58
[10336.808658]  schedule+0x70/0x90
[10336.808671]  schedule_timeout+0x40/0x620
[10336.808681]  wait_for_common+0xfc/0x1d0
[10336.808691]  wait_for_completion+0x14/0x20
[10336.808705]  flush_work+0x210/0x270
[10336.808722]  ufshcd_hold+0x1dc/0x460
[10336.808732]  ufshcd_queuecommand+0x248/0xbe8
[10336.808745]  scsi_dispatch_cmd+0x174/0x2f8
[10336.808756]  scsi_request_fn+0x7c/0x6e0
[10336.808771]  queue_unplugged+0x164/0x1d0
[10336.808781]  blk_flush_plug_list+0x22c/0x270
[10336.808791]  blk_finish_plug+0x24/0x38
[10336.808806]  __do_page_cache_readahead+0x358/0x3b0
[10336.808815]  ondemand_readahead+0x1f4/0x270
[10336.808825]  page_cache_sync_readahead+0x50/0x108
[10336.808839]  generic_file_read_iter+0x268/0x998
[10336.808854]  ext4_file_read_iter+0x2c/0x48
[10336.808873]  __vfs_read+0xe8/0x130
[10336.808882]  vfs_read+0xa0/0x138
[10336.808893]  SyS_pread64+0x78/0xb8
[10336.808907]  __sys_trace_return+0x0/0x4

Change-Id: I746caf533d5f1430207acc219fc762119fe229c7
Signed-off-by: default avatarCan Guo <cang@codeaurora.org>
parent 6c813797
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment