2020-09-15 20:51:36

by Jaegeuk Kim

[permalink] [raw]
Subject: [PATCH 1/6] scsi: ufs: atomic update for clkgating_enable

From: Jaegeuk Kim <[email protected]>

When giving a stress test which enables/disables clkgating, we hit device
timeout sometimes. This patch avoids subtle racy condition to address it.

Cc: Alim Akhtar <[email protected]>
Cc: Avri Altman <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
---
drivers/scsi/ufs/ufshcd.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 1d157ff58d817..d929c3d1e58cc 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1791,19 +1791,19 @@ static ssize_t ufshcd_clkgate_enable_store(struct device *dev,
return -EINVAL;

value = !!value;
+
+ spin_lock_irqsave(hba->host->host_lock, flags);
if (value == hba->clk_gating.is_enabled)
goto out;

- if (value) {
- ufshcd_release(hba);
- } else {
- spin_lock_irqsave(hba->host->host_lock, flags);
+ if (value)
+ hba->clk_gating.active_reqs--;
+ else
hba->clk_gating.active_reqs++;
- spin_unlock_irqrestore(hba->host->host_lock, flags);
- }

hba->clk_gating.is_enabled = value;
out:
+ spin_unlock_irqrestore(hba->host->host_lock, flags);
return count;
}

--
2.28.0.618.gf4bc123cb7-goog


2020-09-15 20:52:06

by Jaegeuk Kim

[permalink] [raw]
Subject: [PATCH 5/6] scsi: ufs: show ufs part info in error case

From: Jaegeuk Kim <[email protected]>

This patch shows ufs part info in kernel messages for debugging purpose.
It's useful when we only have the last kernel message.

Cc: Alim Akhtar <[email protected]>
Cc: Avri Altman <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
---
drivers/scsi/ufs/ufshcd.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index bdc82cc3824aa..b81c116b976ff 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -500,6 +500,14 @@ static void ufshcd_print_tmrs(struct ufs_hba *hba, unsigned long bitmap)
static void ufshcd_print_host_state(struct ufs_hba *hba)
{
dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state);
+ if (hba->sdev_ufs_device) {
+ dev_err(hba->dev, " vendor = %.8s\n",
+ hba->sdev_ufs_device->vendor);
+ dev_err(hba->dev, " model = %.16s\n",
+ hba->sdev_ufs_device->model);
+ dev_err(hba->dev, " rev = %.4s\n",
+ hba->sdev_ufs_device->rev);
+ }
dev_err(hba->dev, "outstanding reqs=0x%lx tasks=0x%lx\n",
hba->outstanding_reqs, hba->outstanding_tasks);
dev_err(hba->dev, "saved_err=0x%x, saved_uic_err=0x%x\n",
--
2.28.0.618.gf4bc123cb7-goog

2020-09-15 20:52:48

by Jaegeuk Kim

[permalink] [raw]
Subject: [PATCH 4/6] scsi: ufs: fix LINERESET on hibern8

From: Jaegeuk Kim <[email protected]>

When testing infinite test to read sysfs entries of UFS, I got a UFS timeout
with the following kernel message.

query: dev_cmd_send: seq_no=78082 tag=31, idn=2
query: ufshcd_wait_for_dev_cmd: dev_cmd request timedout, tag 31
query: __ufshcd_query_descriptor: opcode 0x01 for idn 2 failed, index 0, err = -11
-- hibern8: dme: dme_send: cmd_id=0x17 idn=0
query: ufshcd_query_descriptor: failed with error -11, retries 3
-- hibern8: ufshcd_update_uic_error: LINERESET during hibern8 enter
-- hibern8: __ufshcd_uic_hibern8_enter: hibern8 enter failed. ret = -110

The problem is casued by hibern8 command issued by ufshcd_suspend(), which is
not aware of query command. If autohibern8 is enabled, we actually don't need
to issue hibern8 command by suspend.

Cc: Alim Akhtar <[email protected]>
Cc: Avri Altman <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
---
drivers/scsi/ufs/ufshcd.c | 20 ++++++++++++++++++--
drivers/scsi/ufs/ufshcd.h | 1 +
2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 848e33ec40639..bdc82cc3824aa 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -3079,8 +3079,12 @@ int ufshcd_query_descriptor_retry(struct ufs_hba *hba,
int retries;

for (retries = QUERY_REQ_RETRIES; retries > 0; retries--) {
- err = __ufshcd_query_descriptor(hba, opcode, idn, index,
+ err = -EAGAIN;
+ down_read(&hba->query_lock);
+ if (!ufshcd_is_link_hibern8(hba))
+ err = __ufshcd_query_descriptor(hba, opcode, idn, index,
selector, desc_buf, buf_len);
+ up_read(&hba->query_lock);
if (!err || err == -EINVAL)
break;
}
@@ -8263,8 +8267,8 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
enum ufs_pm_level pm_lvl;
enum ufs_dev_pwr_mode req_dev_pwr_mode;
enum uic_link_state req_link_state;
+ bool need_upwrite = false;

- hba->pm_op_in_progress = 1;
if (!ufshcd_is_shutdown_pm(pm_op)) {
pm_lvl = ufshcd_is_runtime_pm(pm_op) ?
hba->rpm_lvl : hba->spm_lvl;
@@ -8275,6 +8279,15 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
req_link_state = UIC_LINK_OFF_STATE;
}

+ if (ufshcd_is_runtime_pm(pm_op) &&
+ req_link_state == UIC_LINK_HIBERN8_STATE &&
+ hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) {
+ need_upwrite = true;
+ if (!down_write_trylock(&hba->query_lock))
+ return -EBUSY;
+ }
+ hba->pm_op_in_progress = 1;
+
/*
* If we can't transition into any of the low power modes
* just gate the clocks.
@@ -8403,6 +8416,8 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
}

hba->pm_op_in_progress = 0;
+ if (need_upwrite)
+ up_write(&hba->query_lock);

if (ret)
ufshcd_update_reg_hist(&hba->ufs_stats.suspend_err, (u32)ret);
@@ -8894,6 +8909,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
mutex_init(&hba->dev_cmd.lock);

init_rwsem(&hba->clk_scaling_lock);
+ init_rwsem(&hba->query_lock);

ufshcd_init_clk_gating(hba);

diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 363589c0bd370..6f8e05eaf9661 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -754,6 +754,7 @@ struct ufs_hba {
bool is_urgent_bkops_lvl_checked;

struct rw_semaphore clk_scaling_lock;
+ struct rw_semaphore query_lock;
unsigned char desc_size[QUERY_DESC_IDN_MAX];
atomic_t scsi_block_reqs_cnt;

--
2.28.0.618.gf4bc123cb7-goog

2020-09-15 20:57:12

by Jaegeuk Kim

[permalink] [raw]
Subject: [PATCH 3/6] scsi: ufs: use WQ_HIGHPRI for gating work

From: Jaegeuk Kim <[email protected]>

Must have WQ_MEM_RECLAIM
``WQ_MEM_RECLAIM``
All wq which might be used in the memory reclaim paths **MUST**
have this flag set. The wq is guaranteed to have at least one
execution context regardless of memory pressure.

Cc: Alim Akhtar <[email protected]>
Cc: Avri Altman <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
---
drivers/scsi/ufs/ufshcd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 5deba03a61f75..848e33ec40639 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1849,7 +1849,7 @@ static void ufshcd_init_clk_gating(struct ufs_hba *hba)
snprintf(wq_name, ARRAY_SIZE(wq_name), "ufs_clk_gating_%d",
hba->host->host_no);
hba->clk_gating.clk_gating_workq = alloc_ordered_workqueue(wq_name,
- WQ_MEM_RECLAIM);
+ WQ_MEM_RECLAIM | WQ_HIGHPRI);

hba->clk_gating.is_enabled = true;

--
2.28.0.618.gf4bc123cb7-goog

2020-09-15 20:57:35

by Jaegeuk Kim

[permalink] [raw]
Subject: [PATCH 2/6] scsi: ufs: clear UAC for FFU

From: Jaegeuk Kim <[email protected]>

In order to conduct FFU or RPMB operations, UFS needs to clear UAC. This patch
clears it explicitly, so that we could get no failure given early execution.

Cc: Alim Akhtar <[email protected]>
Cc: Avri Altman <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
---
drivers/scsi/ufs/ufshcd.c | 41 +++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index d929c3d1e58cc..5deba03a61f75 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -7385,6 +7385,45 @@ static int ufshcd_add_lus(struct ufs_hba *hba)
return ret;
}

+static int
+ufshcd_send_request_sense(struct ufs_hba *hba, struct scsi_device *sdp);
+
+static int ufshcd_clear_uac(struct ufs_hba *hba)
+{
+ struct scsi_device *sdp;
+ unsigned long flags;
+ int ret = 0;
+
+ spin_lock_irqsave(hba->host->host_lock, flags);
+ sdp = hba->sdev_ufs_device;
+ if (sdp) {
+ ret = scsi_device_get(sdp);
+ if (!ret && !scsi_device_online(sdp)) {
+ ret = -ENODEV;
+ scsi_device_put(sdp);
+ }
+ } else {
+ ret = -ENODEV;
+ }
+ spin_unlock_irqrestore(hba->host->host_lock, flags);
+ if (ret)
+ goto out_err;
+
+ if (hba->wlun_dev_clr_ua) {
+ ret = ufshcd_send_request_sense(hba, sdp);
+ if (ret)
+ goto out;
+ /* Unit attention condition is cleared now */
+ hba->wlun_dev_clr_ua = false;
+ }
+out:
+ scsi_device_put(sdp);
+out_err:
+ if (ret)
+ dev_err(hba->dev, "%s: Failed UAC clear ret = %d\n", __func__, ret);
+ return ret;
+}
+
/**
* ufshcd_probe_hba - probe hba to detect device and initialize
* @hba: per-adapter instance
@@ -7500,6 +7539,8 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie)
pm_runtime_put_sync(hba->dev);
ufshcd_exit_clk_scaling(hba);
ufshcd_hba_exit(hba);
+ } else {
+ ufshcd_clear_uac(hba);
}
}

--
2.28.0.618.gf4bc123cb7-goog

2020-09-16 11:21:40

by Bean Huo

[permalink] [raw]
Subject: Re: [PATCH 5/6] scsi: ufs: show ufs part info in error case

On Tue, 2020-09-15 at 13:45 -0700, Jaegeuk Kim wrote:
> Cc: Avri Altman <[email protected]>
> Signed-off-by: Jaegeuk Kim <[email protected]>
> ---
> drivers/scsi/ufs/ufshcd.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index bdc82cc3824aa..b81c116b976ff 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -500,6 +500,14 @@ static void ufshcd_print_tmrs(struct ufs_hba
> *hba, unsigned long bitmap)
> static void ufshcd_print_host_state(struct ufs_hba *hba)
> {
> dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state);
> + if (hba->sdev_ufs_device) {
> + dev_err(hba->dev, " vendor = %.8s\n",
> + hba->sdev_ufs_device-
> >vendor);
> + dev_err(hba->dev, " model = %.16s\n",
> + hba->sdev_ufs_device->model);
> + dev_err(hba->dev, " rev = %.4s\n",
> + hba->sdev_ufs_device->rev);
> + }

Hi Jaegeuk
these prints have been added since this change:

commit 3f8af6044713 ("scsi: ufs: Add some debug information to
ufshcd_print_host_state()")

https://patchwork.kernel.org/patch/11694371/

Thanks,
Bean

2020-09-16 18:27:19

by Jaegeuk Kim

[permalink] [raw]
Subject: Re: [PATCH 5/6] scsi: ufs: show ufs part info in error case

On 09/16, Bean Huo wrote:
> On Tue, 2020-09-15 at 13:45 -0700, Jaegeuk Kim wrote:
> > Cc: Avri Altman <[email protected]>
> > Signed-off-by: Jaegeuk Kim <[email protected]>
> > ---
> > drivers/scsi/ufs/ufshcd.c | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> > index bdc82cc3824aa..b81c116b976ff 100644
> > --- a/drivers/scsi/ufs/ufshcd.c
> > +++ b/drivers/scsi/ufs/ufshcd.c
> > @@ -500,6 +500,14 @@ static void ufshcd_print_tmrs(struct ufs_hba
> > *hba, unsigned long bitmap)
> > static void ufshcd_print_host_state(struct ufs_hba *hba)
> > {
> > dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state);
> > + if (hba->sdev_ufs_device) {
> > + dev_err(hba->dev, " vendor = %.8s\n",
> > + hba->sdev_ufs_device-
> > >vendor);
> > + dev_err(hba->dev, " model = %.16s\n",
> > + hba->sdev_ufs_device->model);
> > + dev_err(hba->dev, " rev = %.4s\n",
> > + hba->sdev_ufs_device->rev);
> > + }
>
> Hi Jaegeuk
> these prints have been added since this change:
>
> commit 3f8af6044713 ("scsi: ufs: Add some debug information to
> ufshcd_print_host_state()")
>
> https://patchwork.kernel.org/patch/11694371/

Cool, thank you for pointing this out. BTW, which branch can I see the -next
patches?

>
> Thanks,
> Bean

2020-09-17 01:01:28

by Can Guo

[permalink] [raw]
Subject: Re: [PATCH 5/6] scsi: ufs: show ufs part info in error case

On 2020-09-17 00:05, Jaegeuk Kim wrote:
> On 09/16, Bean Huo wrote:
>> On Tue, 2020-09-15 at 13:45 -0700, Jaegeuk Kim wrote:
>> > Cc: Avri Altman <[email protected]>
>> > Signed-off-by: Jaegeuk Kim <[email protected]>
>> > ---
>> > drivers/scsi/ufs/ufshcd.c | 8 ++++++++
>> > 1 file changed, 8 insertions(+)
>> >
>> > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
>> > index bdc82cc3824aa..b81c116b976ff 100644
>> > --- a/drivers/scsi/ufs/ufshcd.c
>> > +++ b/drivers/scsi/ufs/ufshcd.c
>> > @@ -500,6 +500,14 @@ static void ufshcd_print_tmrs(struct ufs_hba
>> > *hba, unsigned long bitmap)
>> > static void ufshcd_print_host_state(struct ufs_hba *hba)
>> > {
>> > dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state);
>> > + if (hba->sdev_ufs_device) {
>> > + dev_err(hba->dev, " vendor = %.8s\n",
>> > + hba->sdev_ufs_device-
>> > >vendor);
>> > + dev_err(hba->dev, " model = %.16s\n",
>> > + hba->sdev_ufs_device->model);
>> > + dev_err(hba->dev, " rev = %.4s\n",
>> > + hba->sdev_ufs_device->rev);
>> > + }
>>
>> Hi Jaegeuk
>> these prints have been added since this change:
>>
>> commit 3f8af6044713 ("scsi: ufs: Add some debug information to
>> ufshcd_print_host_state()")
>>
>> https://patchwork.kernel.org/patch/11694371/
>
> Cool, thank you for pointing this out. BTW, which branch can I see the
> -next
> patches?
>

Hi Jaegeuk,

This patch comes from a series of changes trying to fix and simplify
the UFS error handling. You can find the whole series here - they are
picked up on scsi-queue-5.10

https://lore.kernel.org/linux-scsi/[email protected]/

Besides, several more fixes for error handling based on above series are

https://lore.kernel.org/patchwork/patch/1290405/
&
https://lore.kernel.org/linux-scsi/[email protected]/

I've mainline all above changes to Android12-5.4 and Android11-5.4.

Moreover, there are 2 more fixes on the way for error handling, I
will push them soon.

Thanks,

Can Guo.

>>
>> Thanks,
>> Bean

2020-09-18 04:16:01

by Jaegeuk Kim

[permalink] [raw]
Subject: Re: [PATCH 4/6] scsi: ufs: fix LINERESET on hibern8

Please ignore this patch.
Thanks.

On 09/15, Jaegeuk Kim wrote:
> From: Jaegeuk Kim <[email protected]>
>
> When testing infinite test to read sysfs entries of UFS, I got a UFS timeout
> with the following kernel message.
>
> query: dev_cmd_send: seq_no=78082 tag=31, idn=2
> query: ufshcd_wait_for_dev_cmd: dev_cmd request timedout, tag 31
> query: __ufshcd_query_descriptor: opcode 0x01 for idn 2 failed, index 0, err = -11
> -- hibern8: dme: dme_send: cmd_id=0x17 idn=0
> query: ufshcd_query_descriptor: failed with error -11, retries 3
> -- hibern8: ufshcd_update_uic_error: LINERESET during hibern8 enter
> -- hibern8: __ufshcd_uic_hibern8_enter: hibern8 enter failed. ret = -110
>
> The problem is casued by hibern8 command issued by ufshcd_suspend(), which is
> not aware of query command. If autohibern8 is enabled, we actually don't need
> to issue hibern8 command by suspend.
>
> Cc: Alim Akhtar <[email protected]>
> Cc: Avri Altman <[email protected]>
> Signed-off-by: Jaegeuk Kim <[email protected]>
> ---
> drivers/scsi/ufs/ufshcd.c | 20 ++++++++++++++++++--
> drivers/scsi/ufs/ufshcd.h | 1 +
> 2 files changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 848e33ec40639..bdc82cc3824aa 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -3079,8 +3079,12 @@ int ufshcd_query_descriptor_retry(struct ufs_hba *hba,
> int retries;
>
> for (retries = QUERY_REQ_RETRIES; retries > 0; retries--) {
> - err = __ufshcd_query_descriptor(hba, opcode, idn, index,
> + err = -EAGAIN;
> + down_read(&hba->query_lock);
> + if (!ufshcd_is_link_hibern8(hba))
> + err = __ufshcd_query_descriptor(hba, opcode, idn, index,
> selector, desc_buf, buf_len);
> + up_read(&hba->query_lock);
> if (!err || err == -EINVAL)
> break;
> }
> @@ -8263,8 +8267,8 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
> enum ufs_pm_level pm_lvl;
> enum ufs_dev_pwr_mode req_dev_pwr_mode;
> enum uic_link_state req_link_state;
> + bool need_upwrite = false;
>
> - hba->pm_op_in_progress = 1;
> if (!ufshcd_is_shutdown_pm(pm_op)) {
> pm_lvl = ufshcd_is_runtime_pm(pm_op) ?
> hba->rpm_lvl : hba->spm_lvl;
> @@ -8275,6 +8279,15 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
> req_link_state = UIC_LINK_OFF_STATE;
> }
>
> + if (ufshcd_is_runtime_pm(pm_op) &&
> + req_link_state == UIC_LINK_HIBERN8_STATE &&
> + hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) {
> + need_upwrite = true;
> + if (!down_write_trylock(&hba->query_lock))
> + return -EBUSY;
> + }
> + hba->pm_op_in_progress = 1;
> +
> /*
> * If we can't transition into any of the low power modes
> * just gate the clocks.
> @@ -8403,6 +8416,8 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
> }
>
> hba->pm_op_in_progress = 0;
> + if (need_upwrite)
> + up_write(&hba->query_lock);
>
> if (ret)
> ufshcd_update_reg_hist(&hba->ufs_stats.suspend_err, (u32)ret);
> @@ -8894,6 +8909,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
> mutex_init(&hba->dev_cmd.lock);
>
> init_rwsem(&hba->clk_scaling_lock);
> + init_rwsem(&hba->query_lock);
>
> ufshcd_init_clk_gating(hba);
>
> diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
> index 363589c0bd370..6f8e05eaf9661 100644
> --- a/drivers/scsi/ufs/ufshcd.h
> +++ b/drivers/scsi/ufs/ufshcd.h
> @@ -754,6 +754,7 @@ struct ufs_hba {
> bool is_urgent_bkops_lvl_checked;
>
> struct rw_semaphore clk_scaling_lock;
> + struct rw_semaphore query_lock;
> unsigned char desc_size[QUERY_DESC_IDN_MAX];
> atomic_t scsi_block_reqs_cnt;
>
> --
> 2.28.0.618.gf4bc123cb7-goog

2020-09-18 04:17:18

by Jaegeuk Kim

[permalink] [raw]
Subject: Re: [PATCH 5/6] scsi: ufs: show ufs part info in error case

On 09/17, Can Guo wrote:
> On 2020-09-17 00:05, Jaegeuk Kim wrote:
> > On 09/16, Bean Huo wrote:
> > > On Tue, 2020-09-15 at 13:45 -0700, Jaegeuk Kim wrote:
> > > > Cc: Avri Altman <[email protected]>
> > > > Signed-off-by: Jaegeuk Kim <[email protected]>
> > > > ---
> > > > drivers/scsi/ufs/ufshcd.c | 8 ++++++++
> > > > 1 file changed, 8 insertions(+)
> > > >
> > > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> > > > index bdc82cc3824aa..b81c116b976ff 100644
> > > > --- a/drivers/scsi/ufs/ufshcd.c
> > > > +++ b/drivers/scsi/ufs/ufshcd.c
> > > > @@ -500,6 +500,14 @@ static void ufshcd_print_tmrs(struct ufs_hba
> > > > *hba, unsigned long bitmap)
> > > > static void ufshcd_print_host_state(struct ufs_hba *hba)
> > > > {
> > > > dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state);
> > > > + if (hba->sdev_ufs_device) {
> > > > + dev_err(hba->dev, " vendor = %.8s\n",
> > > > + hba->sdev_ufs_device-
> > > > >vendor);
> > > > + dev_err(hba->dev, " model = %.16s\n",
> > > > + hba->sdev_ufs_device->model);
> > > > + dev_err(hba->dev, " rev = %.4s\n",
> > > > + hba->sdev_ufs_device->rev);
> > > > + }
> > >
> > > Hi Jaegeuk
> > > these prints have been added since this change:
> > >
> > > commit 3f8af6044713 ("scsi: ufs: Add some debug information to
> > > ufshcd_print_host_state()")
> > >
> > > https://patchwork.kernel.org/patch/11694371/
> >
> > Cool, thank you for pointing this out. BTW, which branch can I see the
> > -next
> > patches?
> >
>
> Hi Jaegeuk,
>
> This patch comes from a series of changes trying to fix and simplify
> the UFS error handling. You can find the whole series here - they are
> picked up on scsi-queue-5.10
>
> https://lore.kernel.org/linux-scsi/[email protected]/
>
> Besides, several more fixes for error handling based on above series are
>
> https://lore.kernel.org/patchwork/patch/1290405/
> &
> https://lore.kernel.org/linux-scsi/[email protected]/
>
> I've mainline all above changes to Android12-5.4 and Android11-5.4.

I've seen the patches in Android branches. Thank you for the explanation.

>
> Moreover, there are 2 more fixes on the way for error handling, I
> will push them soon.

BTW, could you please take a look at these patches?

Thanks,

>
> Thanks,
>
> Can Guo.
>
> > >
> > > Thanks,
> > > Bean

2020-09-22 08:27:13

by Can Guo

[permalink] [raw]
Subject: Re: [PATCH 5/6] scsi: ufs: show ufs part info in error case

On 2020-09-18 12:13, Jaegeuk Kim wrote:
> On 09/17, Can Guo wrote:
>> On 2020-09-17 00:05, Jaegeuk Kim wrote:
>> > On 09/16, Bean Huo wrote:
>> > > On Tue, 2020-09-15 at 13:45 -0700, Jaegeuk Kim wrote:
>> > > > Cc: Avri Altman <[email protected]>
>> > > > Signed-off-by: Jaegeuk Kim <[email protected]>
>> > > > ---
>> > > > drivers/scsi/ufs/ufshcd.c | 8 ++++++++
>> > > > 1 file changed, 8 insertions(+)
>> > > >
>> > > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
>> > > > index bdc82cc3824aa..b81c116b976ff 100644
>> > > > --- a/drivers/scsi/ufs/ufshcd.c
>> > > > +++ b/drivers/scsi/ufs/ufshcd.c
>> > > > @@ -500,6 +500,14 @@ static void ufshcd_print_tmrs(struct ufs_hba
>> > > > *hba, unsigned long bitmap)
>> > > > static void ufshcd_print_host_state(struct ufs_hba *hba)
>> > > > {
>> > > > dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state);
>> > > > + if (hba->sdev_ufs_device) {
>> > > > + dev_err(hba->dev, " vendor = %.8s\n",
>> > > > + hba->sdev_ufs_device-
>> > > > >vendor);
>> > > > + dev_err(hba->dev, " model = %.16s\n",
>> > > > + hba->sdev_ufs_device->model);
>> > > > + dev_err(hba->dev, " rev = %.4s\n",
>> > > > + hba->sdev_ufs_device->rev);
>> > > > + }
>> > >
>> > > Hi Jaegeuk
>> > > these prints have been added since this change:
>> > >
>> > > commit 3f8af6044713 ("scsi: ufs: Add some debug information to
>> > > ufshcd_print_host_state()")
>> > >
>> > > https://patchwork.kernel.org/patch/11694371/
>> >
>> > Cool, thank you for pointing this out. BTW, which branch can I see the
>> > -next
>> > patches?
>> >
>>
>> Hi Jaegeuk,
>>
>> This patch comes from a series of changes trying to fix and simplify
>> the UFS error handling. You can find the whole series here - they are
>> picked up on scsi-queue-5.10
>>
>> https://lore.kernel.org/linux-scsi/[email protected]/
>>
>> Besides, several more fixes for error handling based on above series
>> are
>>
>> https://lore.kernel.org/patchwork/patch/1290405/
>> &
>> https://lore.kernel.org/linux-scsi/[email protected]/
>>
>> I've mainline all above changes to Android12-5.4 and Android11-5.4.
>
> I've seen the patches in Android branches. Thank you for the
> explanation.
>
>>
>> Moreover, there are 2 more fixes on the way for error handling, I
>> will push them soon.
>
> BTW, could you please take a look at these patches?
>
> Thanks,
>

Sure, but since I am not in your cc or to list, so I don't know which
patches. Maybe you can add me when you push the next version? Thanks.

Regards,

Can Guo.

>>
>> Thanks,
>>
>> Can Guo.
>>
>> > >
>> > > Thanks,
>> > > Bean