Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add riscv64 binding #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add riscv64 binding #28

wants to merge 1 commit into from

Conversation

Avimitin
Copy link

This PR add perf-even-open-sys riscv64 binding. Binding is generated from Arch Linux RISC-V with kernel headers 6.0.9 on SiFive Unmatched RISC-V board. Build verfied on SiFive Unmatched RISC-V board.

Signed-off-by: Avimitin [email protected]

This commit add perf-even-open-sys riscv64 binding. Binding is generated
from Arch Linux RISC-V with kernel headers 6.0.9 on SiFive Unmatched
RISC-V board. Build verfied on SiFive Unmatched RISC-V board.

Signed-off-by: Avimitin <[email protected]>
@xusine
Copy link

xusine commented Mar 10, 2023

I am wondering when this PR can be merged. I tested this PR because I happened to measuredd some IPC numbers on SiFive Unmatched board, and it reports same result as using perf.

@matsbror
Copy link

matsbror commented Jun 21, 2023

I tried this PR on a VisionFive2 board from StarFive, and could not get any of the examples to work.

I built a project with the println.rs example and got this when running:
Error: Os { code: 22, kind: InvalidInput, message: "Invalid argument" }

This happens on line: let mut counter = Builder::new().build()?;

I'm new to this so I would need help with pointers on where to look how to debug this.

I'm on: Linux ubuntu 6.2.0-19-generic #19.1-Ubuntu SMP Fri Mar 31 12:41:53 UTC 2023 riscv64 riscv64 riscv64 GNU/Linux

@xusine
Copy link

xusine commented Jun 21, 2023

@matsbror My experience with Unmatched is that we cannot use group, and you have to also include OS when running perf, because at present its PMU cannot tell the user space instructions or kernel space instructions.

@matsbror
Copy link

matsbror commented Jun 21, 2023

and you have to also include OS when running perf, because at present its PMU cannot tell the user space instructions or kernel space instructions.

I'm not sure I understand what you mean by "also include OS when running perf". Can you elaborate?

It's unfortunate that I cannot use group, but the example I was running did not use Group.

@xusine
Copy link

xusine commented Jun 21, 2023

and you have to also include OS when running perf, because at present its PMU cannot tell the user space instructions or kernel space instructions.

I'm not sure I understand what you mean by "also include OS when running perf". Can you elaborate?

It's unfortunate that I cannot use group, but the example I was running did not use Group.

Yes. In my case, I need to call include_kernel and include_hv when building the counter:

let mut total_inst = Builder::new()
        .include_kernel()
        .include_hv()
        .kind(events::Hardware::INSTRUCTIONS)
        .any_pid()
        .one_cpu(1)
        .build()
        .unwrap();

These functions are not available for the crate in crates.rs, but is available in current repository.
Hope this is helpful.

@matsbror
Copy link

Thanks, this was indeed helpful. I tried using Group and all counters returned 0. Do you have any idea why groups cannot be used?

@xusine
Copy link

xusine commented Jun 22, 2023

Thanks, this was indeed helpful. I tried using Group and all counters returned 0. Do you have any idea why groups cannot be used?

I have no idea. Maybe the board does not have hardware support to read multiple counters atomically.

@matsbror
Copy link

By trial and error I found that Groups does wok for my board. I just need to be careful which counters I am using. It works apparently only for the ones supported in hardware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants