Hardware events on hikey 960


#1

Enabling hadrware config on hikey 960.
When i run simpleperf list, I get the following output.
hikey960:/ # simpleperf list
List of hw-cache events:

List of hardware events:

List of software events:
cpu-clock
task-clock
page-faults
context-switches
cpu-migrations
minor-faults
major-faults
alignment-faults
emulation-faults

List of tracepoint events:
9p:9p_client_req
9p:9p_client_res
9p:9p_protocol_dump
android_fs:android_fs_dataread_end
android_fs:android_fs_dataread_start
android_fs:android_fs_datawrite_end
android_fs:android_fs_datawrite_start
asoc:snd_soc_bias_level_done
asoc:snd_soc_bias_level_start
asoc:snd_soc_dapm_connected
asoc:snd_soc_dapm_done
asoc:snd_soc_dapm_path
asoc:snd_soc_dapm_start
asoc:snd_soc_dapm_walk_done
asoc:snd_soc_dapm_widget_event_done
asoc:snd_soc_dapm_widget_event_start
asoc:snd_soc_dapm_wi… and so oon

Can anyone please help in enabling the CONFIG_HW_PERF_EVENTS in the configuaration file. Also the location of the configuration file


#2

Hi @susmithagankidi,

I think the first thing is to check DT binding [1] and kernel config CONFIG_ARM_PMU=y, the kernel configuration is selected by default for ARM and ARM64 platforms [2]

[1] https://android.googlesource.com/kernel/hikey-linaro/+/android-hikey-linaro-4.9/arch/arm64/boot/dts/hisilicon/hi3660.dtsi#285
[2] https://android.googlesource.com/kernel/hikey-linaro/+/android-hikey-linaro-4.9/drivers/perf/Kconfig#10


#3

Hello@leo-yan
I have the following in my KCONFIG file

Performance Monitor Drivers

menu “Performance monitor support”

config ARM_PMU
depends on PERF_EVENTS && (ARM || ARM64)
bool "ARM PMU framework"
default y
help
Say y if you want to use CPU performance monitors on ARM-based
systems.

config XGENE_PMU
depends on PERF_EVENTS && ARCH_XGENE
bool "APM X-Gene SoC PMU"
default n
help
Say y if you want to use APM X-Gene SoC performance monitors.

endmenu

And I do not find any difference between this code and the one in the link. Does this mean it is already selected.

One more question is that, I was trying to run the simpleperf command on the default android already given with the board, and I do not get the location of the kernel config in that.


#4

I tried to use Android kernel 4.9 [1] and I can confirm the ‘simpleperf’ command can read out PMU events on my Hikey960 board:

130|console:/ # simpleperf list                                        
  L1-dcache-loads                                                                                                                                                                                                                  
  L1-dcache-load-misses                                                                                                                                                                                                            
  L1-dcache-stores                                                                                                                                                                                                                 
  L1-dcache-store-misses                                                                                                                                                                                                           
  L1-icache-loads                                                                                                                                                                                                                  
  L1-icache-load-misses                                                                                                                                                                                                            
  dTLB-load-misses                                                                                                                                                                                                                 
  iTLB-load-misses                                                                                                                                                                                                                 
  branch-loads                                                                                                                                                                                                                     
  branch-load-misses                                                                                                                                                                                                               
  branch-stores                                                                                                                                                                                                                    
  branch-store-misses                                                                                                                                                                                                              
                                                                                                                                                                                                                                   
List of hardware events:                                                                                                                                                                                                           
  cpu-cycles                                                                                                                                                                                                                       
  instructions                                                                                                                                                                                                                     
  cache-references                                                                                                                                                                                                                 
  cache-misses                                                                                                                                                                                                                     
  branch-instructions                                                                                                                                                                                                              
  branch-misses                                                                                                                                                                                                                    
  bus-cycles           

And in sysfs, I can see below nodes for PMU device:

127|hikey960:/ # ls /sys/devices/armv8_pmuv3/*
/sys/devices/armv8_pmuv3/cpus   /sys/devices/armv8_pmuv3/type   /sys/devices/armv8_pmuv3/perf_event_mux_interval_ms /sys/devices/armv8_pmuv3/uevent 

/sys/devices/armv8_pmuv3/events:
br_immed_retired br_pred           bus_access cid_write_retired exc_return inst_retired l1d_cache        l1d_cache_wb   l1i_cache        l1i_tlb_refill l2d_cache_refill mem_access       sw_incr            
br_mis_pred      br_return_retired bus_cycles cpu_cycles        exc_taken  inst_spec    l1d_cache_refill l1d_tlb_refill l1i_cache_refill l2d_cache      l2d_cache_wb     pc_write_retired ttbr_write_retired 

/sys/devices/armv8_pmuv3/format:
event            

/sys/devices/armv8_pmuv3/power:
autosuspend_delay_ms control runtime_active_time runtime_status runtime_suspended_time 

/sys/devices/armv8_pmuv3/subsystem:
devices drivers drivers_autoprobe drivers_probe uevent 

[1] https://android.googlesource.com/kernel/hikey-linaro/+/android-hikey-linaro-4.9


#5

Hello,
My board has the default android pre built and it is not displaying the hardware counters. Do I have to update my OS ?


#6

Hello

Is there a way to create LXC containers on the hikey 960 board ??


#7

Hello,
I have changed the OS on it, and now it gives me the hardware performance counter details. Thank you for the help.