Re: [patch] perf_event_open.2: 3.19 PERF_SAMPLE_REGS_INTR support

From: Vince Weaver
Date: Fri Mar 06 2015 - 13:33:28 EST


On Mon, 2 Mar 2015, Andi Kleen wrote:

> > do not enable REGS_USER and REG_INTR at the same time
> > as REGS_USER will have REG_INTR values and
> > cannot be used for user stack unwinding
>
> If that's true it would be a bug. But I doubt it.
>
> The PEBS handler sets up its own pt_regs, so they should
> be independent.

I could be wrong here, but was tracing through the code.

If you trigger a PEBS interrupt (because you have precise_ip set)
and you have both REGS_USER and REGS_INTR set, then
__intel_pmu_pebs_event()
is called from
arch/x86/kernel/cpu/perf_event_intel_ds.c

and in there it sets the regs values based solely on

if (sample_type & PERF_SAMPLE_REGS_INTR) {
}

with those values copies into regs and then passed upstream through
perf_event_overflow()

so if the sample_type has *both* PERF_SAMPLE_REGS_INTR and
PERF_SAMPLE_REGS_USER set, then the PERF_SAMPLE_REGS_USER values
will have the same register values as the PERF_SAMPLE_REGS_INTR values.

Maybe this is the expected behavior, or maybe I am missing something
still.

Vince

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/