2011-03-30 02:30:38

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [GIT PULL 0/2] perf/urgent fixes

Hi Ingo,

Please consider pulling from:

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

Regards,

- Arnaldo

David S. Miller (1):
perf symbols: Properly align symbol_conf.priv_size

Robert Richter (1):
perf tools: Fix NO_NEWT=1 python build error

tools/perf/Makefile | 8 ++++++--
tools/perf/util/setup.py | 7 ++++++-
tools/perf/util/symbol.c | 2 ++
3 files changed, 14 insertions(+), 3 deletions(-)


2011-03-30 02:30:03

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH 1/2] perf symbols: Properly align symbol_conf.priv_size

From: David S. Miller <[email protected]>

If symbol_conf.priv_size is not a multiple of "sizeof(u64)" we'll bus
error on sparc64 in symbol__new because the "struct symbol *" pointer
is computed by adding symbol_conf.priv_size to the memory allocated.

We cannot isolate the fix to symbol__new and symbol__delete since the
private area is computed by subtracting the priv_size value from a
"struct symbol" pointer, so then the private area can still be
potentially unaligned.

So, simply align the symbol_conf.priv_size value in symbol__init()

Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/util/symbol.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 8f73907..f06c10f 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -2406,6 +2406,8 @@ int symbol__init(void)
if (symbol_conf.initialized)
return 0;

+ symbol_conf.priv_size = ALIGN(symbol_conf.priv_size, sizeof(u64));
+
elf_version(EV_CURRENT);
if (symbol_conf.sort_by_name)
symbol_conf.priv_size += (sizeof(struct symbol_name_rb_node) -
--
1.6.2.5

2011-03-30 02:30:36

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH 2/2] perf tools: Fix NO_NEWT=1 python build error

From: Robert Richter <[email protected]>

Fix the following build error:

GEN python/perf.so
In file included from util/evsel.h:10,
from util/python.c:6:
util/hist.h:106:18: error: newt.h: No such file or directory
error: command 'x86_64-pc-linux-gnu-gcc' failed with exit status 1
make: *** [python/perf.so] Error 1

by passing BASIC_CFLAGS to setup.py. BASIC_CFLAGS variable contains
the -DNO_NEWT_SUPPORT switch which prevents building python c
extension with newt.

Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Robert Richter <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/Makefile | 8 ++++++--
tools/perf/util/setup.py | 7 ++++++-
2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 158c30e..207dee5 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -165,8 +165,12 @@ grep-libs = $(filter -l%,$(1))
strip-libs = $(filter-out -l%,$(1))

$(OUTPUT)python/perf.so: $(PYRF_OBJS)
- $(QUIET_GEN)python util/setup.py --quiet build_ext --build-lib='$(OUTPUT)python' \
- --build-temp='$(OUTPUT)python/temp'
+ $(QUIET_GEN)( \
+ export CFLAGS="$(BASIC_CFLAGS)"; \
+ python util/setup.py --quiet build_ext --build-lib='$(OUTPUT)python' \
+ --build-temp='$(OUTPUT)python/temp' \
+ )
+
#
# No Perl scripts right now:
#
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index e24ffad..bbc982f 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -1,13 +1,18 @@
#!/usr/bin/python2

from distutils.core import setup, Extension
+from os import getenv
+
+cflags = ['-fno-strict-aliasing', '-Wno-write-strings']
+cflags += getenv('CFLAGS', '').split()

perf = Extension('perf',
sources = ['util/python.c', 'util/ctype.c', 'util/evlist.c',
'util/evsel.c', 'util/cpumap.c', 'util/thread_map.c',
'util/util.c', 'util/xyarray.c', 'util/cgroup.c'],
include_dirs = ['util/include'],
- extra_compile_args = ['-fno-strict-aliasing', '-Wno-write-strings'])
+ extra_compile_args = cflags,
+ )

setup(name='perf',
version='0.1',
--
1.6.2.5

2011-03-30 07:06:57

by Ingo Molnar

[permalink] [raw]
Subject: Re: [GIT PULL 0/2] perf/urgent fixes


* Arnaldo Carvalho de Melo <[email protected]> wrote:

> Hi Ingo,
>
> Please consider pulling from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf/urgent
>
> Regards,
>
> - Arnaldo
>
> David S. Miller (1):
> perf symbols: Properly align symbol_conf.priv_size
>
> Robert Richter (1):
> perf tools: Fix NO_NEWT=1 python build error
>
> tools/perf/Makefile | 8 ++++++--
> tools/perf/util/setup.py | 7 ++++++-
> tools/perf/util/symbol.c | 2 ++
> 3 files changed, 14 insertions(+), 3 deletions(-)

Pulled, thanks a lot Arnaldo!

Ingo