public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Robert Richter <robert.richter@amd.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	Stephane Eranian <eranian@google.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/4] perf, x86: Improve debug output in check_hw_exists()
Date: Fri, 22 Jun 2012 17:53:47 +0200	[thread overview]
Message-ID: <1340380427.18025.84.camel@twins> (raw)
In-Reply-To: <1340217996-2254-5-git-send-email-robert.richter@amd.com>

On Wed, 2012-06-20 at 20:46 +0200, Robert Richter wrote:
> It might be of interest which perfctr msr failed.
> 
> Signed-off-by: Robert Richter <robert.richter@amd.com>
> ---
>  arch/x86/kernel/cpu/perf_event.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
> index bb340dc..8d29a35 100644
> --- a/arch/x86/kernel/cpu/perf_event.c
> +++ b/arch/x86/kernel/cpu/perf_event.c
> @@ -178,7 +178,7 @@ static void release_pmc_hardware(void) {}
>  
>  static bool check_hw_exists(void)
>  {
> -	u64 val, val_new = 0;
> +	u64 val, val_new = ~0;
>  	int i, reg, ret = 0;
>  
>  	/*
> @@ -229,6 +229,7 @@ bios_fail:
>  
>  msr_fail:
>  	printk(KERN_CONT "Broken PMU hardware detected, using software events only.\n");
> +	printk(KERN_ERR "Failed to access perfctr msr (MSR %x is %Lx)\n", reg, val_new);
>  
>  	return false;
>  }

My gcc wants me to add the below to avoid used uninitialized warns:

---
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -211,8 +211,9 @@ static bool check_hw_exists(void)
 	 * that don't trap on the MSR access and always return 0s.
 	 */
 	val = 0xabcdUL;
-	ret = wrmsrl_safe(x86_pmu_event_addr(0), val);
-	ret |= rdmsrl_safe(x86_pmu_event_addr(0), &val_new);
+	reg = x86_pmu_event_addr(0);
+	ret = wrmsrl_safe(reg, val);
+	ret |= rdmsrl_safe(reg, &val_new);
 	if (ret || val != val_new)
 		goto msr_fail;
 


  reply	other threads:[~2012-06-22 15:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20 18:46 [PATCH 0/4] perf, x86: Updates and cleanups Robert Richter
2012-06-20 18:46 ` [PATCH 1/4] perf, x86: Rename Intel specific macros Robert Richter
2012-07-06  6:25   ` [tip:perf/core] perf/x86: " tip-bot for Robert Richter
2012-06-20 18:46 ` [PATCH 2/4] perf, x86: Move Intel specific code to intel_pmu_init() Robert Richter
2012-07-06  6:26   ` [tip:perf/core] perf/x86: " tip-bot for Robert Richter
2012-06-20 18:46 ` [PATCH 3/4] perf, amd: Unify AMD's generic and family 15h pmus Robert Richter
2012-07-06  6:26   ` [tip:perf/core] perf/x86/amd: Unify AMD' s " tip-bot for Robert Richter
2012-06-20 18:46 ` [PATCH 4/4] perf, x86: Improve debug output in check_hw_exists() Robert Richter
2012-06-22 15:53   ` Peter Zijlstra [this message]
2012-06-22 16:36     ` Robert Richter
2012-06-27  9:59       ` Peter Zijlstra
2012-07-06  6:27   ` [tip:perf/core] perf/x86: Improve debug output in check_hw_exists( ) tip-bot for Robert Richter
2012-06-20 20:09 ` [PATCH 0/4] perf, x86: Updates and cleanups 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=1340380427.18025.84.camel@twins \
    --to=peterz@infradead.org \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=robert.richter@amd.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