mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch] perf_event: Return -EINVAL for Offcore Response Events
@ 2011-06-10 20:07 Vince Weaver
  2011-07-01 15:15 ` [tip:perf/urgent] " tip-bot for Vince Weaver
  0 siblings, 1 reply; 3+ messages in thread
From: Vince Weaver @ 2011-06-10 20:07 UTC (permalink / raw)
  To: linux-kernel
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Arnaldo Carvalho de Melo


If we really are going to ban raw access to Offcore Response events for a 
while, then we should return a proper error code.  Right now we return "0"
which gives tools the false impression that opening the event worked.

Vince
vweaver1@eecs.utk.edu


diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 3a0338b..c6bfa6b 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -598,7 +598,7 @@ static int x86_setup_perfctr(struct perf_event *event)
 	 * there's no sane user-space generalization yet:
 	 */
 	if (attr->type == PERF_TYPE_RAW)
-		return 0;
+		return -EINVAL;
 
 	if (attr->type == PERF_TYPE_HW_CACHE)
 		return set_ext_hw_attr(hwc, event);

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

* [tip:perf/urgent] perf_event: Return -EINVAL for Offcore Response Events
  2011-06-10 20:07 [patch] perf_event: Return -EINVAL for Offcore Response Events Vince Weaver
@ 2011-07-01 15:15 ` tip-bot for Vince Weaver
  2011-07-01 15:42   ` Vince Weaver
  0 siblings, 1 reply; 3+ messages in thread
From: tip-bot for Vince Weaver @ 2011-07-01 15:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, stable, tglx, vweaver1, mingo

Commit-ID:  04bffb83d17c1b93578564f18e02b6cb1c385b40
Gitweb:     http://git.kernel.org/tip/04bffb83d17c1b93578564f18e02b6cb1c385b40
Author:     Vince Weaver <vweaver1@eecs.utk.edu>
AuthorDate: Fri, 10 Jun 2011 16:07:52 -0400
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 1 Jul 2011 10:27:09 +0200

perf_event: Return -EINVAL for Offcore Response Events

Return a proper error code when denying raw access to Offcore Response
events. Right now we return "0" which gives tools the false impression
that opening the event worked.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: <stable@kernel.org>
Link: http://lkml.kernel.org/r/alpine.DEB.2.00.1106101606000.14542@cl320.eecs.utk.edu
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/perf_event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 3a0338b..c6bfa6b 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -598,7 +598,7 @@ static int x86_setup_perfctr(struct perf_event *event)
 	 * there's no sane user-space generalization yet:
 	 */
 	if (attr->type == PERF_TYPE_RAW)
-		return 0;
+		return -EINVAL;
 
 	if (attr->type == PERF_TYPE_HW_CACHE)
 		return set_ext_hw_attr(hwc, event);

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

* Re: [tip:perf/urgent] perf_event: Return -EINVAL for Offcore Response Events
  2011-07-01 15:15 ` [tip:perf/urgent] " tip-bot for Vince Weaver
@ 2011-07-01 15:42   ` Vince Weaver
  0 siblings, 0 replies; 3+ messages in thread
From: Vince Weaver @ 2011-07-01 15:42 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, a.p.zijlstra, stable, tglx, mingo
  Cc: linux-tip-commits


On Fri, 1 Jul 2011, tip-bot for Vince Weaver wrote:

> Commit-ID:  04bffb83d17c1b93578564f18e02b6cb1c385b40
> Gitweb:     http://git.kernel.org/tip/04bffb83d17c1b93578564f18e02b6cb1c385b40
> Author:     Vince Weaver <vweaver1@eecs.utk.edu>
> AuthorDate: Fri, 10 Jun 2011 16:07:52 -0400
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Fri, 1 Jul 2011 10:27:09 +0200
> 
> perf_event: Return -EINVAL for Offcore Response Events


Wait!  Please don't apply this one.

It does indeed Return -EINVAL for Offcore Response Events but also
for *all* RAW events.

I missed that on initial testing, and then I caught the problem but 
couldn't find a simple way to return EINVAL only for config1 being set to 
nonzero.

The code used to shutdown OFFCORE_RESPONSE here is very subtle 
and non-obvious.

Vince


> 
> Return a proper error code when denying raw access to Offcore Response
> events. Right now we return "0" which gives tools the false impression
> that opening the event worked.
> 
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: <stable@kernel.org>
> Link: http://lkml.kernel.org/r/alpine.DEB.2.00.1106101606000.14542@cl320.eecs.utk.edu
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> ---
>  arch/x86/kernel/cpu/perf_event.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
> index 3a0338b..c6bfa6b 100644
> --- a/arch/x86/kernel/cpu/perf_event.c
> +++ b/arch/x86/kernel/cpu/perf_event.c
> @@ -598,7 +598,7 @@ static int x86_setup_perfctr(struct perf_event *event)
>  	 * there's no sane user-space generalization yet:
>  	 */
>  	if (attr->type == PERF_TYPE_RAW)
> -		return 0;
> +		return -EINVAL;
>  
>  	if (attr->type == PERF_TYPE_HW_CACHE)
>  		return set_ext_hw_attr(hwc, event);
> 
> 

Vince
vweaver1@eecs.utk.edu

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

end of thread, other threads:[~2011-07-01 15:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-10 20:07 [patch] perf_event: Return -EINVAL for Offcore Response Events Vince Weaver
2011-07-01 15:15 ` [tip:perf/urgent] " tip-bot for Vince Weaver
2011-07-01 15:42   ` Vince Weaver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®