Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1689913

Re: [PATCH] perf/x86/intel: Add proper condition to run sched_task callbacks

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH] perf/x86/intel: Add proper condition to run sched_task callbacks
Date 2017-07-18 11:20 +0200
Message-ID <u4wPE-w0-29@gated-at.bofh.it> (permalink)
References <u4fOO-6GU-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Jul 17, 2017 at 05:01:56PM +0200, Jiri Olsa wrote:
> The x86 pmu currently uses the sched_task callback for 2 functions:
>   - PEBS drain
>   - save/restore LBR data
> 
> They are both triggered once the x86 pmu is registered with
> perf_sched_cb_inc call (within pmu::add	callback), regardless
> if there's actually any PEBS or LBR event configured on the cpu.

I don't understand. If we do pmu::add() we _are_ on the CPU.

So you're saying intel_pmu_pebs_{add,del}() are doing it wrong? So why
not fix those?

> diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
> index aa62437d1aa1..1f66356d8122 100644
> --- a/arch/x86/events/intel/core.c
> +++ b/arch/x86/events/intel/core.c
> @@ -3265,9 +3265,11 @@ static void intel_pmu_cpu_dying(int cpu)
>  static void intel_pmu_sched_task(struct perf_event_context *ctx,
>  				 bool sched_in)
>  {
> -	if (x86_pmu.pebs_active)
> +	struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
> +
> +	if (intel_pmu_pebs_needs_sched_cb(cpuc))
>  		intel_pmu_pebs_sched_task(ctx, sched_in);

So I'm confused, if we'd not need this, how come we're here in the first
place?

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] perf/x86/intel: Add proper condition to run sched_task callbacks Jiri Olsa <jolsa@kernel.org> - 2017-07-17 17:10 +0200
  Re: [PATCH] perf/x86/intel: Add proper condition to run sched_task  callbacks Peter Zijlstra <peterz@infradead.org> - 2017-07-18 11:20 +0200
    Re: [PATCH] perf/x86/intel: Add proper condition to run sched_task  callbacks Jiri Olsa <jolsa@redhat.com> - 2017-07-18 11:30 +0200
      Re: [PATCH] perf/x86/intel: Add proper condition to run sched_task  callbacks Peter Zijlstra <peterz@infradead.org> - 2017-07-18 14:40 +0200
        Re: [PATCH] perf/x86/intel: Add proper condition to run sched_task  callbacks Jiri Olsa <jolsa@redhat.com> - 2017-07-19 00:20 +0200
        Re: [PATCH] perf/x86/intel: Add proper condition to run sched_task  callbacks Jiri Olsa <jolsa@redhat.com> - 2017-07-19 10:00 +0200
          [tip:perf/urgent] perf/x86/intel: Add proper condition to run  sched_task callbacks tip-bot for Jiri Olsa <tipbot@zytor.com> - 2017-07-21 11:50 +0200

csiph-web