sophgo / linux-riscv

Linux kernel stable tree
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
Other
23 stars 47 forks source link

riscv: configs: enable RISCV_PMU #118

Closed boletus-edulis closed 4 months ago

boletus-edulis commented 4 months ago

I noticed that some userland apps are broken using sg2042-dev-6.6. I got SIGILL when using rdcycle instruction. By setting CONFIG_RISCV_PMU the code works again.

This was fixed in the following patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cc4c07c89aada16229084eeb93895c95b7eabaa3

Although this is just a temporary solution, i would appreciate it if this patch could be accepted until the userland code gets fixed.

skeuchel commented 4 months ago

You can also set

sysctl -w kernel.perf_user_access=2

to allow user mode access to rdcycle. Just out of curiosity, which userland code are you referring to?

boletus-edulis commented 4 months ago

You can also set

sysctl -w kernel.perf_user_access=2

Ah ok, good to know, if i have time i might try that.

to allow user mode access to rdcycle. Just out of curiosity, which userland code are you referring to?

While bootstrapping NixOS, in particular some protobuf tests failed to run.

boletus-edulis commented 4 months ago

You can also set

sysctl -w kernel.perf_user_access=2

to allow user mode access to rdcycle. Just out of curiosity, which userland code are you referring to?

boletus-edulis commented 4 months ago

sysctl -w kernel.perf_user_access=2

Yes, this was needed. actually RISCV_PMU is enabled by default anyway. I don't know what i tested. Sorry for the noise.