linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	wei.w.wang@intel.com, kan.liang@linux.intel.com
Cc: xiaoyao.li@intel.com, linux-perf-users@vger.kernel.org,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: [RFC PATCH v2 1/3] perf/core: Expose perf_event_{en,dis}able_local()
Date: Thu, 22 Sep 2022 00:45:19 +0800	[thread overview]
Message-ID: <20220921164521.2858932-2-xiaoyao.li@intel.com> (raw)
In-Reply-To: <20220921164521.2858932-1-xiaoyao.li@intel.com>

KVM needs them to disable/enable an Intel PT perf event before
vm-entry/after vm-exit.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
 include/linux/perf_event.h | 1 +
 kernel/events/core.c       | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index ee8b9ecdc03b..fc5f3952d6a2 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1472,6 +1472,7 @@ extern int perf_swevent_get_recursion_context(void);
 extern void perf_swevent_put_recursion_context(int rctx);
 extern u64 perf_swevent_set_period(struct perf_event *event);
 extern void perf_event_enable(struct perf_event *event);
+extern void perf_event_enable_local(struct perf_event *event);
 extern void perf_event_disable(struct perf_event *event);
 extern void perf_event_disable_local(struct perf_event *event);
 extern void perf_event_disable_inatomic(struct perf_event *event);
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 2621fd24ad26..8324bb99c6bf 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2446,6 +2446,7 @@ void perf_event_disable_local(struct perf_event *event)
 {
 	event_function_local(event, __perf_event_disable, NULL);
 }
+EXPORT_SYMBOL_GPL(perf_event_disable_local);
 
 /*
  * Strictly speaking kernel users cannot create groups and therefore this
@@ -2984,6 +2985,12 @@ static void _perf_event_enable(struct perf_event *event)
 	event_function_call(event, __perf_event_enable, NULL);
 }
 
+void perf_event_enable_local(struct perf_event *event)
+{
+	event_function_local(event, __perf_event_enable, NULL);
+}
+EXPORT_SYMBOL_GPL(perf_event_enable_local);
+
 /*
  * See perf_event_disable();
  */
-- 
2.27.0


  reply	other threads:[~2022-09-21 16:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 16:45 [RFC PATCH v2 0/3] KVM: VMX: Fix VM entry failure on PT_MODE_HOST_GUEST while host is using PT Xiaoyao Li
2022-09-21 16:45 ` Xiaoyao Li [this message]
2022-09-22 12:16   ` [RFC PATCH v2 1/3] perf/core: Expose perf_event_{en,dis}able_local() Wang, Wei W
2022-09-21 16:45 ` [RFC PATCH v2 2/3] perf/x86/intel/pt: Introduce and export pt_get_curr_event() Xiaoyao Li
2022-09-22  5:14   ` Xiaoyao Li
2022-09-22 12:33   ` Liang, Kan
2022-09-22 12:58     ` Wang, Wei W
2022-09-22 13:34       ` Peter Zijlstra
2022-09-22 13:59         ` Wang, Wei W
2022-09-22 14:09           ` Peter Zijlstra
2022-09-22 14:42             ` Wang, Wei W
2022-09-26 15:48               ` Liang, Kan
2022-09-26 17:24                 ` Jim Mattson
2022-09-26 18:08                   ` Liang, Kan
2022-09-27 14:27                     ` Wang, Wei W
2022-09-27 16:52                       ` Liang, Kan
2022-09-26 15:32       ` Liang, Kan
2022-09-21 16:45 ` [RFC PATCH v2 3/3] KVM: VMX: Stop/resume host PT before/after VMX transition when PT_MODE_HOST_GUEST Xiaoyao Li
2022-09-22 12:34   ` Wang, Wei W

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220921164521.2858932-2-xiaoyao.li@intel.com \
    --to=xiaoyao.li@intel.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=seanjc@google.com \
    --cc=wei.w.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).