scsi: ufs: wb: Add explicit flush_threshold sysfs attribute
authorLu Hongfei <luhongfei@vivo.com>
Tue, 13 Jun 2023 02:22:34 +0000 (10:22 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 16 Jun 2023 16:04:31 +0000 (12:04 -0400)
commite3d55626cff32cf7defff7f2053672adc4a712da
tree21c5dfbfa6090e2dc878ba81fbc913d20c20be0f
parent56541c7c4468a9de26d82ba6e8c10ace286f8fdd
scsi: ufs: wb: Add explicit flush_threshold sysfs attribute

There are three flags that control Write Booster Feature:

    1. WB ON/OFF
    2. WB Hibern Flush ON/OFF (implicitly)
    3. WB Flush ON/OFF (explicit)

In the case of "Hibern Flush", one of the conditions for flush WB buffer is
that avail_wb_buff < wb_flush_threshold.

As we know, different users have different requirements for power
consumption and performance. Therefore, we need the ability to manually set
wb_flush_threshold, so that users can easily and flexibly adjust the
wb_flush_threshold value, thereby achieving a balance between power
consumption and performance.

So the sysfs attribute that controls this is necessary.

wb_flush_threshold represents the threshold for flushing WB buffer, whose
value expressed in unit of 10% granularity, such as '1' representing 10%,
'2' representing 20%, and so on.

Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
Link: https://lore.kernel.org/r/20230613022240.16595-1-luhongfei@vivo.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Documentation/ABI/testing/sysfs-driver-ufs
drivers/ufs/core/ufs-sysfs.c