From: kan.liang@linux.intel.com
To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org
Cc: namhyung@kernel.org, eranian@google.com, irogers@google.com,
gmx@google.com, acme@kernel.org, jolsa@redhat.com,
ak@linux.intel.com, Kan Liang <kan.liang@linux.intel.com>
Subject: [PATCH 2/3] perf/x86/intel: Set PERF_ATTACH_SCHED_CB for large PEBS
Date: Fri, 6 Nov 2020 13:29:34 -0800 [thread overview]
Message-ID: <20201106212935.28943-2-kan.liang@linux.intel.com> (raw)
In-Reply-To: <20201106212935.28943-1-kan.liang@linux.intel.com>
From: Kan Liang <kan.liang@linux.intel.com>
To supply a PID/TID for large PEBS, it requires flushing the PEBS buffer
in a context switch.
Set PERF_ATTACH_SCHED_CB for the event with large PEBS.
Fixes: 9c964efa4330 ("perf/x86/intel: Drain the PEBS buffer during context switches")
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
---
arch/x86/events/intel/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index c79748f6921d..fe922be94b6d 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -3565,8 +3565,10 @@ static int intel_pmu_hw_config(struct perf_event *event)
if (!(event->attr.freq || (event->attr.wakeup_events && !event->attr.watermark))) {
event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD;
if (!(event->attr.sample_type &
- ~intel_pmu_large_pebs_flags(event)))
+ ~intel_pmu_large_pebs_flags(event))) {
event->hw.flags |= PERF_X86_EVENT_LARGE_PEBS;
+ event->attach_state |= PERF_ATTACH_SCHED_CB;
+ }
}
if (x86_pmu.pebs_aliases)
x86_pmu.pebs_aliases(event);
--
2.17.1
next prev parent reply other threads:[~2020-11-06 21:31 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-06 21:29 [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events kan.liang
2020-11-06 21:29 ` kan.liang [this message]
2020-11-06 21:29 ` [PATCH 3/3] perf: Optimize sched_task() in a context switch kan.liang
2020-11-09 9:52 ` [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events Peter Zijlstra
2020-11-09 11:04 ` Peter Zijlstra
2020-11-09 14:49 ` Liang, Kan
2020-11-09 17:33 ` Peter Zijlstra
2020-11-09 19:52 ` Liang, Kan
2020-11-09 17:40 ` Peter Zijlstra
2020-11-11 16:25 ` Peter Zijlstra
2020-11-11 19:54 ` Liang, Kan
2020-11-17 5:01 ` Namhyung Kim
2020-11-20 11:24 ` Namhyung Kim
2020-11-20 11:24 ` Namhyung Kim
2020-11-23 11:00 ` Michael Ellerman
2020-11-23 11:00 ` Michael Ellerman
2020-11-24 4:51 ` Namhyung Kim
2020-11-24 4:51 ` Namhyung Kim
2020-11-24 5:42 ` Madhavan Srinivasan
2020-11-24 5:42 ` Madhavan Srinivasan
2020-11-24 16:04 ` Liang, Kan
2020-11-24 16:04 ` Liang, Kan
2020-11-25 8:12 ` Michael Ellerman
2020-11-25 8:12 ` Michael Ellerman
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=20201106212935.28943-2-kan.liang@linux.intel.com \
--to=kan.liang@linux.intel.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=eranian@google.com \
--cc=gmx@google.com \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.