linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf tool: Fix type for references to data_head/tail
@ 2015-04-07 15:20 David Ahern
  2015-04-07 15:26 ` Peter Zijlstra
  2015-04-11  6:38 ` [tip:perf/core] perf evlist: Fix type for references to data_head /tail tip-bot for David Ahern
  0 siblings, 2 replies; 3+ messages in thread
From: David Ahern @ 2015-04-07 15:20 UTC (permalink / raw)
  To: acme
  Cc: linux-kernel, David Ahern, Peter Zijlstra, Frederic Weisbecker,
	Jiri Olsa, Namhyung Kim, Stephane Eranian

data_head and data_tail are defined as __u64 in linux/perf_event.h,
but perf userspace uses int and unsigned int. Convert all references
to u64 for consistency.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/builtin-record.c | 4 ++--
 tools/perf/util/evlist.c    | 6 +++---
 tools/perf/util/evlist.h    | 9 ++++-----
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 18aad239b401..2d0e99fa90d1 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -70,8 +70,8 @@ static int process_synthesized_event(struct perf_tool *tool,
 static int record__mmap_read(struct record *rec, int idx)
 {
 	struct perf_mmap *md = &rec->evlist->mmap[idx];
-	unsigned int head = perf_mmap__read_head(md);
-	unsigned int old = md->prev;
+	u64 head = perf_mmap__read_head(md);
+	u64 old = md->prev;
 	unsigned char *data = md->base + page_size;
 	unsigned long size;
 	void *buf;
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 82bf224bbee9..8b59a214d172 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -634,8 +634,8 @@ static struct perf_evsel *perf_evlist__event2evsel(struct perf_evlist *evlist,
 union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
 {
 	struct perf_mmap *md = &evlist->mmap[idx];
-	unsigned int head = perf_mmap__read_head(md);
-	unsigned int old = md->prev;
+	u64 head = perf_mmap__read_head(md);
+	u64 old = md->prev;
 	unsigned char *data = md->base + page_size;
 	union perf_event *event = NULL;
 
@@ -716,7 +716,7 @@ void perf_evlist__mmap_consume(struct perf_evlist *evlist, int idx)
 	struct perf_mmap *md = &evlist->mmap[idx];
 
 	if (!evlist->overwrite) {
-		unsigned int old = md->prev;
+		u64 old = md->prev;
 
 		perf_mmap__write_tail(md, old);
 	}
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index fb19c47b8aac..b5cce95d644e 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -27,7 +27,7 @@ struct perf_mmap {
 	void		 *base;
 	int		 mask;
 	int		 refcnt;
-	unsigned int	 prev;
+	u64		 prev;
 	char		 event_copy[PERF_SAMPLE_MAX_SIZE] __attribute__((aligned(8)));
 };
 
@@ -189,16 +189,15 @@ size_t perf_evlist__fprintf(struct perf_evlist *evlist, FILE *fp);
 int perf_evlist__strerror_open(struct perf_evlist *evlist, int err, char *buf, size_t size);
 int perf_evlist__strerror_mmap(struct perf_evlist *evlist, int err, char *buf, size_t size);
 
-static inline unsigned int perf_mmap__read_head(struct perf_mmap *mm)
+static inline u64 perf_mmap__read_head(struct perf_mmap *mm)
 {
 	struct perf_event_mmap_page *pc = mm->base;
-	int head = ACCESS_ONCE(pc->data_head);
+	u64 head = ACCESS_ONCE(pc->data_head);
 	rmb();
 	return head;
 }
 
-static inline void perf_mmap__write_tail(struct perf_mmap *md,
-					 unsigned long tail)
+static inline void perf_mmap__write_tail(struct perf_mmap *md, u64 tail)
 {
 	struct perf_event_mmap_page *pc = md->base;
 
-- 
2.2.1


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

* Re: [PATCH] perf tool: Fix type for references to data_head/tail
  2015-04-07 15:20 [PATCH] perf tool: Fix type for references to data_head/tail David Ahern
@ 2015-04-07 15:26 ` Peter Zijlstra
  2015-04-11  6:38 ` [tip:perf/core] perf evlist: Fix type for references to data_head /tail tip-bot for David Ahern
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2015-04-07 15:26 UTC (permalink / raw)
  To: David Ahern
  Cc: acme, linux-kernel, Frederic Weisbecker, Jiri Olsa, Namhyung Kim,
	Stephane Eranian

On Tue, Apr 07, 2015 at 09:20:37AM -0600, David Ahern wrote:
> data_head and data_tail are defined as __u64 in linux/perf_event.h,
> but perf userspace uses int and unsigned int. Convert all references
> to u64 for consistency.

Ack on that. I suspect this is because >2G mmap()s are a tad silly, but
yes its good to fix that.

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

* [tip:perf/core] perf evlist: Fix type for references to data_head /tail
  2015-04-07 15:20 [PATCH] perf tool: Fix type for references to data_head/tail David Ahern
  2015-04-07 15:26 ` Peter Zijlstra
@ 2015-04-11  6:38 ` tip-bot for David Ahern
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for David Ahern @ 2015-04-11  6:38 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, eranian, dsahern, fweisbec, linux-kernel, hpa, jolsa,
	mingo, peterz, acme, namhyung

Commit-ID:  7b8283b56d9fb36106ff1c459dfd399a20bd374d
Gitweb:     http://git.kernel.org/tip/7b8283b56d9fb36106ff1c459dfd399a20bd374d
Author:     David Ahern <dsahern@gmail.com>
AuthorDate: Tue, 7 Apr 2015 09:20:37 -0600
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 10 Apr 2015 11:29:20 -0300

perf evlist: Fix type for references to data_head/tail

The data_head and data_tail fields are defined as __u64 in
linux/perf_event.h, but perf userspace uses int and unsigned int.

Convert all references to u64 for consistency.

Signed-off-by: David Ahern <dsahern@gmail.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1428420037-26599-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c | 4 ++--
 tools/perf/util/evlist.c    | 6 +++---
 tools/perf/util/evlist.h    | 9 ++++-----
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index ac61048..c3efdfb 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -70,8 +70,8 @@ static int process_synthesized_event(struct perf_tool *tool,
 static int record__mmap_read(struct record *rec, int idx)
 {
 	struct perf_mmap *md = &rec->evlist->mmap[idx];
-	unsigned int head = perf_mmap__read_head(md);
-	unsigned int old = md->prev;
+	u64 head = perf_mmap__read_head(md);
+	u64 old = md->prev;
 	unsigned char *data = md->base + page_size;
 	unsigned long size;
 	void *buf;
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 76ef7ee..080be93 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -634,8 +634,8 @@ static struct perf_evsel *perf_evlist__event2evsel(struct perf_evlist *evlist,
 union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
 {
 	struct perf_mmap *md = &evlist->mmap[idx];
-	unsigned int head = perf_mmap__read_head(md);
-	unsigned int old = md->prev;
+	u64 head = perf_mmap__read_head(md);
+	u64 old = md->prev;
 	unsigned char *data = md->base + page_size;
 	union perf_event *event = NULL;
 
@@ -716,7 +716,7 @@ void perf_evlist__mmap_consume(struct perf_evlist *evlist, int idx)
 	struct perf_mmap *md = &evlist->mmap[idx];
 
 	if (!evlist->overwrite) {
-		unsigned int old = md->prev;
+		u64 old = md->prev;
 
 		perf_mmap__write_tail(md, old);
 	}
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index fb19c47..b5cce95 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -27,7 +27,7 @@ struct perf_mmap {
 	void		 *base;
 	int		 mask;
 	int		 refcnt;
-	unsigned int	 prev;
+	u64		 prev;
 	char		 event_copy[PERF_SAMPLE_MAX_SIZE] __attribute__((aligned(8)));
 };
 
@@ -189,16 +189,15 @@ size_t perf_evlist__fprintf(struct perf_evlist *evlist, FILE *fp);
 int perf_evlist__strerror_open(struct perf_evlist *evlist, int err, char *buf, size_t size);
 int perf_evlist__strerror_mmap(struct perf_evlist *evlist, int err, char *buf, size_t size);
 
-static inline unsigned int perf_mmap__read_head(struct perf_mmap *mm)
+static inline u64 perf_mmap__read_head(struct perf_mmap *mm)
 {
 	struct perf_event_mmap_page *pc = mm->base;
-	int head = ACCESS_ONCE(pc->data_head);
+	u64 head = ACCESS_ONCE(pc->data_head);
 	rmb();
 	return head;
 }
 
-static inline void perf_mmap__write_tail(struct perf_mmap *md,
-					 unsigned long tail)
+static inline void perf_mmap__write_tail(struct perf_mmap *md, u64 tail)
 {
 	struct perf_event_mmap_page *pc = md->base;
 

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

end of thread, other threads:[~2015-04-11  6:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-07 15:20 [PATCH] perf tool: Fix type for references to data_head/tail David Ahern
2015-04-07 15:26 ` Peter Zijlstra
2015-04-11  6:38 ` [tip:perf/core] perf evlist: Fix type for references to data_head /tail tip-bot for David Ahern

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).