On 2026/09/22 15:43, Oliver Upton wrote:
Hi Akihiko,

On Sun, Sep 20, 2026 at 08:15:49PM +0900, Akihiko Odaki wrote:
This reverts commit fe53538069bb4f625bc8734103ba044a83138fea.

Restore PMU event teardown before system-register reset so existing
perf events cannot retain configuration from the previous run. All
counters are disabled by the reset PMCR_EL0 and MDCR_EL2 values, so
reset does not need to request a PMU reload.

Sorry, I'm not following the intent here. KVM_REQ_RELOAD_PMU should
already be discarding + recomputing perf events based on the state of
the vPMU. What's the problem?

Hi Oliver,

A plain KVM_REQ_RELOAD_PMU does not discard existing perf events. kvm_pmu_reprogram_counter_mask() enables or disables them, and kvm_pmc_enable_perf_event() only creates an event if none exists.

For example, an existing cycle-counter event may exclude EL0 counting. Reset sets PMCCFILTR_EL0 to zero, but the subsequent reload only disables that event. If the guest then enables cycle counting without rewriting the filter or counter, the old event is enabled again and still excludes EL0, despite PMCCFILTR_EL0 reading as zero.

The earlier "Recreate events after reset" patch addressed this by setting events_need_recreate. Sashiko then pointed out that stopping the old events after resetting the registers adds their accumulated counts to the reset counter values:

https://sashiko.dev/#/message/20260914-hybrid-v10-7-92788053a691%40rsg.ci.i.u-tokyo.ac.jp

The revert restores teardown before system-register reset and fixes the stale configuration.

Regards,
Akihiko Odaki

Reply via email to