Re: [PATCH 2/8] perf,x86: drop event->flags and use hw.constraint->flags

From: Stephane Eranian
Date: Thu Jun 27 2013 - 08:34:06 EST


Peter,

Let's drop this patch.

It does not work anymore with the offcore-response
scheduling fix. The constraint->flags are shared, so cannot
use the flags there to store X86_COMMITTED. So we have
to keep a copy in the event->hw.flags.

Sorry about the confusion.




On Thu, Jun 27, 2013 at 1:14 PM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> On Thu, Jun 27, 2013 at 01:01:02PM +0200, Stephane Eranian wrote:
>> Ok, the chunks that do not apply can be ignored for perf_event_intel.c.
>
> Just to verify; I did a force apply ignoring the 2 hunks in perf_event_intel.c.
> The result is the below patch; which gives:
>
> # nice make O=defconfig-build/ -j16 -s
> /usr/src/linux-2.6/arch/x86/kernel/cpu/perf_event.c: In function âx86_schedule_eventsâ:
> /usr/src/linux-2.6/arch/x86/kernel/cpu/perf_event.c:780:9: error: âstruct hw_perf_eventâ has no member named âflagsâ
> /usr/src/linux-2.6/arch/x86/kernel/cpu/perf_event.c:794:14: error: âstruct hw_perf_eventâ has no member named âflagsâ
> /usr/src/linux-2.6/arch/x86/kernel/cpu/perf_event.c: In function âx86_pmu_delâ:
> /usr/src/linux-2.6/arch/x86/kernel/cpu/perf_event.c:1180:11: error: âstruct hw_perf_eventâ has no member named âflagsâ
> make[4]: *** [arch/x86/kernel/cpu/perf_event.o] Error 1
>
>
> Please resend one that builds.
>
> ---
> Subject: perf,x86: Drop event->flags and use hw.constraint->flags
> From: Stephane Eranian <eranian@xxxxxxxxxx>
> Date: Fri, 21 Jun 2013 16:20:42 +0200
>
> Now that we use the constraints directly from the event, we
> do not need the event->flags field so drop it.
>
> Signed-off-by: Stephane Eranian <eranian@xxxxxxxxxx>
> Signed-off-by: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Link: http://lkml.kernel.org/r/1371824448-7306-3-git-send-email-eranian@xxxxxxxxxx
> ---
> arch/x86/kernel/cpu/perf_event_intel_ds.c | 19 ++++++++++---------
> include/linux/perf_event.h | 1 -
> 2 files changed, 10 insertions(+), 10 deletions(-)
>
> --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
> @@ -623,7 +623,6 @@ struct event_constraint *intel_pebs_cons
> if (x86_pmu.pebs_constraints) {
> for_each_event_constraint(c, x86_pmu.pebs_constraints) {
> if ((event->hw.config & c->cmask) == c->code) {
> - event->hw.flags |= c->flags;
> return c;
> }
> }
> @@ -636,14 +635,15 @@ void intel_pmu_pebs_enable(struct perf_e
> {
> struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
> struct hw_perf_event *hwc = &event->hw;
> + int flags = event->hw.constraint->flags;
>
> hwc->config &= ~ARCH_PERFMON_EVENTSEL_INT;
>
> cpuc->pebs_enabled |= 1ULL << hwc->idx;
>
> - if (event->hw.flags & PERF_X86_EVENT_PEBS_LDLAT)
> + if (flags & PERF_X86_EVENT_PEBS_LDLAT)
> cpuc->pebs_enabled |= 1ULL << (hwc->idx + 32);
> - else if (event->hw.flags & PERF_X86_EVENT_PEBS_ST)
> + else if (flags & PERF_X86_EVENT_PEBS_ST)
> cpuc->pebs_enabled |= 1ULL << 63;
> }
>
> @@ -651,12 +651,13 @@ void intel_pmu_pebs_disable(struct perf_
> {
> struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
> struct hw_perf_event *hwc = &event->hw;
> + int flags = event->hw.constraint->flags;
>
> cpuc->pebs_enabled &= ~(1ULL << hwc->idx);
>
> - if (event->hw.constraint->flags & PERF_X86_EVENT_PEBS_LDLAT)
> + if (flags & PERF_X86_EVENT_PEBS_LDLAT)
> cpuc->pebs_enabled &= ~(1ULL << (hwc->idx + 32));
> - else if (event->hw.constraint->flags & PERF_X86_EVENT_PEBS_ST)
> + else if (flags & PERF_X86_EVENT_PEBS_ST)
> cpuc->pebs_enabled &= ~(1ULL << 63);
>
> if (cpuc->enabled)
> @@ -772,14 +773,14 @@ static void __intel_pmu_pebs_event(struc
> struct perf_sample_data data;
> struct pt_regs regs;
> u64 sample_type;
> + int flags = event->hw.constraint->flags;
> int fll, fst;
>
> if (!intel_pmu_save_and_restart(event))
> return;
>
> - fll = event->hw.flags & PERF_X86_EVENT_PEBS_LDLAT;
> - fst = event->hw.flags & (PERF_X86_EVENT_PEBS_ST |
> - PERF_X86_EVENT_PEBS_ST_HSW);
> + fll = flags & PERF_X86_EVENT_PEBS_LDLAT;
> + fst = flags & (PERF_X86_EVENT_PEBS_ST | PERF_X86_EVENT_PEBS_ST_HSW);
>
> perf_sample_data_init(&data, 0, event->hw.last_period);
>
> @@ -802,7 +803,7 @@ static void __intel_pmu_pebs_event(struc
> if (sample_type & PERF_SAMPLE_DATA_SRC) {
> if (fll)
> data.data_src.val = load_latency_data(pebs->dse);
> - else if (event->hw.flags & PERF_X86_EVENT_PEBS_ST_HSW)
> + else if (flags & PERF_X86_EVENT_PEBS_ST_HSW)
> data.data_src.val =
> precise_store_data_hsw(pebs->dse);
> else
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -134,7 +134,6 @@ struct hw_perf_event {
> int event_base_rdpmc;
> int idx;
> int last_cpu;
> - int flags;
>
> struct hw_perf_event_extra extra_reg;
> struct hw_perf_event_extra branch_reg;
>
--
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/