All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Seunghwan Baek" <sh8267.baek@samsung.com>
To: <linux-kernel@vger.kernel.org>, <linux-scsi@vger.kernel.org>,
	<martin.petersen@oracle.com>,
	<James.Bottomley@HansenPartnership.com>, <bvanassche@acm.org>,
	<avri.altman@wdc.com>, <alim.akhtar@samsung.com>
Cc: <grant.jung@samsung.com>, <jt77.jang@samsung.com>,
	<junwoo80.lee@samsung.com>, <dh0421.hwang@samsung.com>,
	<jangsub.yi@samsung.com>, <sh043.lee@samsung.com>,
	<cw9316.lee@samsung.com>, <wkon.kim@samsung.com>,
	<stable@vger.kernel.org>
Subject: RE: [PATCH v1 1/1] ufs: core: set SDEV_OFFLINE when ufs shutdown.
Date: Mon, 23 Sep 2024 16:54:44 +0900	[thread overview]
Message-ID: <015101db0d8d$daacd030$90067090$@samsung.com> (raw)
In-Reply-To: <20240829093913.6282-2-sh8267.baek@samsung.com>

> There is a history of dead lock as reboot is performed at the beginning of
> booting. SDEV_QUIESCE was set for all lu's scsi_devices by ufs shutdown,
> and at that time the audio driver was waiting on blk_mq_submit_bio holding
> a mutex_lock while reading the fw binary. After that, a deadlock issue
> occurred while audio driver shutdown was waiting for mutex_unlock of
> blk_mq_submit_bio. To solve this, set SDEV_OFFLINE for all lus except wlun,
> so that any i/o that comes down after a ufs shutdown will return an error.
> 
> [   31.907781]I[0:      swapper/0:    0]        1        130705007       1651079834
> 11289729804                0 D(   2) 3 ffffff882e208000 *             init
> [device_shutdown]
> [   31.907793]I[0:      swapper/0:    0] Mutex: 0xffffff8849a2b8b0:
> owner[0xffffff882e28cb00 kworker/6:0 :49]
> [   31.907806]I[0:      swapper/0:    0] Call trace:
> [   31.907810]I[0:      swapper/0:    0]  __switch_to+0x174/0x338
> [   31.907819]I[0:      swapper/0:    0]  __schedule+0x5ec/0x9cc
> [   31.907826]I[0:      swapper/0:    0]  schedule+0x7c/0xe8
> [   31.907834]I[0:      swapper/0:    0]  schedule_preempt_disabled+0x24/0x40
> [   31.907842]I[0:      swapper/0:    0]  __mutex_lock+0x408/0xdac
> [   31.907849]I[0:      swapper/0:    0]  __mutex_lock_slowpath+0x14/0x24
> [   31.907858]I[0:      swapper/0:    0]  mutex_lock+0x40/0xec
> [   31.907866]I[0:      swapper/0:    0]  device_shutdown+0x108/0x280
> [   31.907875]I[0:      swapper/0:    0]  kernel_restart+0x4c/0x11c
> [   31.907883]I[0:      swapper/0:    0]  __arm64_sys_reboot+0x15c/0x280
> [   31.907890]I[0:      swapper/0:    0]  invoke_syscall+0x70/0x158
> [   31.907899]I[0:      swapper/0:    0]  el0_svc_common+0xb4/0xf4
> [   31.907909]I[0:      swapper/0:    0]  do_el0_svc+0x2c/0xb0
> [   31.907918]I[0:      swapper/0:    0]  el0_svc+0x34/0xe0
> [   31.907928]I[0:      swapper/0:    0]  el0t_64_sync_handler+0x68/0xb4
> [   31.907937]I[0:      swapper/0:    0]  el0t_64_sync+0x1a0/0x1a4
> 
> [   31.908774]I[0:      swapper/0:    0]       49                0         11960702
> 11236868007                0 D(   2) 6 ffffff882e28cb00 *      kworker/6:0
> [__bio_queue_enter]
> [   31.908783]I[0:      swapper/0:    0] Call trace:
> [   31.908788]I[0:      swapper/0:    0]  __switch_to+0x174/0x338
> [   31.908796]I[0:      swapper/0:    0]  __schedule+0x5ec/0x9cc
> [   31.908803]I[0:      swapper/0:    0]  schedule+0x7c/0xe8
> [   31.908811]I[0:      swapper/0:    0]  __bio_queue_enter+0xb8/0x178
> [   31.908818]I[0:      swapper/0:    0]  blk_mq_submit_bio+0x194/0x67c
> [   31.908827]I[0:      swapper/0:    0]  __submit_bio+0xb8/0x19c
> 
> Fixes: b294ff3e3449 ("scsi: ufs: core: Enable power management for wlun")
> Cc: stable@vger.kernel.org
> Signed-off-by: Seunghwan Baek <sh8267.baek@samsung.com>
> ---
>  drivers/ufs/core/ufshcd.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index a6f818cdef0e..4ac1492787c2 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -10215,7 +10215,9 @@ static void ufshcd_wl_shutdown(struct device *dev)
>  	shost_for_each_device(sdev, hba->host) {
>  		if (sdev == hba->ufs_device_wlun)
>  			continue;
> -		scsi_device_quiesce(sdev);
> +		mutex_lock(&sdev->state_mutex);
> +		scsi_device_set_state(sdev, SDEV_OFFLINE);
> +		mutex_unlock(&sdev->state_mutex);
>  	}
>  	__ufshcd_wl_suspend(hba, UFS_SHUTDOWN_PM);
> 
> --
> 2.17.1
> 

Dear all.

Could you please review this patch? It's been almost a month.
If you have any opinions about this patch, share and comment it.

Thanks.
BRs.


  reply	other threads:[~2024-09-23  7:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240829093920epcas1p1cf45ac0cd7d4ed8cf39ff5f1d1b4fe00@epcas1p1.samsung.com>
2024-08-29  9:39 ` [PATCH v1 0/1] Set SDEV_OFFLINE when ufs shutdown Seunghwan Baek
2024-08-29  9:39   ` [PATCH v1 1/1] ufs: core: set " Seunghwan Baek
2024-09-23  7:54     ` Seunghwan Baek [this message]
2024-09-23 17:31       ` Bart Van Assche
2024-09-23 17:41     ` Bart Van Assche
2024-09-24  2:17       ` Seunghwan Baek
2024-09-24 18:24         ` Bart Van Assche
2024-09-25  6:54           ` Seunghwan Baek
2024-10-08  5:27           ` Seunghwan Baek
2024-10-10  5:47             ` Kiwoong Kim
2024-10-08 17:58     ` Bart Van Assche
2024-10-16  2:39   ` [PATCH v1 0/1] Set " Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='015101db0d8d$daacd030$90067090$@samsung.com' \
    --to=sh8267.baek@samsung.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=cw9316.lee@samsung.com \
    --cc=dh0421.hwang@samsung.com \
    --cc=grant.jung@samsung.com \
    --cc=jangsub.yi@samsung.com \
    --cc=jt77.jang@samsung.com \
    --cc=junwoo80.lee@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sh043.lee@samsung.com \
    --cc=stable@vger.kernel.org \
    --cc=wkon.kim@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.