mbox series

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

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

Message

Can Guo March 31, 2021, 3:14 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

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

Can Guo March 31, 2021, 3:52 a.m. UTC | #1
On 2021-03-31 11:34, Bart Van Assche wrote:
> On 3/30/21 8:14 PM, Can Guo wrote:
>> 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
> 
> Are any of these attributes UFS-specific? If not, isn't this
> functionality that should be added to the block layer instead of to the
> UFS driver?
> 

Hi Bart,

I didn't think that before because we've already have the powerful 
"blktrace"
tool to collect the overall statistics of each layer.

I add this because I find it really come handy when 
debug/analyze/profile
UFS driver/HW performance. And there will be UFS-specific nodes to be
added later to monitor statistics like UFS scaling, gating, doorbell, 
write
booster, HPB and etc.

Thanks.

Can Guo.

> Thanks,
> 
> Bart.
Avri Altman March 31, 2021, 6:35 a.m. UTC | #2
> On 2021-03-31 11:34, Bart Van Assche wrote:
> > On 3/30/21 8:14 PM, Can Guo wrote:
> >> 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
> >
> > Are any of these attributes UFS-specific? If not, isn't this
> > functionality that should be added to the block layer instead of to the
> > UFS driver?
> >
> 
> Hi Bart,
> 
> I didn't think that before because we've already have the powerful
> "blktrace"
> tool to collect the overall statistics of each layer.
> 
> I add this because I find it really come handy when
> debug/analyze/profile
> UFS driver/HW performance. And there will be UFS-specific nodes to be
> added later to monitor statistics like UFS scaling, gating, doorbell,
> write
> booster, HPB and etc.
We are using a designated analysis tool (web-based, a lot of fancy graphs etc.) that relies on ftrace - upiu tracer etc.
Once the raw data is there - the options/insights are endless.

Thanks,
Avri
> 
> Thanks.
> 
> Can Guo.
> 
> > Thanks,
> >
> > Bart.