[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1274250776.5605.10000.camel@twins>
Date: Wed, 19 May 2010 08:32:56 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Jason Baron <jbaron@...hat.com>
Cc: eranian@...glemail.com, linux-kernel@...r.kernel.org,
mingo@...e.hu, paulus@...ba.org, perfmon2-devel@...ts.sf.net
Subject: Re: [PATCH] perf: fix cmpxchg warning in perf_event_amd.c
On Tue, 2010-05-18 at 16:43 -0400, Jason Baron wrote:
> Hi,
>
> I'm getting the following warnings:
>
> In file included from arch/x86/kernel/cpu/perf_event.c:1343:
> arch/x86/kernel/cpu/perf_event_amd.c: In function
> ‘amd_put_event_constraints’:
> arch/x86/kernel/cpu/perf_event_amd.c:167: warning: value computed is not
> used
>
> Since cmpxchg returns a value, we need to use it. We can use it to test if its
> equal to "event".
Should we:
a) add a WARN_ONCE() there and make use of the return value (it should
never happen)
or
b) replace the lot with: nb->owners[i] = NULL; which should I _think_
work.
> Signed-off-by: Jason Baron <jbaron@...hat.com>
> ---
> arch/x86/kernel/cpu/perf_event_amd.c | 4 +---
> 1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
> index 611df11..e13ce4a 100644
> --- a/arch/x86/kernel/cpu/perf_event_amd.c
> +++ b/arch/x86/kernel/cpu/perf_event_amd.c
> @@ -163,10 +163,8 @@ static void amd_put_event_constraints(struct cpu_hw_events *cpuc,
> * when we come here
> */
> for (i = 0; i < x86_pmu.num_counters; i++) {
> - if (nb->owners[i] == event) {
> - cmpxchg(nb->owners+i, event, NULL);
> + if (cmpxchg(nb->owners+i, event, NULL) == event)
> break;
> - }
> }
> }
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists