Unverified Commit 50c172c5 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!226 Intel SPR: Adding core PMU support for OLK-5.10

Merge Pull Request from: @allen-shi 
 
This is a cherry-pick of [PR62](https://gitee.com/openeuler/kernel/pulls/62) from openEuler-22.09 branch.


This patchset is to enable Intel SPR core PMU support.
The first 5 patches enable Intel SPR core PMU support.
The last 3 patches fix bugs introduced by the above 5 patches.

 **Intel Kernel Issue** 
[#I596BF](https://gitee.com/openeuler/intel-kernel/issues/I596BF)

 **Test:** 
With this patch set:

```
        \# perf stat -e L1-dcache-load-misses -- sleep 1
        
         Performance counter stats for 'sleep 1':
        
                    10,134      L1-dcache-load-misses
        
               1.000727264 seconds time elapsed
        
               0.000584000 seconds user
               0.000000000 seconds sys
```

Without this patch set, it returns event "not supported":

```
        # perf stat -e L1-dcache-load-misses -- sleep 1
        
         Performance counter stats for 'sleep 1':
        
           <not supported>      L1-dcache-load-misses
        
               1.001434664 seconds time elapsed
        
               0.000000000 seconds user
               0.001318000 seconds sys
```

Some other tests:

```
# perf mem record -- sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.030 MB perf.data (24 samples) ]
[root@spr4s01 linux]# perf script --fields comm,weight,ip,sym
       perf-exec                0 ffffffffaf80cb0b __intel_pmu_enable_all.constprop.0
       perf-exec              489 ffffffffafdfa612 acpi_os_read_memory
       perf-exec              359 ffffffffafa67daa perf_iterate_ctx
       perf-exec              435 ffffffffafa67daa perf_iterate_ctx
       perf-exec              123 ffffffffafa6d0eb perf_event_addr_filters_exec
       perf-exec              168 ffffffffafa67daa perf_iterate_ctx
           sleep              163 ffffffffafa67d72 perf_iterate_ctx
           sleep              174 ffffffffafa67d72 perf_iterate_ctx
           sleep               83 ffffffffafa67d92 perf_iterate_ctx
           sleep              159 ffffffffafa67d7c perf_iterate_ctx
           sleep              133 ffffffffafa67d7c perf_iterate_ctx
           sleep                0 ffffffffafa886aa filemap_map_pages
           sleep                0 ffffffffaf80cb0b __intel_pmu_enable_all.constprop.0
           sleep              184 ffffffffafa67d92 perf_iterate_ctx
           sleep                0 ffffffffb025029e sync_regs
           sleep                0 ffffffffafa886aa filemap_map_pages
           sleep                0     7ffb7f2b7ba0 [unknown]
           sleep                0     7ffb7f2b7cd1 [unknown]
           sleep              150 ffffffffafa67d92 perf_iterate_ctx
           sleep                0 ffffffffafa886aa filemap_map_pages
           sleep                0 ffffffffafae8a37 page_remove_file_rmap
           sleep                0 ffffffffafad1c2f zap_pte_range
           sleep                0 ffffffffafad1c2f zap_pte_range
           sleep                0 ffffffffafaec00c unlink_anon_vmas

# perf record -e cpu/event=0xcd,umask=0x1/ -e cpu/event=0x03,umask=0x82/ -- cat /proc/cpuinfo
    ……
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.029 MB perf.data (175 samples) ]
# perf script|head -5
             cat 254544 10879.930447:          1 cpu/event=0x03,umask=0x82/:  ffffffffa7653768 memcpy_erms+0x8 (vmlinux)
             cat 254544 10879.930511:          1 cpu/event=0x03,umask=0x82/:  ffffffffa6cda323 vm_area_dup+0x63 (vmlinux)
             cat 254544 10879.930513:          2 cpu/event=0x03,umask=0x82/:  ffffffffa6edf233 __split_vma+0xa3 (vmlinux)
             cat 254544 10879.930564:         32 cpu/event=0x03,umask=0x82/:  ffffffffa6e8b2a7 filemap_fault+0x2d7 (vmlinux)
             cat 254544 10879.930656:         48 cpu/event=0x03,umask=0x82/:  ffffffffa76504de sync_regs+0x1e (vmlinux)

        
# perf record -e instructions:ppp -a -- true
[ perf record: Woken up 0 times to write data ]
[ perf record: Captured and wrote 0.775 MB perf.data (3142 samples) ]
# perf script|head -5
            perf 254537 [000] 10812.672089:          1 instructions:ppp:  ffffffffa764f883 do_syscall_64+0x33 (vmlinux)
            perf 254537 [000] 10812.672101:          1 instructions:ppp:  ffffffffa6c262cd nmi_handle+0x6d (vmlinux)
            perf 254537 [000] 10812.672103:          4 instructions:ppp:  ffffffffa6c2bcb5 native_sched_clock+0x5 (vmlinux)
            perf 254537 [000] 10812.672104:         74 instructions:ppp:  ffffffffa6c2bcb5 native_sched_clock+0x5 (vmlinux)
            perf 254537 [000] 10812.672105:       1779 instructions:ppp:  ffffffffa6c2bcb5 native_sched_clock+0x5 (vmlinux)

# perf record -d --data-page-size -e major-faults -a -- sleep 1
Error:
Asking for the data page size isnt supported by this kernel.

# perf record -d -e major-faults -a -- sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.497 MB perf.data (3 samples) ]
# perf script
            perf 25239 [447]   660.473507:          1 major-faults:            5c6d74 perf_mmap__consume+0x24 (/usr/bin/perf)
            perf 25239 [447]   660.473876:          1 major-faults:            5c6d74 perf_mmap__consume+0x24 (/usr/bin/perf)
            perf 25239 [447]   660.474401:          1 major-faults:            5c6d74 perf_mmap__consume+0x24 (/usr/bin/perf)
# perf script --fields comm,addr
            perf     7fe0459a3408
            perf     7fe03ec0d408
            perf     7fe0333de408
```

 **Known Issue:** 
N/A

 **Default Config Change:** 
N/A 
 
Link:https://gitee.com/openeuler/kernel/pulls/226

 
Reviewed-by: default avatarChen Wei <chenwei@xfusion.com>
Reviewed-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parents 188b2ee0 de1c4296
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment