diff options
author | Atish Patra <atishp@rivosinc.com> | 2025-03-03 14:53:06 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-04-10 14:37:26 +0200 |
commit | b9ad6385ca4d988903350b25cb63689a16f8c4b1 (patch) | |
tree | eec8b869f892c38e68d6fc58436c5be685e1fcea /arch | |
parent | 3c64a5bacb6b29cb40fcdfa27fc56712bab0d41d (diff) | |
download | linux-b9ad6385ca4d988903350b25cb63689a16f8c4b1.tar.gz linux-b9ad6385ca4d988903350b25cb63689a16f8c4b1.tar.bz2 linux-b9ad6385ca4d988903350b25cb63689a16f8c4b1.zip |
RISC-V: KVM: Disable the kernel perf counter during configure
[ Upstream commit bbb622488749478955485765ddff9d56be4a7e4b ]
The perf event should be marked disabled during the creation as
it is not ready to be scheduled until there is SBI PMU start call
or config matching is called with auto start. Otherwise, event add/start
gets called during perf_event_create_kernel_counter function.
It will be enabled and scheduled to run via perf_event_enable during
either the above mentioned scenario.
Fixes: 0cb74b65d2e5 ("RISC-V: KVM: Implement perf support without sampling")
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Atish Patra <atishp@rivosinc.com>
Link: https://lore.kernel.org/r/20250303-kvm_pmu_improve-v2-1-41d177e45929@rivosinc.com
Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/riscv/kvm/vcpu_pmu.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/riscv/kvm/vcpu_pmu.c b/arch/riscv/kvm/vcpu_pmu.c index cee1b9ca4ec4..e2e2a115afb5 100644 --- a/arch/riscv/kvm/vcpu_pmu.c +++ b/arch/riscv/kvm/vcpu_pmu.c @@ -468,6 +468,7 @@ int kvm_riscv_vcpu_pmu_ctr_cfg_match(struct kvm_vcpu *vcpu, unsigned long ctr_ba .type = etype, .size = sizeof(struct perf_event_attr), .pinned = true, + .disabled = true, /* * It should never reach here if the platform doesn't support the sscofpmf * extension as mode filtering won't work without it. |