How to check RISC-V CPU sscofpmf extension in runtime?
Hello, Atish.
I have tested perf on Starfive Visionfive2 board.
I want to know how to check sscofpmf extension support in user program or tools.
user@starfive:~/CppTest$ ~/starfive-visionfive2-linux/tools/perf/perf record -g ./main.o Error: The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cycles:u). /bin/dmesg | grep -i perf may provide additional information.
[ 2.356857] riscv-pmu-sbi: SBI PMU extension is available [ 2.362841] riscv-pmu-sbi: 16 firmware and 4 hardware counters [ 2.369302] riscv-pmu-sbi: Perf sampling/filtering is not supported
as sscof extension is not available
user@starfive:$ grep PERF_EVENT /boot/config-5.15.0-dirty CONFIG_HAVE_PERF_EVENTS=y CONFIG_PERF_EVENTS=y
So, I find "sscof extension is not available" position of the code
drivers/perf/riscv_pmu_sbi.cpmu_sbi_device_probe()
ret = pmu_sbi_setup_irqs(pmu, pdev);
I think adding the result value to the logs will give us a mor detail. I want to patch :)
I did perf test.
~/starfive-visionfive2-linux/tools/perf/perf test
1: vmlinux symtab matches kallsyms : FAILED! 2: Detect openat syscall event : FAILED! 3: Detect openat syscall event on all cpus : FAILED! 4: Read samples using the mmap interface : FAILED! 5: Test data source output : Ok 6: Parse event definition strings : FAILED! 7: Simple expression parser : Ok 8: PERF_RECORD_* events & perf_sample fields : FAILED! 9: Parse perf pmu format : Ok 10: PMU events : 10.1: PMU event table sanity : FAILED! 10.2: PMU event map aliases : FAILED! 10.3: Parsing of PMU event table metrics : Ok 10.4: Parsing of PMU event table metrics with fake PMUs: Ok 11: DSO data read : Ok 12: DSO data cache : Ok 13: DSO data reopen : Ok 14: Roundtrip evsel->name : Ok 15: Parse sched tracepoints fields : FAILED! 16: syscalls:sys_enter_openat event fields : FAILED! 17: Setup struct perf_event_attr : Skip 18: Match and link multiple hists : Ok 19: 'import perf' in python : FAILED! 20: Breakpoint overflow signal handler : FAILED! 21: Breakpoint overflow sampling : FAILED! 22: Breakpoint accounting : Skip 23: Watchpoint : 23.1: Read Only Watchpoint : FAILED! 23.2: Write Only Watchpoint : FAILED! 23.3: Read / Write Watchpoint : FAILED! 23.4: Modify Watchpoint : FAILED! 24: Number of exit events of a simple workload : FAILED! 25: Software clock events period values : Ok 26: Object code reading : FAILED! 27: Sample parsing : Ok 28: Use a dummy software event to keep tracking: Skip 29: Parse with no sample_id_all bit set : Ok 30: Filter hist entries : Ok 31: Lookup mmap thread : Ok 32: Share thread maps : Ok 33: Sort output of hist entries : Ok 34: Cumulate child hist entries : Ok 35: Track with sched_switch : Ok 36: Filter fds with revents mask in a fdarray : Ok 37: Add fd to a fdarray, making it autogrow : Ok 38: kmod_path__parse : Ok 39: Thread map : Ok 40: LLVM search and compile :
40.1: Basic BPF llvm compile : Skip
40.2: kbuild searching : Skip
40.3: Compile source for BPF prologue generation: Skip
40.4: Compile source for BPF relocation : Skip
41: Session topology : FAILED! 42: BPF filter : 42.1: Basic BPF filtering : Skip 42.2: BPF pinning : Skip 43: Synthesize thread map : Ok 44: Remove thread map : Ok 45: Synthesize cpu map : Ok 46: Synthesize stat config : Ok 47: Synthesize stat : Ok 48: Synthesize stat round : Ok 49: Synthesize attr update : Ok 50: Event times : Skip 51: Read backward ring buffer : Skip 52: Print cpu map : Ok 53: Merge cpu map : Ok 54: Probe SDT events : Ok 55: is_printable_array : Ok 56: Print bitmap : Ok 57: perf hooks : Ok 58: builtin clang support : Skip (not compiled in) 59: unit_number__scnprintf : Ok 60: mem2node : Ok 61: time utils : Ok 62: Test jit_write_elf : Skip 63: Test libpfm4 support : Skip (not compiled in) 64: Test api io : Ok 65: maps__merge_in : Ok 66: Demangle Java : Ok 67: Demangle OCaml : Ok 68: Parse and process metrics : Ok 69: PE file support : Skip 70: Event expansion for cgroups : Ok 72: dlfilter C API : Ok
failed to open shell test directory:/home/user/libexec/perf-core/tests/shell
BR
Paran Lee