All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: kan.liang@intel.com, eranian@google.com,
	linux-kernel@vger.kernel.org, mingo@redhat.com, paulus@samba.org,
	acme@kernel.org, ak@linux.intel.com, "Yan,
	Zheng" <zheng.z.yan@intel.com>
Subject: Re: [PATCH V5 02/16] perf, core: introduce pmu context switch callback
Date: Mon, 29 Sep 2014 11:36:57 +0200	[thread overview]
Message-ID: <20140929093657.GD5430@worktop> (raw)
In-Reply-To: <20140927164738.GA21729@lerouge>

On Sat, Sep 27, 2014 at 06:47:41PM +0200, Frederic Weisbecker wrote:

Trim replies already -- I should really go write that auto-bounce for
excessive quoting already.

> I wonder if it's worth to create such an arch callback and core corner case.
> How about just scheduling out then in the events that have lbr, wouldn't we
> have more simple code in the end?

That depends a bit, the lbr save/restore is indeed very expensive (at
least 16 msr reads and 16 msr writes -- when assuming 16 deep lbr), but
this is still on about the same order of msr writes required to switch 4
counters (esp. if we include the PEBS msrs).

So at that point we still win about half the context switch cost by not
doing an unconditional sched out / sched in.

Also, there are more consumers of this thing.

> Besides, BTS would benefit from that too. I can't seem to find where it is
> flushed when a task context switches inside a same perf context. It seems
> that it doesn't happen, BTS traces are flushed only on event stop (and overflow IRQ)
> and events aren't stopped if a context switch happens in the same perf context.
> Having Y task bts traces from task X event is probably not what we want.

Flushing the BTS is indeed a good point, but that would definitely
benefit from this, draining the BTS buffer is likely faster than doing
all those MSR writes.

  reply	other threads:[~2014-09-29  9:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-08  2:29 [PATCH V5 00/16] perf, x86: Haswell LBR call stack support kan.liang
2001-01-08  2:29 ` [PATCH V5 01/16] perf, x86: Reduce lbr_sel_map size kan.liang
2001-01-08  2:29 ` [PATCH V5 02/16] perf, core: introduce pmu context switch callback kan.liang
2014-09-27 16:47   ` Frederic Weisbecker
2014-09-29  9:36     ` Peter Zijlstra [this message]
2001-01-08  2:29 ` [PATCH V5 03/16] perf, x86: use context switch callback to flush LBR stack kan.liang
2001-01-08  2:29 ` [PATCH V5 04/16] perf, x86: Basic Haswell LBR call stack support kan.liang
2001-01-08  2:29 ` [PATCH V5 05/16] perf, core: pmu specific data for perf task context kan.liang
2001-01-08  2:29 ` [PATCH V5 06/16] perf, core: always switch pmu specific data during context switch kan.liang
2001-01-08  2:29 ` [PATCH V5 07/16] perf, x86: allocate space for storing LBR stack kan.liang
2001-01-08  2:29 ` [PATCH V5 08/16] perf, x86: track number of events that use LBR callstack kan.liang
2001-01-08  2:29 ` [PATCH V5 09/16] perf, x86: Save/resotre LBR stack during context switch kan.liang
  -- strict thread matches above, loose matches on Subject: below --
2014-07-07  6:28 [PATCH v5 00/16] perf, x86: Haswell LBR call stack support Yan, Zheng
2014-07-07  6:28 ` [PATCH v5 02/16] perf, core: introduce pmu context switch callback Yan, Zheng
2014-09-10 14:08 [PATCH V5 00/16] perf, x86: Haswell LBR call stack support kan.liang
2014-09-10 14:08 ` [PATCH V5 02/16] perf, core: introduce pmu context switch callback kan.liang
2014-09-24 11:23   ` Peter Zijlstra
2014-09-24 13:13   ` Peter Zijlstra

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=20140929093657.GD5430@worktop \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=zheng.z.yan@intel.com \
    /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.