public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: "Zhang, Yanmin" <yanmin_zhang@linux.intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	LKML <linux-kernel@vger.kernel.org>,
	Stephane Eranian <eranian@google.com>
Subject: Re: perf failed with kernel 2.6.35-rc
Date: Tue, 13 Jul 2010 10:50:19 +0200	[thread overview]
Message-ID: <20100713085019.GB7984@elte.hu> (raw)
In-Reply-To: <1279008849.2096.913.camel@ymzhang.sh.intel.com>


* Zhang, Yanmin <yanmin_zhang@linux.intel.com> wrote:

> Peter,
> 
> perf doesn't work on my Nehalem EX machine.
> 1) The 1st start of 'perf top' is ok;
> 2) Kill the 1st perf and restart it. It doesn't work. No data is showed.
> 
> I located below commit:
> commit 1ac62cfff252fb668405ef3398a1fa7f4a0d6d15
> Author: Peter Zijlstra <peterz@infradead.org>
> Date:   Fri Mar 26 14:08:44 2010 +0100
> 
>     perf, x86: Add Nehelem PMU programming errata workaround
>     
>     workaround From: Peter Zijlstra <a.p.zijlstra@chello.nl>
>     Date: Fri Mar 26 13:59:41 CET 2010
>     
>     Implement the workaround for Intel Errata AAK100 and AAP53.
>     
>     Also, remove the Core-i7 name for Nehalem events since there are
>     also Westmere based i7 chips.
> 
> 
> If I comment out the workaround in function intel_pmu_nhm_enable_all,
> perf could work.
> 
> A quick glance shows:
> wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0x3);
> should be:
> wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0x7);

> I triggered sysrq to dump PMU registers and found the last bit of
> global status register is 1. I added a status reset operation like below patch:
> 
> --- linux-2.6.35-rc5/arch/x86/kernel/cpu/perf_event_intel.c	2010-07-14 09:38:11.000000000 +0800
> +++ linux-2.6.35-rc5_fork/arch/x86/kernel/cpu/perf_event_intel.c	2010-07-14 14:41:42.000000000 +0800
> @@ -505,8 +505,13 @@ static void intel_pmu_nhm_enable_all(int
>  		wrmsrl(MSR_ARCH_PERFMON_EVENTSEL0 + 1, 0x4300B1);
>  		wrmsrl(MSR_ARCH_PERFMON_EVENTSEL0 + 2, 0x4300B5);
>  
> -		wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0x3);
> +		wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0x7);
>  		wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0x0);
> +		/*
> +		 * Reset the last 3 bits of global status register in case
> +		 * previous enabling causes overflows.
> +		 */
> +		wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, 0x7);
>  
>  		for (i = 0; i < 3; i++) {
>  			struct perf_event *event = cpuc->events[i];
>
> 
> However, it still doesn't work. Current right way is to comment out
> the workaround.

Well, how about doing it like this:

		wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0x7);
		/*
		 * Reset the last 3 bits of global status register in case
		 * previous enabling causes overflows.
		 */
		wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, 0x7);
  
 		for (i = 0; i < 3; i++) {
  			struct perf_event *event = cpuc->events[i];
			...
		}

  		wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0x0);

I.e. global-mask, overflow-clear, explicit-enable, then global-enable?

Thanks,

	Ingo

  reply	other threads:[~2010-07-13  8:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-13  8:14 perf failed with kernel 2.6.35-rc Zhang, Yanmin
2010-07-13  8:50 ` Ingo Molnar [this message]
2010-07-14  0:49   ` Zhang, Yanmin
2010-07-14  8:15     ` Zhang, Yanmin
2010-07-13 15:16 ` Stephane Eranian
2010-07-14  0:13   ` Zhang, Yanmin
2010-07-14  0:36     ` Stephane Eranian
2010-07-14  2:22       ` Zhang, Yanmin
2010-08-03 12:20 ` Peter Zijlstra
2010-08-04 15:48   ` Stephane Eranian
     [not found]   ` <1280886349.2125.32.camel@ymzhang.sh.intel.com>
     [not found]     ` <1280905701.1923.717.camel@laptop>
     [not found]       ` <1280990413.2125.50.camel@ymzhang.sh.intel.com>
     [not found]         ` <1281004361.1923.1750.camel@laptop>
2010-08-06  5:39           ` Zhang, Yanmin
2010-08-18 10:27             ` [tip:perf/urgent] perf, x86: Fix Intel-nhm PMU programming errata workaround tip-bot for Zhang, Yanmin

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=20100713085019.GB7984@elte.hu \
    --to=mingo@elte.hu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yanmin_zhang@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox