Re: [PATCH v2 09/54] perf: core/x86: Register a new vector for KVM GUEST PMI

Peter Zijlstra
2024-05-07T09:17:32Z

On Mon, May 06, 2024 at 05:29:34AM +0000, Mingwei Zhang wrote:

> +void kvm_set_guest_pmi_handler(void (*handler)(void))
> +{
> + if (handler) {
> + kvm_guest_pmi_handler = handler;
> + } else {
> + kvm_guest_pmi_handler = dummy_handler;
> + synchronize_rcu();
> + }
> +}
> +EXPORT_SYMBOL_GPL(kvm_set_guest_pmi_handler);

Just for my edification, after synchronize_rcu() nobody should observe
the old handler, but what guarantees there's not still one running?

I'm thinking the fact that these handlers run with IRQs disabled, and
synchronize_rcu() also very much ensures all prior non-preempt sections
are complete?