diff mbox series

[v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

Message ID 20201222072928.32328-1-stanley.chu@mediatek.com (mailing list archive)
State New, archived
Headers show
Series [v1] scsi: ufs-mediatek: Enable UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL | expand

Commit Message

Stanley Chu Dec. 22, 2020, 7:29 a.m. UTC
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 <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufs-mediatek.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Can Guo Dec. 22, 2020, 11:34 a.m. UTC | #1
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 <stanley.chu@mediatek.com>
> ---
>  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.
Stanley Chu Dec. 23, 2020, 4:19 a.m. UTC | #2
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 <stanley.chu@mediatek.com>
> > ---
> >  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.
Can Guo Dec. 23, 2020, 4:41 a.m. UTC | #3
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 <stanley.chu@mediatek.com>
>> > ---
>> >  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.
Avri Altman Dec. 23, 2020, 7:47 a.m. UTC | #4
> 
> 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 <stanley.chu@mediatek.com>
> >> > ---
> >> >  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.
Bean Huo Dec. 23, 2020, 8:35 a.m. UTC | #5
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
Can Guo Dec. 24, 2020, 2:21 a.m. UTC | #6
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 <stanley.chu@mediatek.com>
>>> > ---
>>> >  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.
Stanley Chu Dec. 24, 2020, 7:52 a.m. UTC | #7
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 <stanley.chu@mediatek.com>
> >>> > ---
> >>> >  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.
Avri Altman Dec. 24, 2020, 11:03 a.m. UTC | #8
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.
Bean Huo Dec. 24, 2020, 12:01 p.m. UTC | #9
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
Stanley Chu Dec. 24, 2020, 1:47 p.m. UTC | #10
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
>
Asutosh Das (asd) Dec. 28, 2020, 1:32 a.m. UTC | #11
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
>>
>
Can Guo Dec. 28, 2020, 1:33 a.m. UTC | #12
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
>>
Stanley Chu Dec. 28, 2020, 2 a.m. UTC | #13
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
> >>
> > 
> 
>
Avri Altman Dec. 28, 2020, 12:59 p.m. UTC | #14
> >
> > 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 <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
diff mbox series

Patch

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)