linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: perf: fix event validation
@ 2010-08-27 15:22 Will Deacon
  0 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2010-08-27 15:22 UTC (permalink / raw)
  To: linux-arm-kernel

The validate_event function in the ARM perf events backend has the
following problems:

1.) Events that are disabled count towards the cost.
2.) Events associated with other PMUs [for example, software events or
    breakpoints] do not count towards the cost, but do fail validation,
    causing the group to fail.

This patch changes validate_event so that it ignores events in the
PERF_EVENT_STATE_OFF state or that are scheduled for other PMUs.

Cc: Jamie Iles <jamie.iles@picochip.com>
Reported-by: Pawe?? Moll <pawel.moll@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/kernel/perf_event.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index e213925..ecbb028 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -319,8 +319,8 @@ validate_event(struct cpu_hw_events *cpuc,
 {
 	struct hw_perf_event fake_event = event->hw;
 
-	if (event->pmu && event->pmu != &pmu)
-		return 0;
+	if (event->pmu != &pmu || event->state <= PERF_EVENT_STATE_OFF)
+		return 1;
 
 	return armpmu->get_event_idx(cpuc, &fake_event) >= 0;
 }
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] ARM: perf: fix event validation
@ 2010-09-01 12:11 Will Deacon
  2010-09-01 12:57 ` Jamie Iles
  0 siblings, 1 reply; 4+ messages in thread
From: Will Deacon @ 2010-09-01 12:11 UTC (permalink / raw)
  To: linux-arm-kernel

The validate_event function in the ARM perf events backend has the
following problems:

1.) Events that are disabled count towards the cost.
2.) Events associated with other PMUs [for example, software events or
    breakpoints] do not count towards the cost, but do fail validation,
    causing the group to fail.

This patch changes validate_event so that it ignores events in the
PERF_EVENT_STATE_OFF state or that are scheduled for other PMUs.

Cc: Jamie Iles <jamie.iles@picochip.com>
Reported-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
---

Resend with correct spelling of Pawel's email address on CC.
Jamie - are you ok with this fix?

 arch/arm/kernel/perf_event.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index e213925..ecbb028 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -319,8 +319,8 @@ validate_event(struct cpu_hw_events *cpuc,
 {
 	struct hw_perf_event fake_event = event->hw;
 
-	if (event->pmu && event->pmu != &pmu)
-		return 0;
+	if (event->pmu != &pmu || event->state <= PERF_EVENT_STATE_OFF)
+		return 1;
 
 	return armpmu->get_event_idx(cpuc, &fake_event) >= 0;
 }
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] ARM: perf: fix event validation
  2010-09-01 12:11 [PATCH] ARM: perf: fix event validation Will Deacon
@ 2010-09-01 12:57 ` Jamie Iles
  2010-09-02  8:33   ` Will Deacon
  0 siblings, 1 reply; 4+ messages in thread
From: Jamie Iles @ 2010-09-01 12:57 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Sep 01, 2010 at 01:11:22PM +0100, Will Deacon wrote:
> The validate_event function in the ARM perf events backend has the
> following problems:
> 
> 1.) Events that are disabled count towards the cost.
> 2.) Events associated with other PMUs [for example, software events or
>     breakpoints] do not count towards the cost, but do fail validation,
>     causing the group to fail.
> 
> This patch changes validate_event so that it ignores events in the
> PERF_EVENT_STATE_OFF state or that are scheduled for other PMUs.
> 
> Cc: Jamie Iles <jamie.iles@picochip.com>
> Reported-by: Pawel Moll <pawel.moll@arm.com>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
> ---
> 
> Resend with correct spelling of Pawel's email address on CC.
> Jamie - are you ok with this fix?
Yes, looks good to me.

Acked-by: Jamie Iles <jamie.iles@picochip.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] ARM: perf: fix event validation
  2010-09-01 12:57 ` Jamie Iles
@ 2010-09-02  8:33   ` Will Deacon
  0 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2010-09-02  8:33 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Jamie,

> On Wed, Sep 01, 2010 at 01:11:22PM +0100, Will Deacon wrote:
> > The validate_event function in the ARM perf events backend has the
> > following problems:
> >
> > 1.) Events that are disabled count towards the cost.
> > 2.) Events associated with other PMUs [for example, software events or
> >     breakpoints] do not count towards the cost, but do fail validation,
> >     causing the group to fail.
> >
> > This patch changes validate_event so that it ignores events in the
> > PERF_EVENT_STATE_OFF state or that are scheduled for other PMUs.
> >
> > Cc: Jamie Iles <jamie.iles@picochip.com>
> > Reported-by: Pawel Moll <pawel.moll@arm.com>
> > Signed-off-by: Will Deacon <will.deacon@arm.com>
> > ---
> >
> > Resend with correct spelling of Pawel's email address on CC.
> > Jamie - are you ok with this fix?
> Yes, looks good to me.
> 
> Acked-by: Jamie Iles <jamie.iles@picochip.com>

Thanks for this. Submitted as 6352/1.

Will

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-02  8:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-01 12:11 [PATCH] ARM: perf: fix event validation Will Deacon
2010-09-01 12:57 ` Jamie Iles
2010-09-02  8:33   ` Will Deacon
  -- strict thread matches above, loose matches on Subject: below --
2010-08-27 15:22 Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).