All of lore.kernel.org
 help / color / mirror / Atom feed
From: Can Guo <cang@codeaurora.org>
To: Stanley Chu <stanley.chu@mediatek.com>
Cc: linux-scsi-owner@vger.kernel.org, linux-scsi@vger.kernel.org,
	martin.petersen@oracle.com, subhashj@codeaurora.org,
	jejb@linux.ibm.com, chun-hung.wu@mediatek.com,
	kuohong.wang@mediatek.com, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, avri.altman@wdc.com,
	linux-mediatek@lists.infradead.org, peter.wang@mediatek.com,
	alim.akhtar@samsung.com, andy.teng@mediatek.com,
	matthias.bgg@gmail.com, beanhuo@micron.com,
	pedrom.sousa@synopsys.com, bvanassche@acm.org,
	linux-arm-kernel@lists.infradead.org, asutoshd@codeaurora.org
Subject: Re: [PATCH v1 1/2] scsi: ufs: set device as default active power mode during initialization only
Date: Tue, 31 Dec 2019 10:13:27 +0800	[thread overview]
Message-ID: <836772092daffd8283a97d633e59fc34@codeaurora.org> (raw)
In-Reply-To: <1577754469.13164.5.camel@mtkswgap22>

On 2019-12-31 09:07, Stanley Chu wrote:
> Hi Asutosh,
> 
> 
>> I see that there's a get_sync done before.
>> So, how would the suspend be triggered in that case?
>> 
> 
> Would you mean pm_runtime_get_sync() in ufshcd_init()?
> If yes, it will only happen during initialization.
> 
> The runtime resume path may go through ufshcd_probe_hba() without
> ufshcd_init() invoked before, for example,
> 
> ufshcd_probe_hba+0xe10/0x1874
> ufshcd_host_reset_and_restore+0x114/0x1a4
> ufshcd_resume+0x1d0/0x480
> ufshcd_runtime_resume+0x40/0x188
> ufshcd_pltfrm_runtime_resume+0x10/0x18
> pm_generic_runtime_resume+0x24/0x44
> __rpm_callback+0x100/0x250
> rpm_resume+0x548/0x7c8
> rpm_resume+0x2b4/0x7c8
> rpm_resume+0x2b4/0x7c8
> rpm_resume+0x2b4/0x7c8
> pm_runtime_work+0x9c/0xa0
> process_one_work+0x210/0x4e0
> worker_thread+0x390/0x520
> kthread+0x154/0x18c
> ret_from_fork+0x10/0x18
> 
> This case happens if link is in "off" state while resume.
> 
> Thanks,
> Stanley

Hi Stanley,

I see skipping ufshcd_set_ufs_dev_active() in ufshcd_probe_hba()
if it is called from ufshcd_resume() path is the purpose here.

If so, then ufshcd_set_dev_pwr_mode() would be called, meaning
SSU command will be sent. Why is this SSU command needed to be
sent after a full host reset and restore? Is ufshcd_probe_hba()
not enough to make UFS device fully functional?

<snip>
         } else if (ufshcd_is_link_off(hba)) {
                 ret = ufshcd_host_reset_and_restore(hba);
                 /*
                  * ufshcd_host_reset_and_restore() should have already
                  * set the link state as active
                  */
                 if (ret || !ufshcd_is_link_active(hba))
                         goto vendor_suspend;
         }

         if (!ufshcd_is_ufs_dev_active(hba)) {
                 ret = ufshcd_set_dev_pwr_mode(hba, UFS_ACTIVE_PWR_MODE);
                 if (ret)
                         goto set_old_link_state;
         }
<snip>

Thanks,

Can Guo.

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Can Guo <cang@codeaurora.org>
To: Stanley Chu <stanley.chu@mediatek.com>
Cc: asutoshd@codeaurora.org, linux-scsi@vger.kernel.org,
	martin.petersen@oracle.com, avri.altman@wdc.com,
	alim.akhtar@samsung.com, pedrom.sousa@synopsys.com,
	jejb@linux.ibm.com, matthias.bgg@gmail.com, bvanassche@acm.org,
	subhashj@codeaurora.org, beanhuo@micron.com,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, kuohong.wang@mediatek.com,
	peter.wang@mediatek.com, chun-hung.wu@mediatek.com,
	andy.teng@mediatek.com, stable@vger.kernel.org,
	linux-scsi-owner@vger.kernel.org
Subject: Re: [PATCH v1 1/2] scsi: ufs: set device as default active power mode during initialization only
Date: Tue, 31 Dec 2019 10:13:27 +0800	[thread overview]
Message-ID: <836772092daffd8283a97d633e59fc34@codeaurora.org> (raw)
In-Reply-To: <1577754469.13164.5.camel@mtkswgap22>

On 2019-12-31 09:07, Stanley Chu wrote:
> Hi Asutosh,
> 
> 
>> I see that there's a get_sync done before.
>> So, how would the suspend be triggered in that case?
>> 
> 
> Would you mean pm_runtime_get_sync() in ufshcd_init()?
> If yes, it will only happen during initialization.
> 
> The runtime resume path may go through ufshcd_probe_hba() without
> ufshcd_init() invoked before, for example,
> 
> ufshcd_probe_hba+0xe10/0x1874
> ufshcd_host_reset_and_restore+0x114/0x1a4
> ufshcd_resume+0x1d0/0x480
> ufshcd_runtime_resume+0x40/0x188
> ufshcd_pltfrm_runtime_resume+0x10/0x18
> pm_generic_runtime_resume+0x24/0x44
> __rpm_callback+0x100/0x250
> rpm_resume+0x548/0x7c8
> rpm_resume+0x2b4/0x7c8
> rpm_resume+0x2b4/0x7c8
> rpm_resume+0x2b4/0x7c8
> pm_runtime_work+0x9c/0xa0
> process_one_work+0x210/0x4e0
> worker_thread+0x390/0x520
> kthread+0x154/0x18c
> ret_from_fork+0x10/0x18
> 
> This case happens if link is in "off" state while resume.
> 
> Thanks,
> Stanley

Hi Stanley,

I see skipping ufshcd_set_ufs_dev_active() in ufshcd_probe_hba()
if it is called from ufshcd_resume() path is the purpose here.

If so, then ufshcd_set_dev_pwr_mode() would be called, meaning
SSU command will be sent. Why is this SSU command needed to be
sent after a full host reset and restore? Is ufshcd_probe_hba()
not enough to make UFS device fully functional?

<snip>
         } else if (ufshcd_is_link_off(hba)) {
                 ret = ufshcd_host_reset_and_restore(hba);
                 /*
                  * ufshcd_host_reset_and_restore() should have already
                  * set the link state as active
                  */
                 if (ret || !ufshcd_is_link_active(hba))
                         goto vendor_suspend;
         }

         if (!ufshcd_is_ufs_dev_active(hba)) {
                 ret = ufshcd_set_dev_pwr_mode(hba, UFS_ACTIVE_PWR_MODE);
                 if (ret)
                         goto set_old_link_state;
         }
<snip>

Thanks,

Can Guo.

WARNING: multiple messages have this Message-ID (diff)
From: Can Guo <cang@codeaurora.org>
To: Stanley Chu <stanley.chu@mediatek.com>
Cc: linux-scsi-owner@vger.kernel.org, linux-scsi@vger.kernel.org,
	martin.petersen@oracle.com, subhashj@codeaurora.org,
	jejb@linux.ibm.com, chun-hung.wu@mediatek.com,
	kuohong.wang@mediatek.com, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, avri.altman@wdc.com,
	linux-mediatek@lists.infradead.org, peter.wang@mediatek.com,
	alim.akhtar@samsung.com, andy.teng@mediatek.com,
	matthias.bgg@gmail.com, beanhuo@micron.com,
	pedrom.sousa@synopsys.com, bvanassche@acm.org,
	linux-arm-kernel@lists.infradead.org, asutoshd@codeaurora.org
Subject: Re: [PATCH v1 1/2] scsi: ufs: set device as default active power mode during initialization only
Date: Tue, 31 Dec 2019 10:13:27 +0800	[thread overview]
Message-ID: <836772092daffd8283a97d633e59fc34@codeaurora.org> (raw)
In-Reply-To: <1577754469.13164.5.camel@mtkswgap22>

On 2019-12-31 09:07, Stanley Chu wrote:
> Hi Asutosh,
> 
> 
>> I see that there's a get_sync done before.
>> So, how would the suspend be triggered in that case?
>> 
> 
> Would you mean pm_runtime_get_sync() in ufshcd_init()?
> If yes, it will only happen during initialization.
> 
> The runtime resume path may go through ufshcd_probe_hba() without
> ufshcd_init() invoked before, for example,
> 
> ufshcd_probe_hba+0xe10/0x1874
> ufshcd_host_reset_and_restore+0x114/0x1a4
> ufshcd_resume+0x1d0/0x480
> ufshcd_runtime_resume+0x40/0x188
> ufshcd_pltfrm_runtime_resume+0x10/0x18
> pm_generic_runtime_resume+0x24/0x44
> __rpm_callback+0x100/0x250
> rpm_resume+0x548/0x7c8
> rpm_resume+0x2b4/0x7c8
> rpm_resume+0x2b4/0x7c8
> rpm_resume+0x2b4/0x7c8
> pm_runtime_work+0x9c/0xa0
> process_one_work+0x210/0x4e0
> worker_thread+0x390/0x520
> kthread+0x154/0x18c
> ret_from_fork+0x10/0x18
> 
> This case happens if link is in "off" state while resume.
> 
> Thanks,
> Stanley

Hi Stanley,

I see skipping ufshcd_set_ufs_dev_active() in ufshcd_probe_hba()
if it is called from ufshcd_resume() path is the purpose here.

If so, then ufshcd_set_dev_pwr_mode() would be called, meaning
SSU command will be sent. Why is this SSU command needed to be
sent after a full host reset and restore? Is ufshcd_probe_hba()
not enough to make UFS device fully functional?

<snip>
         } else if (ufshcd_is_link_off(hba)) {
                 ret = ufshcd_host_reset_and_restore(hba);
                 /*
                  * ufshcd_host_reset_and_restore() should have already
                  * set the link state as active
                  */
                 if (ret || !ufshcd_is_link_active(hba))
                         goto vendor_suspend;
         }

         if (!ufshcd_is_ufs_dev_active(hba)) {
                 ret = ufshcd_set_dev_pwr_mode(hba, UFS_ACTIVE_PWR_MODE);
                 if (ret)
                         goto set_old_link_state;
         }
<snip>

Thanks,

Can Guo.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-12-31  2:13 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-30  8:12 [PATCH v1 0/2] scsi: ufs: fix device power mode during PM flow Stanley Chu
2019-12-30  8:12 ` Stanley Chu
2019-12-30  8:12 ` Stanley Chu
2019-12-30  8:12 ` [PATCH v1 1/2] scsi: ufs: set device as default active power mode during initialization only Stanley Chu
2019-12-30  8:12   ` Stanley Chu
2019-12-30  8:12   ` Stanley Chu
2019-12-30 23:24   ` asutoshd
2019-12-30 23:24     ` asutoshd
2019-12-30 23:24     ` asutoshd
2019-12-31  1:07     ` Stanley Chu
2019-12-31  1:07       ` Stanley Chu
2019-12-31  1:07       ` Stanley Chu
2019-12-31  2:13       ` Can Guo [this message]
2019-12-31  2:13         ` Can Guo
2019-12-31  2:13         ` Can Guo
2019-12-31  4:22         ` Stanley Chu
2019-12-31  4:22           ` Stanley Chu
2019-12-31  4:22           ` Stanley Chu
2019-12-31  7:44           ` Stanley Chu
2019-12-31  7:44             ` Stanley Chu
2019-12-31  7:44             ` Stanley Chu
2019-12-31  8:35             ` Can Guo
2019-12-31  8:35               ` Can Guo
2019-12-31  8:35               ` Can Guo
2020-01-02  6:38               ` Stanley Chu
2020-01-02  6:38                 ` Stanley Chu
2020-01-02  6:38                 ` Stanley Chu
2020-01-03  1:51                 ` Can Guo
2020-01-03  1:51                   ` Can Guo
2020-01-03  1:51                   ` Can Guo
2020-01-03  5:28                   ` Can Guo
2020-01-03  5:28                     ` Can Guo
2020-01-03  5:28                     ` Can Guo
2020-01-17  7:57                     ` Stanley Chu
2020-01-17  7:57                       ` Stanley Chu
2020-01-17  7:57                       ` Stanley Chu
2020-01-05  7:55                 ` Avri Altman
2020-01-05  7:55                   ` Avri Altman
2020-01-05  7:55                   ` Avri Altman
2019-12-31  8:05           ` Can Guo
2019-12-31  8:05             ` Can Guo
2019-12-31  8:05             ` Can Guo
2019-12-30  8:12 ` [PATCH v1 2/2] scsi: ufs: remove link_startup_again flow in ufshcd_link_startup Stanley Chu
2019-12-30  8:12   ` Stanley Chu
2019-12-30  8:12   ` Stanley Chu

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=836772092daffd8283a97d633e59fc34@codeaurora.org \
    --to=cang@codeaurora.org \
    --cc=alim.akhtar@samsung.com \
    --cc=andy.teng@mediatek.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=chun-hung.wu@mediatek.com \
    --cc=jejb@linux.ibm.com \
    --cc=kuohong.wang@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-scsi-owner@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=matthias.bgg@gmail.com \
    --cc=pedrom.sousa@synopsys.com \
    --cc=peter.wang@mediatek.com \
    --cc=stable@vger.kernel.org \
    --cc=stanley.chu@mediatek.com \
    --cc=subhashj@codeaurora.org \
    /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.