From: Robert Richter on
Please see my patch below that fixes ther reporting error code that
returns from x86_pmu.hw_config.

-Robert

On 11.03.10 18:33:55, tip-bot for Cyrill Gorcunov wrote:
> Commit-ID: a072738e04f0eb26370e39ec679e9a0d65e49aea
> Gitweb: http://git.kernel.org/tip/a072738e04f0eb26370e39ec679e9a0d65e49aea
> Author: Cyrill Gorcunov <gorcunov(a)openvz.org>
> AuthorDate: Thu, 11 Mar 2010 19:54:39 +0300
> Committer: Ingo Molnar <mingo(a)elte.hu>
> CommitDate: Thu, 11 Mar 2010 18:51:08 +0100
>
> perf, x86: Implement initial P4 PMU driver
>
> The netburst PMU is way different from the "architectural
> perfomance monitoring" specification that current CPUs use.
> P4 uses a tuple of ESCR+CCCR+COUNTER MSR registers to handle
> perfomance monitoring events.

--

From: Robert Richter <robert.richter(a)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(a)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



--
Advanced Micro Devices, Inc.
Operating System Research Center
email: robert.richter(a)amd.com

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Cyrill Gorcunov on
On Tue, Mar 16, 2010 at 05:07:33PM +0100, Robert Richter wrote:
[...]
> --
>
> From: Robert Richter <robert.richter(a)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(a)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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Lin Ming on
On Wed, 2010-03-17 at 00:23 +0800, Cyrill Gorcunov wrote:
> On Tue, Mar 16, 2010 at 05:07:33PM +0100, Robert Richter wrote:
> [...]
> > --
> >
> > From: Robert Richter <robert.richter(a)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(a)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?

Looks good.

Lin Ming

>
> -- Cyrill

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/