public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Akihiro Nagai <akihiro.nagai.hw@hitachi.com>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>,
	Ingo Molnar <mingo@elte.hu>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	David Ahern <dsahern@gmail.com>,
	linux-kernel@vger.kernel.org,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	yrl.pp-manager.tt@hitachi.com, Paul Mackerras <paulus@samba.org>
Subject: Re: [PATCH -tip v3 2/5] perf: change perf_event_header.misc to PERF_RECORD_MISC_USER for BTS
Date: Thu, 11 Aug 2011 14:18:46 +0200	[thread overview]
Message-ID: <1313065126.7144.6.camel@twins> (raw)
In-Reply-To: <20110811120620.5900.50427.stgit@linux3>

On Thu, 2011-08-11 at 21:06 +0900, Akihiro Nagai wrote:
> Change perf_event_headder.misc to PERF_RECORD_MISC_USER for
> BTS records, because BTS traces both kernel and user spaces
> nevertheless perf specifies to trace only kernel or user space.

Now I'm confused..

If BTS traces both kernel and user, the MISC bit should reflect the
right state per-sample, on x86 that's easy enough to do by the address.


> ---
> 
>  arch/x86/kernel/cpu/perf_event_intel_ds.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
> index 1b1ef3a..323f3f0 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
> @@ -340,6 +340,14 @@ static int intel_pmu_drain_bts_buffer(void)
>  	 */
>  	perf_prepare_sample(&header, &data, event, &regs);
>  
> +	/*
> +	 * Since BTS can not trace kernel and user space separately, set

Uhm, IA32_DEBUGCTL_MSR.BTS_OFF_{OS,USR} seem to suggest it can?!

> +	 * PERF_RECORD_MISC_USER in header.misc to resolve both kernel and
> +	 * user DSOs and symbols.
> +	 */
> +	header.misc &= ~PERF_RECORD_MISC_CPUMODE_MASK;
> +	header.misc |= PERF_RECORD_MISC_USER;


So what's wrong with something like:

	header.misc |= is_kernel_address(at->from) ?
			PERF_RECORD_MISC_KERNEL :
			PERF_RECORD_MISC_USER;

>  	if (perf_output_begin(&handle, event, header.size * (top - at)))
>  		return 1;
>  
> 


  reply	other threads:[~2011-08-11 12:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-11 12:05 [PATCH -tip v3 0/5] perf script: add BTS analysis features Akihiro Nagai
2011-08-11 12:06 ` [PATCH -tip v3 1/5] perf-script: unify the expressions indicate "unknown" Akihiro Nagai
2011-08-22 13:00   ` David Ahern
2011-08-11 12:06 ` [PATCH -tip v3 2/5] perf: change perf_event_header.misc to PERF_RECORD_MISC_USER for BTS Akihiro Nagai
2011-08-11 12:18   ` Peter Zijlstra [this message]
2011-08-17  2:19     ` Akihiro Nagai
2011-08-22  9:02       ` Peter Zijlstra
2011-08-11 12:06 ` [PATCH -tip v3 3/5] perf script: enhance IP and ADDR correlate detection " Akihiro Nagai
2011-08-22 13:00   ` David Ahern
2011-08-11 12:06 ` [PATCH -tip v3 4/5] perf script: add the offset field specifier Akihiro Nagai
2011-08-22 13:02   ` David Ahern
2011-08-11 12:06 ` [PATCH -tip v3 5/5] perf script: add option resolving vmlinux path Akihiro Nagai
2011-08-22 13:03   ` David Ahern

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=1313065126.7144.6.camel@twins \
    --to=peterz@infradead.org \
    --cc=acme@infradead.org \
    --cc=akihiro.nagai.hw@hitachi.com \
    --cc=dsahern@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=yrl.pp-manager.tt@hitachi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox