All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Richter <robert.richter@amd.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"oprofile-list@lists.sf.net" <oprofile-list@lists.sf.net>,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH] oprofile: Allow setting EDGE/INV/CMASK for Intel counter events
Date: Wed, 16 Mar 2011 16:04:51 +0100	[thread overview]
Message-ID: <20110316150450.GO31407@erda.amd.com> (raw)
In-Reply-To: <1299870748-13319-1-git-send-email-andi@firstfloor.org>

On 11.03.11 14:12:28, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
> 
> For some performance events it's useful to set the EDGE and INV
> bits and the CMASK mask in the counter control register. The list
> of predefined events Intel releases for each CPU has some events which
> require these settings to get more "natural" to use higher level events.
> 
> oprofile currently doesn't allow this.
> 
> This patch adds new extra configuration fields for them, so that
> they can be specified in oprofilefs.
> 
> An updated oprofile daemon can then make use of this to set them.
> 
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> ---
>  arch/x86/oprofile/nmi_int.c    |    4 ++++
>  arch/x86/oprofile/op_counter.h |    1 +
>  2 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
> index e2b7b0c..bace252 100644
> --- a/arch/x86/oprofile/nmi_int.c
> +++ b/arch/x86/oprofile/nmi_int.c
> @@ -49,6 +49,9 @@ u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
>  	val |= counter_config->user ? ARCH_PERFMON_EVENTSEL_USR : 0;
>  	val |= counter_config->kernel ? ARCH_PERFMON_EVENTSEL_OS : 0;
>  	val |= (counter_config->unit_mask & 0xFF) << 8;
> +	val |= counter_config->extra & (ARCH_PERFMON_EVENTSEL_INV|
> +					ARCH_PERFMON_EVENTSEL_EDGE|
> +					ARCH_PERFMON_EVENTSEL_CMASK);

I would like to write the actual value back so that userland may read
it:

	counter_config->extra &= (ARCH_PERFMON_EVENTSEL_INV|
                         ARCH_PERFMON_EVENTSEL_EDGE|
                         ARCH_PERFMON_EVENTSEL_CMASK);
	val |= counter_config->extra;

The value will not be updated emmediately but at least after profiling
was started.

As an alternative, maybe we better put this extra bits in the
unit_mask, e.g. in bits [31:16] of the unit mask for bits [31:16] of
PerfEvtSel? Then, we simply could use the current userland to set it
up.

-Robert

-- 
Advanced Micro Devices, Inc.
Operating System Research Center


  reply	other threads:[~2011-03-16 15:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-11 19:12 [PATCH] oprofile: Allow setting EDGE/INV/CMASK for Intel counter events Andi Kleen
2011-03-16 15:04 ` Robert Richter [this message]
2011-03-16 15:27   ` Andi Kleen
2011-03-16 15:45     ` Robert Richter
2011-03-16 16:56       ` Andi Kleen
2011-03-16 17:00         ` Robert Richter

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=20110316150450.GO31407@erda.amd.com \
    --to=robert.richter@amd.com \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oprofile-list@lists.sf.net \
    /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.