2020-12-22 07:32:25

by Stanley Chu

[permalink] [raw]
Subject: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

Flush during hibern8 is sufficient on MediaTek platforms, thus
enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL to skip enabling
fWriteBoosterBufferFlush during WriteBooster initialization.

Signed-off-by: Stanley Chu <[email protected]>
---
drivers/scsi/ufs/ufs-mediatek.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index 80618af7c872..c55202b92a43 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -661,6 +661,7 @@ static int ufs_mtk_init(struct ufs_hba *hba)

/* Enable WriteBooster */
hba->caps |= UFSHCD_CAP_WB_EN;
+ hba->quirks |= UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL;
hba->vps->wb_flush_threshold = UFS_WB_BUF_REMAIN_PERCENT(80);

if (host->caps & UFS_MTK_CAP_DISABLE_AH8)
--
2.18.0


2020-12-22 11:37:26

by Can Guo

[permalink] [raw]
Subject: Re: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

On 2020-12-22 15:29, Stanley Chu wrote:
> Flush during hibern8 is sufficient on MediaTek platforms, thus
> enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL to skip enabling
> fWriteBoosterBufferFlush during WriteBooster initialization.
>
> Signed-off-by: Stanley Chu <[email protected]>
> ---
> drivers/scsi/ufs/ufs-mediatek.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/scsi/ufs/ufs-mediatek.c
> b/drivers/scsi/ufs/ufs-mediatek.c
> index 80618af7c872..c55202b92a43 100644
> --- a/drivers/scsi/ufs/ufs-mediatek.c
> +++ b/drivers/scsi/ufs/ufs-mediatek.c
> @@ -661,6 +661,7 @@ static int ufs_mtk_init(struct ufs_hba *hba)
>
> /* Enable WriteBooster */
> hba->caps |= UFSHCD_CAP_WB_EN;
> + hba->quirks |= UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL;
> hba->vps->wb_flush_threshold = UFS_WB_BUF_REMAIN_PERCENT(80);
>
> if (host->caps & UFS_MTK_CAP_DISABLE_AH8)

I guess we need it too...

Change LGTM.

Regards,

Can Guo.

2020-12-23 04:20:55

by Stanley Chu

[permalink] [raw]
Subject: Re: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

Hi Can,

On Tue, 2020-12-22 at 19:34 +0800, Can Guo wrote:
> On 2020-12-22 15:29, Stanley Chu wrote:
> > Flush during hibern8 is sufficient on MediaTek platforms, thus
> > enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL to skip enabling
> > fWriteBoosterBufferFlush during WriteBooster initialization.
> >
> > Signed-off-by: Stanley Chu <[email protected]>
> > ---
> > drivers/scsi/ufs/ufs-mediatek.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/scsi/ufs/ufs-mediatek.c
> > b/drivers/scsi/ufs/ufs-mediatek.c
> > index 80618af7c872..c55202b92a43 100644
> > --- a/drivers/scsi/ufs/ufs-mediatek.c
> > +++ b/drivers/scsi/ufs/ufs-mediatek.c
> > @@ -661,6 +661,7 @@ static int ufs_mtk_init(struct ufs_hba *hba)
> >
> > /* Enable WriteBooster */
> > hba->caps |= UFSHCD_CAP_WB_EN;
> > + hba->quirks |= UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL;
> > hba->vps->wb_flush_threshold = UFS_WB_BUF_REMAIN_PERCENT(80);
> >
> > if (host->caps & UFS_MTK_CAP_DISABLE_AH8)
>
> I guess we need it too...

AHHA, if you decide to add this in your platform too later, maybe we
could change the way it does: Keep manual flush disabled by default and
remove this quirk.

Thanks,
Stanley Chu
>
> Change LGTM.
>
> Regards,
>
> Can Guo.

2020-12-23 04:43:07

by Can Guo

[permalink] [raw]
Subject: Re: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

On 2020-12-23 12:19, Stanley Chu wrote:
> Hi Can,
>
> On Tue, 2020-12-22 at 19:34 +0800, Can Guo wrote:
>> On 2020-12-22 15:29, Stanley Chu wrote:
>> > Flush during hibern8 is sufficient on MediaTek platforms, thus
>> > enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL to skip enabling
>> > fWriteBoosterBufferFlush during WriteBooster initialization.
>> >
>> > Signed-off-by: Stanley Chu <[email protected]>
>> > ---
>> > drivers/scsi/ufs/ufs-mediatek.c | 1 +
>> > 1 file changed, 1 insertion(+)
>> >
>> > diff --git a/drivers/scsi/ufs/ufs-mediatek.c
>> > b/drivers/scsi/ufs/ufs-mediatek.c
>> > index 80618af7c872..c55202b92a43 100644
>> > --- a/drivers/scsi/ufs/ufs-mediatek.c
>> > +++ b/drivers/scsi/ufs/ufs-mediatek.c
>> > @@ -661,6 +661,7 @@ static int ufs_mtk_init(struct ufs_hba *hba)
>> >
>> > /* Enable WriteBooster */
>> > hba->caps |= UFSHCD_CAP_WB_EN;
>> > + hba->quirks |= UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL;
>> > hba->vps->wb_flush_threshold = UFS_WB_BUF_REMAIN_PERCENT(80);
>> >
>> > if (host->caps & UFS_MTK_CAP_DISABLE_AH8)
>>
>> I guess we need it too...
>
> AHHA, if you decide to add this in your platform too later, maybe we
> could change the way it does: Keep manual flush disabled by default and
> remove this quirk.
>

Yeah... I will get back with an answer later.

Thanks,

Can Guo.

> Thanks,
> Stanley Chu
>>
>> Change LGTM.
>>
>> Regards,
>>
>> Can Guo.

2020-12-23 07:51:20

by Avri Altman

[permalink] [raw]
Subject: RE: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

>
> On 2020-12-23 12:19, Stanley Chu wrote:
> > Hi Can,
> >
> > On Tue, 2020-12-22 at 19:34 +0800, Can Guo wrote:
> >> On 2020-12-22 15:29, Stanley Chu wrote:
> >> > Flush during hibern8 is sufficient on MediaTek platforms, thus
> >> > enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL to skip
> enabling
> >> > fWriteBoosterBufferFlush during WriteBooster initialization.
> >> >
> >> > Signed-off-by: Stanley Chu <[email protected]>
> >> > ---
> >> > drivers/scsi/ufs/ufs-mediatek.c | 1 +
> >> > 1 file changed, 1 insertion(+)
> >> >
> >> > diff --git a/drivers/scsi/ufs/ufs-mediatek.c
> >> > b/drivers/scsi/ufs/ufs-mediatek.c
> >> > index 80618af7c872..c55202b92a43 100644
> >> > --- a/drivers/scsi/ufs/ufs-mediatek.c
> >> > +++ b/drivers/scsi/ufs/ufs-mediatek.c
> >> > @@ -661,6 +661,7 @@ static int ufs_mtk_init(struct ufs_hba *hba)
> >> >
> >> > /* Enable WriteBooster */
> >> > hba->caps |= UFSHCD_CAP_WB_EN;
> >> > + hba->quirks |= UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL;
> >> > hba->vps->wb_flush_threshold =
> UFS_WB_BUF_REMAIN_PERCENT(80);
> >> >
> >> > if (host->caps & UFS_MTK_CAP_DISABLE_AH8)
> >>
> >> I guess we need it too...
> >
> > AHHA, if you decide to add this in your platform too later, maybe we
> > could change the way it does: Keep manual flush disabled by default and
> > remove this quirk.
Ack on that.
I never understood why it was needed in the first place.
Maybe just remove it, and allow to perform explicit flush from sysfs.

Thanks,
Avri
> >
>
> Yeah... I will get back with an answer later.

2020-12-23 08:37:33

by Bean Huo

[permalink] [raw]
Subject: Re: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

On Wed, 2020-12-23 at 07:47 +0000, Avri Altman wrote:
> > > could change the way it does: Keep manual flush disabled by
> > > default and
> > > remove this quirk.
>
> Ack on that.
> I never understood why it was needed in the first place.
> Maybe just remove it, and allow to perform explicit flush from sysfs.
>
> Thanks,
> Avr

Avri
I agree with you.
I don't understand why setting that at the begginnning, also assign
this feature the contrller to make desicion.

Bean


2020-12-24 02:23:14

by Can Guo

[permalink] [raw]
Subject: Re: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

On 2020-12-23 12:41, Can Guo wrote:
> On 2020-12-23 12:19, Stanley Chu wrote:
>> Hi Can,
>>
>> On Tue, 2020-12-22 at 19:34 +0800, Can Guo wrote:
>>> On 2020-12-22 15:29, Stanley Chu wrote:
>>> > Flush during hibern8 is sufficient on MediaTek platforms, thus
>>> > enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL to skip enabling
>>> > fWriteBoosterBufferFlush during WriteBooster initialization.
>>> >
>>> > Signed-off-by: Stanley Chu <[email protected]>
>>> > ---
>>> > drivers/scsi/ufs/ufs-mediatek.c | 1 +
>>> > 1 file changed, 1 insertion(+)
>>> >
>>> > diff --git a/drivers/scsi/ufs/ufs-mediatek.c
>>> > b/drivers/scsi/ufs/ufs-mediatek.c
>>> > index 80618af7c872..c55202b92a43 100644
>>> > --- a/drivers/scsi/ufs/ufs-mediatek.c
>>> > +++ b/drivers/scsi/ufs/ufs-mediatek.c
>>> > @@ -661,6 +661,7 @@ static int ufs_mtk_init(struct ufs_hba *hba)
>>> >
>>> > /* Enable WriteBooster */
>>> > hba->caps |= UFSHCD_CAP_WB_EN;
>>> > + hba->quirks |= UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL;
>>> > hba->vps->wb_flush_threshold = UFS_WB_BUF_REMAIN_PERCENT(80);
>>> >
>>> > if (host->caps & UFS_MTK_CAP_DISABLE_AH8)
>>>
>>> I guess we need it too...
>>
>> AHHA, if you decide to add this in your platform too later, maybe we
>> could change the way it does: Keep manual flush disabled by default
>> and
>> remove this quirk.
>>
>
> Yeah... I will get back with an answer later.

Hi Stanley,

Do you see any substantial benefit of having fWriteBoosterBufferFlushEn
disabled?

Thanks,
Can Guo.

>
> Thanks,
>
> Can Guo.
>
>> Thanks,
>> Stanley Chu
>>>
>>> Change LGTM.
>>>
>>> Regards,
>>>
>>> Can Guo.

2020-12-24 07:55:24

by Stanley Chu

[permalink] [raw]
Subject: Re: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

Hi Can,

On Thu, 2020-12-24 at 10:21 +0800, Can Guo wrote:
> On 2020-12-23 12:41, Can Guo wrote:
> > On 2020-12-23 12:19, Stanley Chu wrote:
> >> Hi Can,
> >>
> >> On Tue, 2020-12-22 at 19:34 +0800, Can Guo wrote:
> >>> On 2020-12-22 15:29, Stanley Chu wrote:
> >>> > Flush during hibern8 is sufficient on MediaTek platforms, thus
> >>> > enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL to skip enabling
> >>> > fWriteBoosterBufferFlush during WriteBooster initialization.
> >>> >
> >>> > Signed-off-by: Stanley Chu <[email protected]>
> >>> > ---
> >>> > drivers/scsi/ufs/ufs-mediatek.c | 1 +
> >>> > 1 file changed, 1 insertion(+)
> >>> >
> >>> > diff --git a/drivers/scsi/ufs/ufs-mediatek.c
> >>> > b/drivers/scsi/ufs/ufs-mediatek.c
> >>> > index 80618af7c872..c55202b92a43 100644
> >>> > --- a/drivers/scsi/ufs/ufs-mediatek.c
> >>> > +++ b/drivers/scsi/ufs/ufs-mediatek.c
> >>> > @@ -661,6 +661,7 @@ static int ufs_mtk_init(struct ufs_hba *hba)
> >>> >
> >>> > /* Enable WriteBooster */
> >>> > hba->caps |= UFSHCD_CAP_WB_EN;
> >>> > + hba->quirks |= UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL;
> >>> > hba->vps->wb_flush_threshold = UFS_WB_BUF_REMAIN_PERCENT(80);
> >>> >
> >>> > if (host->caps & UFS_MTK_CAP_DISABLE_AH8)
> >>>
> >>> I guess we need it too...
> >>
> >> AHHA, if you decide to add this in your platform too later, maybe we
> >> could change the way it does: Keep manual flush disabled by default
> >> and
> >> remove this quirk.
> >>
> >
> > Yeah... I will get back with an answer later.
>
> Hi Stanley,
>
> Do you see any substantial benefit of having fWriteBoosterBufferFlushEn
> disabled?

1. The definition of fWriteBoosterBufferFlushEn is that host allows
device to do flush in anytime after fWriteBoosterBufferFlushEn is set as
on. This is not what we want.

Just Like BKOP, We do not want flush happening beyond host's expected
timing that device performance may be "randomly" dropped.

2. Another related concern is that currently fWriteBoosterBufferFlushEn
may keep on while device is not in Active Power Mode during suspend
period. I am not sure if such configuration would confuse the device.

Thanks,
Stanley Chu

>
> Thanks,
> Can Guo.
>
> >
> > Thanks,
> >
> > Can Guo.
> >
> >> Thanks,
> >> Stanley Chu
> >>>
> >>> Change LGTM.
> >>>
> >>> Regards,
> >>>
> >>> Can Guo.

2020-12-24 11:06:19

by Avri Altman

[permalink] [raw]
Subject: RE: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

Hi,
Just to clarify things:

> > Do you see any substantial benefit of having fWriteBoosterBufferFlushEn
> > disabled?
>
> 1. The definition of fWriteBoosterBufferFlushEn is that host allows
> device to do flush in anytime after fWriteBoosterBufferFlushEn is set as
> on. This is not what we want.
>
> Just Like BKOP, We do not want flush happening beyond host's expected
> timing that device performance may be "randomly" dropped.
Explicit flush takes place only when the device is idle:
if fWriteBoosterBufferFlushEn is set, the device is idle, and before h8 received.
If a request arrives, the flush operation should be halted.
So no performance degradation is expected.

>
> 2. Another related concern is that currently fWriteBoosterBufferFlushEn
> may keep on while device is not in Active Power Mode during suspend
> period. I am not sure if such configuration would confuse the device.
The spec says: " While the flushing operation is in progress, the device is in Active power mode"

>
> Thanks,
> Stanley Chu
>
> >
> > Thanks,
> > Can Guo.
> >
> > >
> > > Thanks,
> > >
> > > Can Guo.
> > >
> > >> Thanks,
> > >> Stanley Chu
> > >>>
> > >>> Change LGTM.
> > >>>
> > >>> Regards,
> > >>>
> > >>> Can Guo.

2020-12-24 12:05:19

by Bean Huo

[permalink] [raw]
Subject: Re: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

On Thu, 2020-12-24 at 11:03 +0000, Avri Altman wrote:
> > > Do you see any substantial benefit of having
> > > fWriteBoosterBufferFlushEn
> > > disabled?
> >
> > 1. The definition of fWriteBoosterBufferFlushEn is that host allows
> > device to do flush in anytime after fWriteBoosterBufferFlushEn is
> > set as
> > on. This is not what we want.
> >
> > Just Like BKOP, We do not want flush happening beyond host's
> > expected
> > timing that device performance may be "randomly" dropped.
>
> Explicit flush takes place only when the device is idle:
> if fWriteBoosterBufferFlushEn is set, the device is idle, and before
> h8 received.
> If a request arrives, the flush operation should be halted.
> So no performance degradation is expected.

Hi Stanley

Avri's comment is correct, fWriteBoosterBufferFlushEn==1, device will
flush only when it is in idle, once there is new incoming request, the
flush will be suspended. You should be very careful when you want to
skip this stetting of this flag.

Bean

2020-12-24 13:50:34

by Stanley Chu

[permalink] [raw]
Subject: Re: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

Hi Avri, Bean,

On Thu, 2020-12-24 at 13:01 +0100, Bean Huo wrote:
> On Thu, 2020-12-24 at 11:03 +0000, Avri Altman wrote:
> > > > Do you see any substantial benefit of having
> > > > fWriteBoosterBufferFlushEn
> > > > disabled?
> > >
> > > 1. The definition of fWriteBoosterBufferFlushEn is that host allows
> > > device to do flush in anytime after fWriteBoosterBufferFlushEn is
> > > set as
> > > on. This is not what we want.
> > >
> > > Just Like BKOP, We do not want flush happening beyond host's
> > > expected
> > > timing that device performance may be "randomly" dropped.
> >
> > Explicit flush takes place only when the device is idle:
> > if fWriteBoosterBufferFlushEn is set, the device is idle, and before
> > h8 received.
> > If a request arrives, the flush operation should be halted.
> > So no performance degradation is expected.
>
> Hi Stanley
>
> Avri's comment is correct, fWriteBoosterBufferFlushEn==1, device will
> flush only when it is in idle, once there is new incoming request, the
> flush will be suspended. You should be very careful when you want to
> skip this stetting of this flag.

Very appreciate your the clarification.

However similar to "Background Operations Termination Latency", while
the next request comes, device may need some time to suspend on-going
flush operations. This delay may "randomly" degrade the performance
right?

Since the configuration, i.e., enable
fWriteBoosterBufferFlushDuringHibernate only with
fWriteBoosterBufferFlushEn disabled, has been applied in many of our
mass-produced products these yeas, we would like to keep it unless the
new setting has obvious benefits.

Thanks,
Stanley Chu

>
> Bean
>

2020-12-28 01:35:52

by Asutosh Das (asd)

[permalink] [raw]
Subject: Re: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

On 12/24/2020 5:47 AM, Stanley Chu wrote:
> Hi Avri, Bean,
>
> On Thu, 2020-12-24 at 13:01 +0100, Bean Huo wrote:
>> On Thu, 2020-12-24 at 11:03 +0000, Avri Altman wrote:
>>>>> Do you see any substantial benefit of having
>>>>> fWriteBoosterBufferFlushEn
>>>>> disabled?
>>>>
>>>> 1. The definition of fWriteBoosterBufferFlushEn is that host allows
>>>> device to do flush in anytime after fWriteBoosterBufferFlushEn is
>>>> set as
>>>> on. This is not what we want.
>>>>
>>>> Just Like BKOP, We do not want flush happening beyond host's
>>>> expected
>>>> timing that device performance may be "randomly" dropped.
>>>
>>> Explicit flush takes place only when the device is idle:
>>> if fWriteBoosterBufferFlushEn is set, the device is idle, and before
>>> h8 received.
>>> If a request arrives, the flush operation should be halted.
>>> So no performance degradation is expected.
>>
>> Hi Stanley
>>
>> Avri's comment is correct, fWriteBoosterBufferFlushEn==1, device will
>> flush only when it is in idle, once there is new incoming request, the
>> flush will be suspended. You should be very careful when you want to
>> skip this stetting of this flag.
>
> Very appreciate your the clarification.
>
> However similar to "Background Operations Termination Latency", while
> the next request comes, device may need some time to suspend on-going
> flush operations. This delay may "randomly" degrade the performance
> right?
>

Have you actually seen this happening? I've not come across any random
performance degradation concerns, hence asking.

From what I've observed is the handling of WB buffer flush depends on
how flash vendors implement it. Some vendors that I've seen just create
a separate WB buffer in an instant. I don't know the intricacies of
their implementation, but I guess the new WB buffer handles the requests
while the previous one is being flushed.
Anyway, for Qualcomm platforms we plan to have
fWriteBoosterBufferFlushEn=1 by default.

> Since the configuration, i.e., enable
> fWriteBoosterBufferFlushDuringHibernate only with
> fWriteBoosterBufferFlushEn disabled, has been applied in many of our
> mass-produced products these yeas, we would like to keep it unless the
> new setting has obvious benefits.
>
> Thanks,
> Stanley Chu
>
>>
>> Bean
>>
>


--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
Linux Foundation Collaborative Project

2020-12-28 01:36:26

by Can Guo

[permalink] [raw]
Subject: Re: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

On 2020-12-24 21:47, Stanley Chu wrote:
> Hi Avri, Bean,
>
> On Thu, 2020-12-24 at 13:01 +0100, Bean Huo wrote:
>> On Thu, 2020-12-24 at 11:03 +0000, Avri Altman wrote:
>> > > > Do you see any substantial benefit of having
>> > > > fWriteBoosterBufferFlushEn
>> > > > disabled?
>> > >
>> > > 1. The definition of fWriteBoosterBufferFlushEn is that host allows
>> > > device to do flush in anytime after fWriteBoosterBufferFlushEn is
>> > > set as
>> > > on. This is not what we want.
>> > >
>> > > Just Like BKOP, We do not want flush happening beyond host's
>> > > expected
>> > > timing that device performance may be "randomly" dropped.
>> >
>> > Explicit flush takes place only when the device is idle:
>> > if fWriteBoosterBufferFlushEn is set, the device is idle, and before
>> > h8 received.
>> > If a request arrives, the flush operation should be halted.
>> > So no performance degradation is expected.
>>
>> Hi Stanley
>>
>> Avri's comment is correct, fWriteBoosterBufferFlushEn==1, device will
>> flush only when it is in idle, once there is new incoming request, the
>> flush will be suspended. You should be very careful when you want to
>> skip this stetting of this flag.
>
> Very appreciate your the clarification.
>
> However similar to "Background Operations Termination Latency", while
> the next request comes, device may need some time to suspend on-going
> flush operations. This delay may "randomly" degrade the performance
> right?

That can be case by case (or vendor by vendor), but generally I agree
with you on this.

>
> Since the configuration, i.e., enable
> fWriteBoosterBufferFlushDuringHibernate only with
> fWriteBoosterBufferFlushEn disabled, has been applied in many of our
> mass-produced products these yeas, we would like to keep it unless the
> new setting has obvious benefits.

Thanks for sharing the info. I will leave the decision to Asutosh on
this.

Thanks,
Can Guo.

>
> Thanks,
> Stanley Chu
>
>>
>> Bean
>>

2020-12-28 02:02:41

by Stanley Chu

[permalink] [raw]
Subject: Re: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

Hi Asutosh,

On Sun, 2020-12-27 at 17:32 -0800, Asutosh Das (asd) wrote:
> On 12/24/2020 5:47 AM, Stanley Chu wrote:
> > Hi Avri, Bean,
> >
> > On Thu, 2020-12-24 at 13:01 +0100, Bean Huo wrote:
> >> On Thu, 2020-12-24 at 11:03 +0000, Avri Altman wrote:
> >>>>> Do you see any substantial benefit of having
> >>>>> fWriteBoosterBufferFlushEn
> >>>>> disabled?
> >>>>
> >>>> 1. The definition of fWriteBoosterBufferFlushEn is that host allows
> >>>> device to do flush in anytime after fWriteBoosterBufferFlushEn is
> >>>> set as
> >>>> on. This is not what we want.
> >>>>
> >>>> Just Like BKOP, We do not want flush happening beyond host's
> >>>> expected
> >>>> timing that device performance may be "randomly" dropped.
> >>>
> >>> Explicit flush takes place only when the device is idle:
> >>> if fWriteBoosterBufferFlushEn is set, the device is idle, and before
> >>> h8 received.
> >>> If a request arrives, the flush operation should be halted.
> >>> So no performance degradation is expected.
> >>
> >> Hi Stanley
> >>
> >> Avri's comment is correct, fWriteBoosterBufferFlushEn==1, device will
> >> flush only when it is in idle, once there is new incoming request, the
> >> flush will be suspended. You should be very careful when you want to
> >> skip this stetting of this flag.
> >
> > Very appreciate your the clarification.
> >
> > However similar to "Background Operations Termination Latency", while
> > the next request comes, device may need some time to suspend on-going
> > flush operations. This delay may "randomly" degrade the performance
> > right?
> >
>
> Have you actually seen this happening? I've not come across any random
> performance degradation concerns, hence asking.
>
> From what I've observed is the handling of WB buffer flush depends on
> how flash vendors implement it. Some vendors that I've seen just create
> a separate WB buffer in an instant. I don't know the intricacies of
> their implementation, but I guess the new WB buffer handles the requests
> while the previous one is being flushed.
> Anyway, for Qualcomm platforms we plan to have
> fWriteBoosterBufferFlushEn=1 by default.

Thanks for above information and discussion : )

Actually we've not come across any random performance degradation due to
fWriteBoosterBufferFlushEn=1 as well. Since the implementation of
fWriteBoosterBufferFlushEn may differ by different vendors, we would
like to keep current configuration used in our mass-produced products
first.

But this is an interesting topic for possible termination latency of
WriteBooster flush. Maybe we could discuss with vendors to explicitly
define the required latency in UFS specification, just like "Background
Operations Termination Latency"? Then host can choose the best
configuration according to the definition provided by the device.

Thanks.
Stanley Chu
>
> > Since the configuration, i.e., enable
> > fWriteBoosterBufferFlushDuringHibernate only with
> > fWriteBoosterBufferFlushEn disabled, has been applied in many of our
> > mass-produced products these yeas, we would like to keep it unless the
> > new setting has obvious benefits.
> >
> > Thanks,
> > Stanley Chu
> >
> >>
> >> Bean
> >>
> >
>
>

2020-12-28 13:03:44

by Avri Altman

[permalink] [raw]
Subject: RE: [PATCH v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL


> >
> > On 2020-12-23 12:19, Stanley Chu wrote:
> > > Hi Can,
> > >
> > > On Tue, 2020-12-22 at 19:34 +0800, Can Guo wrote:
> > >> On 2020-12-22 15:29, Stanley Chu wrote:
> > >> > Flush during hibern8 is sufficient on MediaTek platforms, thus
> > >> > enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL to skip
> > enabling
> > >> > fWriteBoosterBufferFlush during WriteBooster initialization.
> > >> >
> > >> > Signed-off-by: Stanley Chu <[email protected]>
Reviewed-by: Avri Altman <[email protected]>