Skip to contentSkip to conversation

perf/urgent fixes

GIT PULL New Arnaldo Carvalho de Melo 2 participants 4 messages Mar 30, 2011 perf events

lore
Share & tools
lore
#1 lore raw

PATCH 1/2 perf symbols: Properly align symbol_conf.priv_size

In reply to Arnaldo Carvalho de Melo

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]>

---
 tools/perf/util/symbol.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
tools/perf/util/symbol.c +2 -0
index 8f73907..f06c10f 100644
@@ -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) -
Signature · 1 line
1.6.2.5
#2 lore raw

PATCH 2/2 perf tools: Fix NO_NEWT=1 python build error

In reply to Arnaldo Carvalho de Melo

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]>

---
 tools/perf/Makefile      |    8 ++++++--
 tools/perf/util/setup.py |    7 ++++++-
 2 files changed, 12 insertions(+), 3 deletions(-)
tools/perf/Makefile +6 -2
index 158c30e..207dee5 100644
@@ -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:
 #
tools/perf/util/setup.py +6 -1
index e24ffad..bbc982f 100644
@@ -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',
Signature · 1 line
1.6.2.5
#0 lore raw

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(-)
#3 lore raw
Quoted 13 lines · Arnaldo Carvalho de Melo

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

Quoted 7 lines

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