[tip:core/hweight] arch, hweight: Fix compilation errors

Previous thread: [PATCH 4/5] perf record: Don't exit in live mode when no tracepoints are enabled by Arnaldo Carvalho de Melo on Sunday, May 2, 2010 - 3:59 pm. (3 messages)

Next thread: [PATCH] UML: x86_64: fix memcpy export by Nicolas Thill on Sunday, May 2, 2010 - 4:58 pm. (2 messages)
From: Arnaldo Carvalho de Melo
Date: Sunday, May 2, 2010 - 3:58 pm

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Hi Ingo,

	Please consider pulling from:

	git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf

- Arnaldo

Arnaldo Carvalho de Melo (3):
  perf tools: Don't use code surrounded by __KERNEL__
  perf record: Don't exit in live mode when no tracepoints are enabled
  perf inject: Refactor read_buildid function

Tom Zanussi (2):
  perf/live: don't synthesize build ids at the end of a live mode trace
  perf: add perf-inject builtin

 tools/perf/Makefile                    |   17 +--
 tools/perf/builtin-annotate.c          |    2 +-
 tools/perf/builtin-buildid-list.c      |    2 +-
 tools/perf/builtin-diff.c              |    4 +-
 tools/perf/builtin-inject.c            |  228 ++++++++++++++++++++++++++++++++
 tools/perf/builtin-kmem.c              |    2 +-
 tools/perf/builtin-lock.c              |    2 +-
 tools/perf/builtin-record.c            |   24 ++--
 tools/perf/builtin-report.c            |    2 +-
 tools/perf/builtin-sched.c             |    2 +-
 tools/perf/builtin-timechart.c         |    2 +-
 tools/perf/builtin-top.c               |    2 +-
 tools/perf/builtin-trace.c             |    2 +-
 tools/perf/builtin.h                   |    1 +
 tools/perf/perf.c                      |    1 +
 tools/perf/util/bitmap.c               |   21 +++
 tools/perf/util/header.c               |   96 ++++----------
 tools/perf/util/header.h               |    2 -
 tools/perf/util/hweight.c              |   31 +++++
 tools/perf/util/include/asm/bitops.h   |   18 ---
 tools/perf/util/include/asm/hweight.h  |    8 +
 tools/perf/util/include/linux/bitmap.h |   38 +++++-
 tools/perf/util/include/linux/bitops.h |   20 ++--
 tools/perf/util/session.c              |    3 +-
 tools/perf/util/session.h              |    3 +-
 tools/perf/util/trace-event-read.c     |   19 +++-
 tools/perf/util/trace-event.h          |    2 +-
 27 files changed, 407 insertions(+), 147 deletions(-)
 create mode 100644 ...
From: Arnaldo Carvalho de Melo
Date: Sunday, May 2, 2010 - 3:58 pm

From: Tom Zanussi <tzanussi@gmail.com>

It doesn't really make sense to record the build ids at the end of a
live mode session - live mode samples need that information during the
trace rather than at the end.

Leave event__synthesize_build_id() in place, however; we'll still be
using that to synthesize build ids in a more timely fashion in a
future patch.

Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <1272696080-16435-2-git-send-email-tzanussi@gmail.com>
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |    7 -----
 tools/perf/util/header.c    |   61 -------------------------------------------
 tools/perf/util/header.h    |    2 -
 3 files changed, 0 insertions(+), 70 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 83b308a..1a73796 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -446,13 +446,6 @@ static void atexit_header(void)
 
 		process_buildids();
 		perf_header__write(&session->header, output, true);
-	} else {
-		int err;
-
-		err = event__synthesize_build_ids(process_synthesized_event,
-						  session);
-		if (err < 0)
-			pr_err("Couldn't synthesize build ids.\n");
 	}
 }
 
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 6227dc4..2d1d97e 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1136,67 +1136,6 @@ int event__synthesize_build_id(struct dso *pos, u16 misc,
 	return err;
 }
 
-static int __event_synthesize_build_ids(struct list_head *head, u16 misc,
-					event__handler_t process,
-					struct machine *machine,
-					struct perf_session *session)
-{
-	struct dso *pos;
-
-	dsos__for_each_with_build_id(pos, head) {
-		int err;
-		if (!pos->hit)
-			continue;
-
-		err = event__synthesize_build_id(pos, misc, process,
-						 machine, ...
From: Arnaldo Carvalho de Melo
Date: Sunday, May 2, 2010 - 3:58 pm

From: Arnaldo Carvalho de Melo <acme@redhat.com>

We need to refactor code to be explicitely shared by the kernel and at
least the tools/ userspace programs, so, till we do that, copy the bare
minimum bitmap/bitops code needed by tools/perf.

Reported-by: "H. Peter Anvin" <hpa@zytor.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile                    |   16 +------------
 tools/perf/util/bitmap.c               |   21 +++++++++++++++++
 tools/perf/util/hweight.c              |   31 ++++++++++++++++++++++++++
 tools/perf/util/include/asm/bitops.h   |   18 ---------------
 tools/perf/util/include/asm/hweight.h  |    8 ++++++
 tools/perf/util/include/linux/bitmap.h |   38 +++++++++++++++++++++++++++++--
 tools/perf/util/include/linux/bitops.h |   20 +++++++---------
 7 files changed, 105 insertions(+), 47 deletions(-)
 create mode 100644 tools/perf/util/bitmap.c
 create mode 100644 tools/perf/util/hweight.c
 delete mode 100644 tools/perf/util/include/asm/bitops.h
 create mode 100644 tools/perf/util/include/asm/hweight.h

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 739c441..c5ac0a9 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -377,9 +377,9 @@ LIB_H += util/include/linux/rbtree.h
 LIB_H += util/include/linux/string.h
 LIB_H += util/include/linux/types.h
 LIB_H += util/include/asm/asm-offsets.h
-LIB_H += util/include/asm/bitops.h
 LIB_H += util/include/asm/bug.h
 LIB_H += util/include/asm/byteorder.h
+LIB_H += util/include/asm/hweight.h
 LIB_H += util/include/asm/swab.h
 LIB_H += util/include/asm/system.h
 LIB_H += util/include/asm/uaccess.h
@@ -435,7 +435,6 @@ LIB_OBJS += $(OUTPUT)util/path.o
 LIB_OBJS += $(OUTPUT)util/rbtree.o
 LIB_OBJS += $(OUTPUT)util/bitmap.o
 LIB_OBJS += ...
From: Arnaldo Carvalho de Melo
Date: Sunday, May 2, 2010 - 3:59 pm

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Into two functions, one that actually reads the build_id for the dso if
it wasn't already read, and another taht will inject the event if the
build_id is available.

Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-inject.c |   76 +++++++++++++++++++++---------------------
 1 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index a5902a3..59e981a 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -67,46 +67,44 @@ static int event__repipe_tracing_data(event_t *self,
 	return err;
 }
 
-static int read_buildid(struct map *self, struct perf_session *session)
+static int dso__read_build_id(struct dso *self)
 {
-	const char *name = self->dso->long_name;
-	int err;
+	if (self->has_build_id)
+		return 0;
 
-	if (filename__read_build_id(self->dso->long_name, self->dso->build_id,
-				    sizeof(self->dso->build_id)) > 0) {
-		char sbuild_id[BUILD_ID_SIZE * 2 + 1];
+	if (filename__read_build_id(self->long_name, self->build_id,
+				    sizeof(self->build_id)) > 0) {
+		self->has_build_id = true;
+		return 0;
+	}
 
-		self->dso->has_build_id = true;
+	return -1;
+}
 
-		build_id__sprintf(self->dso->build_id,
-				  sizeof(self->dso->build_id),
-				  sbuild_id);
-		pr_debug("build id found for %s: %s\n", self->dso->long_name,
-			 sbuild_id);
-	}
+static int dso__inject_build_id(struct dso *self, struct perf_session *session)
+{
+	u16 misc = PERF_RECORD_MISC_USER;
+	struct machine *machine;
+	int err;
 
-	if (self->dso->has_build_id) {
-		u16 misc = PERF_RECORD_MISC_USER;
-		struct machine *machine;
+	if (dso__read_build_id(self) < 0) {
+		pr_debug("no ...
From: Ingo Molnar
Date: Sunday, May 2, 2010 - 11:24 pm

Pulled, thanks a lot!

	Ingo
--

From: H. Peter Anvin
Date: Sunday, May 2, 2010 - 11:29 pm

With this, core/hweight should work properly, I hope.

	-hpa


-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

--

From: Ingo Molnar
Date: Sunday, May 2, 2010 - 11:54 pm

Ok, i merged that too - will let you know about any trouble.

Thanks,

	Ingo
--

From: Ingo Molnar
Date: Monday, May 3, 2010 - 12:37 am

It broke half of the non-x86 architectures. For example on Sparc defconfig:

In file included from /home/mingo/tip/include/asm-generic/bitops/hweight.h:4,
                 from /home/mingo/tip/arch/sparc/include/asm/bitops_32.h:103,
                 from /home/mingo/tip/arch/sparc/include/asm/bitops.h:6,
                 from /home/mingo/tip/include/linux/bitops.h:17,
                 from /home/mingo/tip/include/linux/kernel.h:15,
                 from /home/mingo/tip/include/linux/sched.h:54,
                 from /home/mingo/tip/arch/sparc/kernel/asm-offsets.c:13:
/home/mingo/tip/include/asm-generic/bitops/arch_hweight.h: In function '__arch_hweight32':
/home/mingo/tip/include/asm-generic/bitops/arch_hweight.h:8: error: implicit declaration of function '__sw_hweight32'
/home/mingo/tip/include/asm-generic/bitops/arch_hweight.h: In function '__arch_hweight16':
/home/mingo/tip/include/asm-generic/bitops/arch_hweight.h:13: error: implicit declaration of function '__sw_hweight16'
/home/mingo/tip/include/asm-generic/bitops/arch_hweight.h: In function '__arch_hweight8':
/home/mingo/tip/include/asm-generic/bitops/arch_hweight.h:18: error: implicit declaration of function '__sw_hweight8'
/home/mingo/tip/include/asm-generic/bitops/arch_hweight.h: In function '__arch_hweight64':
/home/mingo/tip/include/asm-generic/bitops/arch_hweight.h:23: error: implicit declaration of function '__sw_hweight64'

(the failure on other architectures looks similar)

Thanks,

	Ingo
--

From: Borislav Petkov
Date: Monday, May 3, 2010 - 1:13 am

From: Ingo Molnar <mingo@elte.hu>

Looks like we're missing the __sw_hweightXX prototype definitions in
that include maze. Ingo, which -tip branch is that and can you put it
somewhere for me to test?

Thanks.

-- 
Regards/Gruss,
    Boris.
--

From: Ingo Molnar
Date: Monday, May 3, 2010 - 6:06 am

it's tip:core/hweight. You should be able to do 'git checkout 
tip/core/hweight' if you have -tip as a remote repository.

It's not merged into tip:master at the moment, but you can do it yourself via:

	git merge tip/core/hweight

to get the tree i tested.

Thanks,

	Ingo
--

From: Borislav Petkov
Date: Monday, May 3, 2010 - 6:07 am

From: Ingo Molnar <mingo@elte.hu>

Right, so I could reproduce that with the crosstool on kernel.org when
compiling core/hweight. The patch below should fix those errors. x86 32-
and 64-bit are also fine with the patch.

--
From: Borislav Petkov <borislav.petkov@amd.com>
Date: Mon, 3 May 2010 14:57:11 +0200
Subject: [PATCH] arch, hweight: Fix compilation errors

Fix function prototypes visibility issues when cross-compiling. Tested
with crosstool (ftp://ftp.kernel.org/pub/tools/crosstool/) with alpha,
ia64 and sparc targets.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
 include/asm-generic/bitops/arch_hweight.h |    8 ++++----
 include/linux/bitops.h                    |    5 +++++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/include/asm-generic/bitops/arch_hweight.h b/include/asm-generic/bitops/arch_hweight.h
index 9a81c1e..6a211f4 100644
--- a/include/asm-generic/bitops/arch_hweight.h
+++ b/include/asm-generic/bitops/arch_hweight.h
@@ -3,22 +3,22 @@
 
 #include <asm/types.h>
 
-inline unsigned int __arch_hweight32(unsigned int w)
+static inline unsigned int __arch_hweight32(unsigned int w)
 {
 	return __sw_hweight32(w);
 }
 
-inline unsigned int __arch_hweight16(unsigned int w)
+static inline unsigned int __arch_hweight16(unsigned int w)
 {
 	return __sw_hweight16(w);
 }
 
-inline unsigned int __arch_hweight8(unsigned int w)
+static inline unsigned int __arch_hweight8(unsigned int w)
 {
 	return __sw_hweight8(w);
 }
 
-inline unsigned long __arch_hweight64(__u64 w)
+static inline unsigned long __arch_hweight64(__u64 w)
 {
 	return __sw_hweight64(w);
 }
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index c55d5bc..26caa60 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -10,6 +10,11 @@
 #define BITS_TO_LONGS(nr)	DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
 #endif
 
+extern unsigned int __sw_hweight8(unsigned int w);
+extern unsigned int __sw_hweight16(unsigned int w);
+extern ...
From: tip-bot for Borislav Petkov
Date: Tuesday, May 4, 2010 - 10:27 am

Commit-ID:  4677d4a53e0d565742277e8913e91c821453e63e
Gitweb:     http://git.kernel.org/tip/4677d4a53e0d565742277e8913e91c821453e63e
Author:     Borislav Petkov <borislav.petkov@amd.com>
AuthorDate: Mon, 3 May 2010 14:57:11 +0200
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Tue, 4 May 2010 10:25:27 -0700

arch, hweight: Fix compilation errors

Fix function prototype visibility issues when compiling for non-x86
architectures. Tested with crosstool
(ftp://ftp.kernel.org/pub/tools/crosstool/) with alpha, ia64 and sparc
targets.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
LKML-Reference: <20100503130736.GD26107@aftab>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 include/asm-generic/bitops/arch_hweight.h |    8 ++++----
 include/linux/bitops.h                    |    5 +++++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/include/asm-generic/bitops/arch_hweight.h b/include/asm-generic/bitops/arch_hweight.h
index 9a81c1e..6a211f4 100644
--- a/include/asm-generic/bitops/arch_hweight.h
+++ b/include/asm-generic/bitops/arch_hweight.h
@@ -3,22 +3,22 @@
 
 #include <asm/types.h>
 
-inline unsigned int __arch_hweight32(unsigned int w)
+static inline unsigned int __arch_hweight32(unsigned int w)
 {
 	return __sw_hweight32(w);
 }
 
-inline unsigned int __arch_hweight16(unsigned int w)
+static inline unsigned int __arch_hweight16(unsigned int w)
 {
 	return __sw_hweight16(w);
 }
 
-inline unsigned int __arch_hweight8(unsigned int w)
+static inline unsigned int __arch_hweight8(unsigned int w)
 {
 	return __sw_hweight8(w);
 }
 
-inline unsigned long __arch_hweight64(__u64 w)
+static inline unsigned long __arch_hweight64(__u64 w)
 {
 	return __sw_hweight64(w);
 }
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index c55d5bc..26caa60 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -10,6 +10,11 @@
 #define BITS_TO_LONGS(nr)	DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
 #endif
 
+extern ...
Previous thread: [PATCH 4/5] perf record: Don't exit in live mode when no tracepoints are enabled by Arnaldo Carvalho de Melo on Sunday, May 2, 2010 - 3:59 pm. (3 messages)

Next thread: [PATCH] UML: x86_64: fix memcpy export by Nicolas Thill on Sunday, May 2, 2010 - 4:58 pm. (2 messages)