All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf: use default compiler mode by default
@ 2009-11-22 12:13 Michael S. Tsirkin
  2009-11-22 12:59 ` Ingo Molnar
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2009-11-22 12:13 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Peter Zijlstra, Paul Mackerras, Frederic Weisbecker,
	Arnaldo Carvalho de Melo, linux-kernel

gcc with no flags typically is a sane default for systems to use, and
looking at the running kernel is probably broken for cross-builds
anyway, so let's not do this.  Add EXTRA_CFLAGS so that users can
override default gcc mode if they want to.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tools/perf/Makefile |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index d0bdaf2..ab35b0f 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -148,6 +148,8 @@ all::
 # broken, or spawning external process is slower than built-in grep perf has).
 #
 # Define LDFLAGS=-static to build a static binary.
+#
+# Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
 
 PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
 	@$(SHELL_PATH) util/PERF-VERSION-GEN
@@ -160,22 +162,6 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
 uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
 uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
 
-#
-# Add -m32 for cross-builds:
-#
-ifdef NO_64BIT
-  MBITS := -m32
-else
-  #
-  # If we're on a 64-bit kernel (except ia64), use -m64:
-  #
-  ifneq ($(uname_M),ia64)
-    ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M))
-      MBITS := -m64
-    endif
-  endif
-endif
-
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
 #
@@ -212,7 +198,7 @@ ifndef PERF_DEBUG
   CFLAGS_OPTIMIZE = -O6
 endif
 
-CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
+CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
 EXTLIBS = -lpthread -lrt -lelf -lm
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
-- 
1.6.5.2.143.g8cc62

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

* Re: [PATCH] perf: use default compiler mode by default
  2009-11-22 12:13 [PATCH] perf: use default compiler mode by default Michael S. Tsirkin
@ 2009-11-22 12:59 ` Ingo Molnar
  2009-11-22 17:13 ` Arjan van de Ven
  2009-11-23  7:02 ` [tip:perf/core] perf: Use " tip-bot for Michael S. Tsirkin
  2 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2009-11-22 12:59 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Peter Zijlstra, Paul Mackerras, Frederic Weisbecker,
	Arnaldo Carvalho de Melo, linux-kernel


* Michael S. Tsirkin <mst@redhat.com> wrote:

> gcc with no flags typically is a sane default for systems to use, and
> looking at the running kernel is probably broken for cross-builds
> anyway, so let's not do this.  Add EXTRA_CFLAGS so that users can
> override default gcc mode if they want to.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  tools/perf/Makefile |   20 +++-----------------
>  1 files changed, 3 insertions(+), 17 deletions(-)
> 
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index d0bdaf2..ab35b0f 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -148,6 +148,8 @@ all::
>  # broken, or spawning external process is slower than built-in grep perf has).
>  #
>  # Define LDFLAGS=-static to build a static binary.
> +#
> +# Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
>  
>  PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
>  	@$(SHELL_PATH) util/PERF-VERSION-GEN
> @@ -160,22 +162,6 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
>  uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
>  uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
>  
> -#
> -# Add -m32 for cross-builds:
> -#
> -ifdef NO_64BIT
> -  MBITS := -m32
> -else
> -  #
> -  # If we're on a 64-bit kernel (except ia64), use -m64:
> -  #
> -  ifneq ($(uname_M),ia64)
> -    ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M))
> -      MBITS := -m64
> -    endif
> -  endif
> -endif

iirc PowerPC had some trouble in this area. Paulus?

	Ingo

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

* Re: [PATCH] perf: use default compiler mode by default
  2009-11-22 12:13 [PATCH] perf: use default compiler mode by default Michael S. Tsirkin
  2009-11-22 12:59 ` Ingo Molnar
@ 2009-11-22 17:13 ` Arjan van de Ven
  2009-11-23  6:55   ` Ingo Molnar
  2009-11-23  7:02 ` [tip:perf/core] perf: Use " tip-bot for Michael S. Tsirkin
  2 siblings, 1 reply; 6+ messages in thread
From: Arjan van de Ven @ 2009-11-22 17:13 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Ingo Molnar, Peter Zijlstra, Paul Mackerras, Frederic Weisbecker,
	Arnaldo Carvalho de Melo, linux-kernel

On Sun, 22 Nov 2009 14:13:35 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> gcc with no flags typically is a sane default for systems to use, and
> looking at the running kernel is probably broken for cross-builds
> anyway, so let's not do this.  Add EXTRA_CFLAGS so that users can
> override default gcc mode if they want to.
> 


yes please; current perf breaks if you compile it in a 32 bit chroot on
a 64 bit system.... 

-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

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

* Re: [PATCH] perf: use default compiler mode by default
  2009-11-22 17:13 ` Arjan van de Ven
@ 2009-11-23  6:55   ` Ingo Molnar
  2009-11-23 11:14     ` Paul Mackerras
  0 siblings, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2009-11-23  6:55 UTC (permalink / raw)
  To: Arjan van de Ven
  Cc: Michael S. Tsirkin, Peter Zijlstra, Paul Mackerras,
	Frederic Weisbecker, Arnaldo Carvalho de Melo, linux-kernel


* Arjan van de Ven <arjan@infradead.org> wrote:

> On Sun, 22 Nov 2009 14:13:35 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > gcc with no flags typically is a sane default for systems to use, and
> > looking at the running kernel is probably broken for cross-builds
> > anyway, so let's not do this.  Add EXTRA_CFLAGS so that users can
> > override default gcc mode if they want to.
> 
> yes please; current perf breaks if you compile it in a 32 bit chroot 
> on a 64 bit system....

ok - applied the patch with your ack.

I'd still like to hear back from Paulus whether PowerPC is affected 
negatively - IIRC it was PowerPC where we got the -m64 from originally.

Thanks,

	Ingo

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

* [tip:perf/core] perf: Use default compiler mode by default
  2009-11-22 12:13 [PATCH] perf: use default compiler mode by default Michael S. Tsirkin
  2009-11-22 12:59 ` Ingo Molnar
  2009-11-22 17:13 ` Arjan van de Ven
@ 2009-11-23  7:02 ` tip-bot for Michael S. Tsirkin
  2 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Michael S. Tsirkin @ 2009-11-23  7:02 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, mst, arjan,
	fweisbec, tglx, mingo

Commit-ID:  81516c5fc83a13a1d12f466aa7e14f5fd62a63ce
Gitweb:     http://git.kernel.org/tip/81516c5fc83a13a1d12f466aa7e14f5fd62a63ce
Author:     Michael S. Tsirkin <mst@redhat.com>
AuthorDate: Sun, 22 Nov 2009 14:13:35 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 23 Nov 2009 07:55:57 +0100

perf: Use default compiler mode by default

gcc with no flags typically is a sane default for systems to
use, and looking at the running kernel is probably broken for
cross-builds anyway, so let's not do this.  Add EXTRA_CFLAGS so
that users can override default gcc mode if they want to.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Arjan van de Ven <arjan@infradead.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <20091122121335.GA24254@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/Makefile |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index fce4c3f..3ef6621 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -148,6 +148,8 @@ all::
 # broken, or spawning external process is slower than built-in grep perf has).
 #
 # Define LDFLAGS=-static to build a static binary.
+#
+# Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
 
 PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
 	@$(SHELL_PATH) util/PERF-VERSION-GEN
@@ -160,22 +162,6 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
 uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
 uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
 
-#
-# Add -m32 for cross-builds:
-#
-ifdef NO_64BIT
-  MBITS := -m32
-else
-  #
-  # If we're on a 64-bit kernel (except ia64), use -m64:
-  #
-  ifneq ($(uname_M),ia64)
-    ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M))
-      MBITS := -m64
-    endif
-  endif
-endif
-
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
 #
@@ -212,7 +198,7 @@ ifndef PERF_DEBUG
   CFLAGS_OPTIMIZE = -O6
 endif
 
-CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
+CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
 EXTLIBS = -lpthread -lrt -lelf -lm
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)

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

* Re: [PATCH] perf: use default compiler mode by default
  2009-11-23  6:55   ` Ingo Molnar
@ 2009-11-23 11:14     ` Paul Mackerras
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Mackerras @ 2009-11-23 11:14 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Arjan van de Ven, Michael S. Tsirkin, Peter Zijlstra,
	Frederic Weisbecker, Arnaldo Carvalho de Melo, linux-kernel

Ingo Molnar writes:

> I'd still like to hear back from Paulus whether PowerPC is affected 
> negatively - IIRC it was PowerPC where we got the -m64 from originally.

It seems that a 32-bit perf now works on a 64-bit kernel on powerpc,
so I don't have any hard objection to this patch.  (For some reason,
perf top isn't getting any samples, so I'll have to chase that.)

Many distros on powerpc default to 32-bit userspace on 64-bit
machines, since that has a slight performance and size benefit for
most programs.  I expect perf is better as a 64-bit binary, since it
does a lot of 64-bit arithmetic, so users of those distros on 64-bit
machines would need to do "make EXTRA_CFLAGS=-m64".

Paul.

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

end of thread, other threads:[~2009-11-23 11:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-22 12:13 [PATCH] perf: use default compiler mode by default Michael S. Tsirkin
2009-11-22 12:59 ` Ingo Molnar
2009-11-22 17:13 ` Arjan van de Ven
2009-11-23  6:55   ` Ingo Molnar
2009-11-23 11:14     ` Paul Mackerras
2009-11-23  7:02 ` [tip:perf/core] perf: Use " tip-bot for Michael S. Tsirkin

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.