Skip to content
Commit fa12277f authored by Shifrin Dmitry's avatar Shifrin Dmitry Committed by Greg Kroah-Hartman
Browse files

perf: riscv: Fix selecting counters in legacy mode



[ Upstream commit 941a8e9b7a86763ac52d5bf6ccc9986d37fde628 ]

It is required to check event type before checking event config.
Events with the different types can have the same config.
This check is missed for legacy mode code

For such perf usage:
    sysctl -w kernel.perf_user_access=2
    perf stat -e cycles,L1-dcache-loads --
driver will try to force both events to CYCLE counter.

This commit implements event type check before forcing
events on the special counters.

Signed-off-by: default avatarShifrin Dmitry <dmitry.shifrin@syntacore.com>
Reviewed-by: default avatarAtish Patra <atishp@rivosinc.com>
Fixes: cc4c07c8 ("drivers: perf: Implement perf event mmap support in the SBI backend")
Link: https://lore.kernel.org/r/20240729125858.630653-1-dmitry.shifrin@syntacore.com


Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 10b26868
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment