[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d78063c8-8f0d-31ec-0626-a4a4ab013d5b@redhat.com>
Date: Thu, 7 Feb 2019 09:42:03 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Luwei Kang <luwei.kang@...el.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, tglx@...utronix.de, mingo@...hat.com,
bp@...en8.de, hpa@...or.com, x86@...nel.org, songliubraving@...com,
rkrcmar@...hat.com, zsm@...omium.org,
alexander.shishkin@...ux.intel.com, konrad.wilk@...cle.com,
ak@...ux.intel.com
Subject: Re: [PATCH 2/3] perf/x86/intel/pt: Inject PMI for KVM guest
On 06/02/19 17:34, Peter Zijlstra wrote:
>
> How about we extend perf_guest_info_callback with an arch section and
> add:
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 5aeb4c74fb99..76ce804e72c1 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -5835,6 +5835,9 @@ struct perf_guest_info_callbacks *perf_guest_cbs;
>
> int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)
> {
> + if (WARN_ON_ONCE(perf_guest_cbs))
> + return -EBUSY;
> +
> perf_guest_cbs = cbs;
> return 0;
> }
> @@ -5842,6 +5845,9 @@ EXPORT_SYMBOL_GPL(perf_register_guest_info_callbacks);
>
> int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)
> {
> + if (WARN_ON_ONCE(perf_guest_cbs != cbs))
> + return -EINVAL;
> +
> perf_guest_cbs = NULL;
> return 0;
> }
Makes total sense.
Paolo
Powered by blists - more mailing lists