drivers/ufs/core/ufshcd.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
v2 -> v3: rule out the change of polling w/ pmc from this thread. (I'll post the change later) v1 -> v2: remove an unused variable in __ufshcd_send_uic_cmd Kiwoong Kim (2): ufs: make __ufshcd_send_uic_cmd not wrapped by host_lock ufs: poll HCS.UCRDY before issuing a UIC command drivers/ufs/core/ufshcd.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) -- 2.7.4
Kiwoong, > v2 -> v3: rule out the change of polling w/ pmc from this thread. > (I'll post the change later) > v1 -> v2: remove an unused variable in __ufshcd_send_uic_cmd > > Kiwoong Kim (2): > ufs: make __ufshcd_send_uic_cmd not wrapped by host_lock > ufs: poll HCS.UCRDY before issuing a UIC command Applied to 6.6/scsi-staging, thanks! -- Martin K. Petersen Oracle Linux Engineering
> > v2 -> v3: rule out the change of polling w/ pmc from this thread. > > (I'll post the change later) > > v1 -> v2: remove an unused variable in __ufshcd_send_uic_cmd > > > > Kiwoong Kim (2): > > ufs: make __ufshcd_send_uic_cmd not wrapped by host_lock > > ufs: poll HCS.UCRDY before issuing a UIC command > > Applied to 6.6/scsi-staging, thanks! > > -- > Martin K. Petersen Oracle Linux Engineering Hi, Martin The following patch seems to make trouble because of using read_poll_timeout. Its initial version used udelay and after discussion it's been changed. Could you revert this patch set? > ufs: poll HCS.UCRDY before issuing a UIC command [ 4671.226480] [3: kworker/u20:29:17140] BUG: scheduling while atomic: kworker/u20:29/17140/0x00000002 .. [ 4671.228723] [3: kworker/u20:29:17140] panic+0x16c/0x388 [ 4671.228745] [3: kworker/u20:29:17140] check_panic_on_warn+0x60/0x94 [ 4671.228764] [3: kworker/u20:29:17140] __schedule_bug+0x6c/0x94 [ 4671.228786] [3: kworker/u20:29:17140] __schedule+0x6f4/0xa64 [ 4671.228806] [3: kworker/u20:29:17140] schedule+0x7c/0xe8 [ 4671.228824] [3: kworker/u20:29:17140] schedule_hrtimeout_range_clock+0x98/0x114 [ 4671.228841] [3: kworker/u20:29:17140] schedule_hrtimeout_range+0x14/0x24 [ 4671.228856] [3: kworker/u20:29:17140] usleep_range_state+0x60/0x94 [ 4671.228871] [3: kworker/u20:29:17140] __ufshcd_send_uic_cmd+0xa0/0x1c4 [ 4671.228893] [3: kworker/u20:29:17140] ufshcd_uic_pwr_ctrl+0x15c/0x390 [ 4671.228908] [3: kworker/u20:29:17140] ufshcd_uic_hibern8_enter+0x9c/0x25c [ 4671.228922] [3: kworker/u20:29:17140] ufshcd_link_state_transition+0x34/0xb0 [ 4671.228939] [3: kworker/u20:29:17140] __ufshcd_wl_suspend+0x3f0/0x4b4 Thanks you.
On 11/09/23 04:35, Kiwoong Kim wrote: >>> v2 -> v3: rule out the change of polling w/ pmc from this thread. >>> (I'll post the change later) >>> v1 -> v2: remove an unused variable in __ufshcd_send_uic_cmd >>> >>> Kiwoong Kim (2): >>> ufs: make __ufshcd_send_uic_cmd not wrapped by host_lock >>> ufs: poll HCS.UCRDY before issuing a UIC command >> >> Applied to 6.6/scsi-staging, thanks! >> >> -- >> Martin K. Petersen Oracle Linux Engineering > > Hi, Martin > > The following patch seems to make trouble because of using > read_poll_timeout. > Its initial version used udelay and after discussion it's been changed. > Could you revert this patch set? > >> ufs: poll HCS.UCRDY before issuing a UIC command > > [ 4671.226480] [3: kworker/u20:29:17140] BUG: scheduling while atomic: > kworker/u20:29/17140/0x00000002 > .. > [ 4671.228723] [3: kworker/u20:29:17140] panic+0x16c/0x388 > [ 4671.228745] [3: kworker/u20:29:17140] check_panic_on_warn+0x60/0x94 > [ 4671.228764] [3: kworker/u20:29:17140] __schedule_bug+0x6c/0x94 > [ 4671.228786] [3: kworker/u20:29:17140] __schedule+0x6f4/0xa64 > [ 4671.228806] [3: kworker/u20:29:17140] schedule+0x7c/0xe8 > [ 4671.228824] [3: kworker/u20:29:17140] > schedule_hrtimeout_range_clock+0x98/0x114 > [ 4671.228841] [3: kworker/u20:29:17140] schedule_hrtimeout_range+0x14/0x24 > [ 4671.228856] [3: kworker/u20:29:17140] usleep_range_state+0x60/0x94 > [ 4671.228871] [3: kworker/u20:29:17140] __ufshcd_send_uic_cmd+0xa0/0x1c4 > [ 4671.228893] [3: kworker/u20:29:17140] ufshcd_uic_pwr_ctrl+0x15c/0x390 > [ 4671.228908] [3: kworker/u20:29:17140] > ufshcd_uic_hibern8_enter+0x9c/0x25c > [ 4671.228922] [3: kworker/u20:29:17140] > ufshcd_link_state_transition+0x34/0xb0 > [ 4671.228939] [3: kworker/u20:29:17140] __ufshcd_wl_suspend+0x3f0/0x4b4 Do you know what is in that path that makes it an atomic context?
> >> ufs: poll HCS.UCRDY before issuing a UIC command > > > > [ 4671.226480] [3: kworker/u20:29:17140] BUG: scheduling while atomic: > > kworker/u20:29/17140/0x00000002 > > .. > > [ 4671.228723] [3: kworker/u20:29:17140] panic+0x16c/0x388 [ > > 4671.228745] [3: kworker/u20:29:17140] check_panic_on_warn+0x60/0x94 > > [ 4671.228764] [3: kworker/u20:29:17140] __schedule_bug+0x6c/0x94 [ > > 4671.228786] [3: kworker/u20:29:17140] __schedule+0x6f4/0xa64 [ > > 4671.228806] [3: kworker/u20:29:17140] schedule+0x7c/0xe8 [ > > 4671.228824] [3: kworker/u20:29:17140] > > schedule_hrtimeout_range_clock+0x98/0x114 > > [ 4671.228841] [3: kworker/u20:29:17140] > > schedule_hrtimeout_range+0x14/0x24 > > [ 4671.228856] [3: kworker/u20:29:17140] usleep_range_state+0x60/0x94 > > [ 4671.228871] [3: kworker/u20:29:17140] > > __ufshcd_send_uic_cmd+0xa0/0x1c4 [ 4671.228893] [3: > > kworker/u20:29:17140] ufshcd_uic_pwr_ctrl+0x15c/0x390 [ 4671.228908] > > [3: kworker/u20:29:17140] ufshcd_uic_hibern8_enter+0x9c/0x25c > > [ 4671.228922] [3: kworker/u20:29:17140] > > ufshcd_link_state_transition+0x34/0xb0 > > [ 4671.228939] [3: kworker/u20:29:17140] > > __ufshcd_wl_suspend+0x3f0/0x4b4 > > Do you know what is in that path that makes it an atomic context? Hi, This made that. static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd) .. bool reenable_intr = false; mutex_lock(&hba->uic_cmd_mutex); <<<< At first, I was willing to post together w/ the following patch but I've got a suggestion to split the patch set because of different topic and I split the patch set. - This patch removes the mutex, so it can fix the issue. https://lore.kernel.org/linux-scsi/1694051306-172962-1-git-send-email-kwmad.kim@samsung.com/ But now I'm thinking again that simply removing the mutex could hurt atomicity of UIC command process that the original code intended for the first time. So I think this polling UCRDY should be modified rather than applying removal of the mutex.
On 11/09/23 09:32, Kiwoong Kim wrote: >>>> ufs: poll HCS.UCRDY before issuing a UIC command >>> >>> [ 4671.226480] [3: kworker/u20:29:17140] BUG: scheduling while atomic: >>> kworker/u20:29/17140/0x00000002 >>> .. >>> [ 4671.228723] [3: kworker/u20:29:17140] panic+0x16c/0x388 [ >>> 4671.228745] [3: kworker/u20:29:17140] check_panic_on_warn+0x60/0x94 >>> [ 4671.228764] [3: kworker/u20:29:17140] __schedule_bug+0x6c/0x94 [ >>> 4671.228786] [3: kworker/u20:29:17140] __schedule+0x6f4/0xa64 [ >>> 4671.228806] [3: kworker/u20:29:17140] schedule+0x7c/0xe8 [ >>> 4671.228824] [3: kworker/u20:29:17140] >>> schedule_hrtimeout_range_clock+0x98/0x114 >>> [ 4671.228841] [3: kworker/u20:29:17140] >>> schedule_hrtimeout_range+0x14/0x24 >>> [ 4671.228856] [3: kworker/u20:29:17140] usleep_range_state+0x60/0x94 >>> [ 4671.228871] [3: kworker/u20:29:17140] >>> __ufshcd_send_uic_cmd+0xa0/0x1c4 [ 4671.228893] [3: >>> kworker/u20:29:17140] ufshcd_uic_pwr_ctrl+0x15c/0x390 [ 4671.228908] >>> [3: kworker/u20:29:17140] ufshcd_uic_hibern8_enter+0x9c/0x25c >>> [ 4671.228922] [3: kworker/u20:29:17140] >>> ufshcd_link_state_transition+0x34/0xb0 >>> [ 4671.228939] [3: kworker/u20:29:17140] >>> __ufshcd_wl_suspend+0x3f0/0x4b4 >> >> Do you know what is in that path that makes it an atomic context? > > Hi, > This made that. > > static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd) > .. > bool reenable_intr = false; > > mutex_lock(&hba->uic_cmd_mutex); <<<< It is OK to schedule while holding a mutex. Are you sure this is the problem? > > > At first, I was willing to post together w/ the following patch but I've got a suggestion to split the patch set because of different topic and I split the patch set. > - This patch removes the mutex, so it can fix the issue. > https://lore.kernel.org/linux-scsi/1694051306-172962-1-git-send-email-kwmad.kim@samsung.com/ > > > But now I'm thinking again that simply removing the mutex could hurt atomicity of UIC command process > that the original code intended for the first time. > So I think this polling UCRDY should be modified rather than applying removal of the mutex. > > >
> > static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command > > *cmd) .. > > bool reenable_intr = false; > > > > mutex_lock(&hba->uic_cmd_mutex); <<<< > > It is OK to schedule while holding a mutex. Are you sure this is the > problem? Ah, I mis-understood it. It was for not applying this. https://lore.kernel.org/linux-scsi/782ba5f26f0a96e58d85dff50751787d2d2a6b2b.1693790060.git.kwmad.kim@samsung.com/ So this patch set has no problem. Sorry for bothering all of you. Thanks.
© 2016 - 2025 Red Hat, Inc.