mbox series

[v5,0/2] Introduce hba performance monitoring sysfs nodes

Message ID 1619058521-35307-1-git-send-email-cang@codeaurora.org
Headers show
Series Introduce hba performance monitoring sysfs nodes | expand

Message

Can Guo April 22, 2021, 2:28 a.m. UTC
Add a new sysfs group which has nodes to monitor data/request transfer
performance. This sysfs group has nodes showing total sectors/requests
transferred, total busy time spent and max/min/avg/sum latencies. This
group can be enhanced later to show more UFS driver layer performance
data during runtime.

It works like:
/sys/bus/platform/drivers/ufshcd/*/monitor # echo 4096 > monitor_chunk_size
/sys/bus/platform/drivers/ufshcd/*/monitor # echo 1 > monitor_enable
/sys/bus/platform/drivers/ufshcd/*/monitor # grep ^ /dev/null *
monitor_chunk_size:4096
monitor_enable:1
read_nr_requests:17
read_req_latency_avg:169
read_req_latency_max:594
read_req_latency_min:66
read_req_latency_sum:2887
read_total_busy:2639
read_total_sectors:136
write_nr_requests:116
write_req_latency_avg:440
write_req_latency_max:4921
write_req_latency_min:23
write_req_latency_sum:51052
write_total_busy:19584
write_total_sectors:928

Change since v4:
- Use lrbp->compl_time_stamp as now in ufshcd_update_monitor()

Change since v3:
- Rebased

Change since v2:
- Fixed a sparse error

Change since v1:
- Moved code from ufs-qcom.c to ufshcd.c


Can Guo (2):
  scsi: ufs: Introduce hba performance monitor sysfs nodes
  scsi: ufs: Add support for hba performance monitor

 Documentation/ABI/testing/sysfs-driver-ufs | 126 +++++++++++++++
 drivers/scsi/ufs/ufs-sysfs.c               | 237 +++++++++++++++++++++++++++++
 drivers/scsi/ufs/ufshcd.c                  |  62 ++++++++
 drivers/scsi/ufs/ufshcd.h                  |  21 +++
 4 files changed, 446 insertions(+)

Comments

Daejun Park May 6, 2021, 5 a.m. UTC | #1
Hi Can Guo,

>Add a new sysfs group which has nodes to monitor data/request transfer

>performance. This sysfs group has nodes showing total sectors/requests

>transferred, total busy time spent and max/min/avg/sum latencies. This

>group can be enhanced later to show more UFS driver layer performance

>data during runtime.


This series looks good to me.
Reviewed-by: Daejun Park <daejun7.park@samsung.com>


Thanks,
Daejun
Bean Huo May 12, 2021, 8:21 p.m. UTC | #2
On Wed, 2021-04-21 at 19:28 -0700, Can Guo wrote:
> +

> 

> +static DEVICE_ATTR_RW(monitor_enable);

> 

> +static DEVICE_ATTR_RW(monitor_chunk_size);

> 

> +static DEVICE_ATTR_RO(read_total_sectors);

> 

> +static DEVICE_ATTR_RO(read_total_busy);

> 

> +static DEVICE_ATTR_RO(read_nr_requests);

> 

> +static DEVICE_ATTR_RO(read_req_latency_avg);

> 

> +static DEVICE_ATTR_RO(read_req_latency_max);

> 

> +static DEVICE_ATTR_RO(read_req_latency_min);

> 

> +static DEVICE_ATTR_RO(read_req_latency_sum);

> 

> +static DEVICE_ATTR_RO(write_total_sectors);

> 

> +static DEVICE_ATTR_RO(write_total_busy);

> 

> +static DEVICE_ATTR_RO(write_nr_requests);

> 

> +static DEVICE_ATTR_RO(write_req_latency_avg);

> 

> +static DEVICE_ATTR_RO(write_req_latency_max);

> 

> +static DEVICE_ATTR_RO(write_req_latency_min);

> 

> +static DEVICE_ATTR_RO(write_req_latency_sum);


Can,

I like this series of patches, which can help me monitor UFS
performance online. I have a suggestion,  how do you think that we add
this to ufs-debugfs. Then we don't need to poll each parameter one by
one, just one interface.

Bean
Can Guo May 13, 2021, 1:15 a.m. UTC | #3
On 2021-05-13 04:21, Bean Huo wrote:
> On Wed, 2021-04-21 at 19:28 -0700, Can Guo wrote:

>> +

>> 

>> +static DEVICE_ATTR_RW(monitor_enable);

>> 

>> +static DEVICE_ATTR_RW(monitor_chunk_size);

>> 

>> +static DEVICE_ATTR_RO(read_total_sectors);

>> 

>> +static DEVICE_ATTR_RO(read_total_busy);

>> 

>> +static DEVICE_ATTR_RO(read_nr_requests);

>> 

>> +static DEVICE_ATTR_RO(read_req_latency_avg);

>> 

>> +static DEVICE_ATTR_RO(read_req_latency_max);

>> 

>> +static DEVICE_ATTR_RO(read_req_latency_min);

>> 

>> +static DEVICE_ATTR_RO(read_req_latency_sum);

>> 

>> +static DEVICE_ATTR_RO(write_total_sectors);

>> 

>> +static DEVICE_ATTR_RO(write_total_busy);

>> 

>> +static DEVICE_ATTR_RO(write_nr_requests);

>> 

>> +static DEVICE_ATTR_RO(write_req_latency_avg);

>> 

>> +static DEVICE_ATTR_RO(write_req_latency_max);

>> 

>> +static DEVICE_ATTR_RO(write_req_latency_min);

>> 

>> +static DEVICE_ATTR_RO(write_req_latency_sum);

> 

> Can,

> 

> I like this series of patches, which can help me monitor UFS

> performance online. I have a suggestion,  how do you think that we add

> this to ufs-debugfs. Then we don't need to poll each parameter one by

> one, just one interface.

> 

> Bean


Hi Bean,

Thanks for your suggestion, put it into debugfs is also an option.
But on Android, debugfs is not mounted by default (the requirement
from Google). So it is convenient to have it in sysfs, and one can
use below cmd (as I listed in the cover letter) to poll all parameters
at once : "grep ^ /dev/null *".

Thanks,
Can Guo.
Bean Huo May 13, 2021, 9:10 p.m. UTC | #4
On Wed, 2021-04-21 at 19:28 -0700, Can Guo wrote:
> Add a new sysfs group which has nodes to monitor data/request

> transfer

> 

> performance. This sysfs group has nodes showing total

> sectors/requests

> 

> transferred, total busy time spent and max/min/avg/sum latencies.

> This

> 

> group can be enhanced later to show more UFS driver layer performance

> 

> statistics data during runtime.

> 

> 

> 

> Signed-off-by: Can Guo <cang@codeaurora.org>

Acked-by: Bean Huo <beanhuo@micron.com>
Martin K. Petersen May 15, 2021, 2:56 a.m. UTC | #5
Can,

> Add a new sysfs group which has nodes to monitor data/request transfer

> performance. This sysfs group has nodes showing total sectors/requests

> transferred, total busy time spent and max/min/avg/sum latencies. This

> group can be enhanced later to show more UFS driver layer performance

> data during runtime.


Applied to 5.14/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering