提交 a7b58d21 编写于 作者: A Andi Kleen 提交者: Ingo Molnar

perf/x86/intel/lbr: Allow time stamp for free running PEBSv3

With PEBSv3 the PEBS record contains a time stamp. That means we can allow
free-running PEBS without a PMI even if the user program requested a time stamp.
This avoids the need to use -T to get free running PEBS, and also avoids
any problems with mis-identifying MMAPs later.

Move the free_running_flags state into a variable in x86_pmu and use it.
This only works when no explicit clock_id is set.
Signed-off-by: NAndi Kleen <ak@linux.intel.com>
Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: acme@kernel.org
Cc: eranian@google.com
Cc: jolsa@redhat.com
Cc: kan.liang@intel.com
Link: http://lkml.kernel.org/r/1432786398-23861-2-git-send-email-andi@firstfloor.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
上级 2f7ebf2e
...@@ -594,6 +594,7 @@ struct x86_pmu { ...@@ -594,6 +594,7 @@ struct x86_pmu {
struct event_constraint *pebs_constraints; struct event_constraint *pebs_constraints;
void (*pebs_aliases)(struct perf_event *event); void (*pebs_aliases)(struct perf_event *event);
int max_pebs_events; int max_pebs_events;
unsigned long free_running_flags;
/* /*
* Intel LBR * Intel LBR
......
...@@ -2257,6 +2257,15 @@ static void intel_pebs_aliases_snb(struct perf_event *event) ...@@ -2257,6 +2257,15 @@ static void intel_pebs_aliases_snb(struct perf_event *event)
} }
} }
static unsigned long intel_pmu_free_running_flags(struct perf_event *event)
{
unsigned long flags = x86_pmu.free_running_flags;
if (event->attr.use_clockid)
flags &= ~PERF_SAMPLE_TIME;
return flags;
}
static int intel_pmu_hw_config(struct perf_event *event) static int intel_pmu_hw_config(struct perf_event *event)
{ {
int ret = x86_pmu_hw_config(event); int ret = x86_pmu_hw_config(event);
...@@ -2267,7 +2276,8 @@ static int intel_pmu_hw_config(struct perf_event *event) ...@@ -2267,7 +2276,8 @@ static int intel_pmu_hw_config(struct perf_event *event)
if (event->attr.precise_ip) { if (event->attr.precise_ip) {
if (!event->attr.freq) { if (!event->attr.freq) {
event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD; event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD;
if (!(event->attr.sample_type & ~PEBS_FREERUNNING_FLAGS)) if (!(event->attr.sample_type &
~intel_pmu_free_running_flags(event)))
event->hw.flags |= PERF_X86_EVENT_FREERUNNING; event->hw.flags |= PERF_X86_EVENT_FREERUNNING;
} }
if (x86_pmu.pebs_aliases) if (x86_pmu.pebs_aliases)
...@@ -2689,6 +2699,8 @@ static __initconst const struct x86_pmu core_pmu = { ...@@ -2689,6 +2699,8 @@ static __initconst const struct x86_pmu core_pmu = {
.event_map = intel_pmu_event_map, .event_map = intel_pmu_event_map,
.max_events = ARRAY_SIZE(intel_perfmon_event_map), .max_events = ARRAY_SIZE(intel_perfmon_event_map),
.apic = 1, .apic = 1,
.free_running_flags = PEBS_FREERUNNING_FLAGS,
/* /*
* Intel PMCs cannot be accessed sanely above 32-bit width, * Intel PMCs cannot be accessed sanely above 32-bit width,
* so we install an artificial 1<<31 period regardless of * so we install an artificial 1<<31 period regardless of
...@@ -2727,6 +2739,7 @@ static __initconst const struct x86_pmu intel_pmu = { ...@@ -2727,6 +2739,7 @@ static __initconst const struct x86_pmu intel_pmu = {
.event_map = intel_pmu_event_map, .event_map = intel_pmu_event_map,
.max_events = ARRAY_SIZE(intel_perfmon_event_map), .max_events = ARRAY_SIZE(intel_perfmon_event_map),
.apic = 1, .apic = 1,
.free_running_flags = PEBS_FREERUNNING_FLAGS,
/* /*
* Intel PMCs cannot be accessed sanely above 32 bit width, * Intel PMCs cannot be accessed sanely above 32 bit width,
* so we install an artificial 1<<31 period regardless of * so we install an artificial 1<<31 period regardless of
......
...@@ -1273,6 +1273,7 @@ void __init intel_ds_init(void) ...@@ -1273,6 +1273,7 @@ void __init intel_ds_init(void)
x86_pmu.pebs_record_size = x86_pmu.pebs_record_size =
sizeof(struct pebs_record_skl); sizeof(struct pebs_record_skl);
x86_pmu.drain_pebs = intel_pmu_drain_pebs_nhm; x86_pmu.drain_pebs = intel_pmu_drain_pebs_nhm;
x86_pmu.free_running_flags |= PERF_SAMPLE_TIME;
break; break;
default: default:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册