All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf: cleanup initialization of attr->size
@ 2012-02-09 15:12 Stephane Eranian
  2012-02-17  9:55 ` [tip:perf/core] perf tools: " tip-bot for Stephane Eranian
  0 siblings, 1 reply; 2+ messages in thread
From: Stephane Eranian @ 2012-02-09 15:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: acme, peterz, mingo


The perf_event_attr size needs to be initialized
in all cases because it captures the ABI version.

This patch moves the initialization of the field
from the perf_event_open() syscall stub to its proper
location in the event_attr_init().

Signed-off-by: Stephane Eranian <eranian@google.com>
---

diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 92af168..06f2d1a 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -167,7 +167,6 @@ sys_perf_event_open(struct perf_event_attr *attr,
 		      pid_t pid, int cpu, int group_fd,
 		      unsigned long flags)
 {
-	attr->size = sizeof(*attr);
 	return syscall(__NR_perf_event_open, attr, pid, cpu,
 		       group_fd, flags);
 }
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 8131410..c1017b3 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -14,6 +14,8 @@ void event_attr_init(struct perf_event_attr *attr)
 		attr->exclude_host  = 1;
 	if (!perf_guest)
 		attr->exclude_guest = 1;
+	/* to capture ABI version */
+	attr->size = sizeof(*attr);
 }
 
 int mkdir_p(char *path, mode_t mode)

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

* [tip:perf/core] perf tools: cleanup initialization of attr->size
  2012-02-09 15:12 [PATCH] perf: cleanup initialization of attr->size Stephane Eranian
@ 2012-02-17  9:55 ` tip-bot for Stephane Eranian
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Stephane Eranian @ 2012-02-17  9:55 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, eranian, hpa, mingo, peterz, tglx, mingo

Commit-ID:  7e1ccd3804281fc0755eb726b654469c40a96d89
Gitweb:     http://git.kernel.org/tip/7e1ccd3804281fc0755eb726b654469c40a96d89
Author:     Stephane Eranian <eranian@google.com>
AuthorDate: Thu, 9 Feb 2012 16:12:38 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 13 Feb 2012 23:35:04 -0200

perf tools: cleanup initialization of attr->size

The perf_event_attr size needs to be initialized in all cases because it
captures the ABI version.

This patch moves the initialization of the field from the
perf_event_open() syscall stub to its proper location in the
event_attr_init().

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20120209151238.GA10272@quad
Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/perf.h      |    1 -
 tools/perf/util/util.c |    2 ++
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index deb17db..03a0456 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -167,7 +167,6 @@ sys_perf_event_open(struct perf_event_attr *attr,
 		      pid_t pid, int cpu, int group_fd,
 		      unsigned long flags)
 {
-	attr->size = sizeof(*attr);
 	return syscall(__NR_perf_event_open, attr, pid, cpu,
 		       group_fd, flags);
 }
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index fb25d13..8109a90 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -14,6 +14,8 @@ void event_attr_init(struct perf_event_attr *attr)
 		attr->exclude_host  = 1;
 	if (!perf_guest)
 		attr->exclude_guest = 1;
+	/* to capture ABI version */
+	attr->size = sizeof(*attr);
 }
 
 int mkdir_p(char *path, mode_t mode)

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

end of thread, other threads:[~2012-02-17  9:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-09 15:12 [PATCH] perf: cleanup initialization of attr->size Stephane Eranian
2012-02-17  9:55 ` [tip:perf/core] perf tools: " tip-bot for Stephane Eranian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.