lkml.org 
[lkml]   [2010]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [tip:perf/x86] perf, x86: Implement initial P4 PMU driver
On Tue, Mar 16, 2010 at 05:07:33PM +0100, Robert Richter wrote:
[...]
> --
>
> From: Robert Richter <robert.richter@amd.com>
> Date: Tue, 16 Mar 2010 16:38:19 +0100
> Subject: [PATCH] perf, x86: reporting error code that returns from x86_pmu.hw_config()
>
> If x86_pmu.hw_config() fails a fixed error code (-EOPNOTSUPP) is
> return even if a different error was reported. This patch fixes this.
>
> Signed-off-by: Robert Richter <robert.richter@amd.com>
> ---
> arch/x86/kernel/cpu/perf_event.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
> index 4e2480f..8982d92 100644
> --- a/arch/x86/kernel/cpu/perf_event.c
> +++ b/arch/x86/kernel/cpu/perf_event.c
> @@ -467,8 +467,9 @@ static int __hw_perf_event_init(struct perf_event *event)
> hwc->last_tag = ~0ULL;
>
> /* Processor specifics */
> - if (x86_pmu.hw_config(attr, hwc))
> - return -EOPNOTSUPP;
> + err = x86_pmu.hw_config(attr, hwc);
> + if (err)
> + return err;
>
> if (!hwc->sample_period) {
> hwc->sample_period = x86_pmu.max_period;
> --
> 1.7.0
>

Though at moment all hw_config callees return 0, it's better
to be ready if one day we may start returning some particular
errors. Looks good to me. Objections?

-- Cyrill


\
 
 \ /
  Last update: 2010-03-16 17:25    [W:0.091 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site