linux-alpha.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Cree <mcree@orcon.net.nz>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org,
	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] [alpha] Add minimal support for software performance events.
Date: Tue, 27 Oct 2009 21:09:55 +1300	[thread overview]
Message-ID: <4AE6AAD3.3000102@orcon.net.nz> (raw)
In-Reply-To: <20091026084854.GA26990@elte.hu>

[-- Attachment #1: Type: text/plain, Size: 2867 bytes --]

Ingo Molnar wrote:
> * Michael Cree <mcree@orcon.net.nz> wrote:
>   
>> In the kernel the patch enables configuration of the perf event 
>> option, adds the perf_event_open syscall, and includes a minimal 
>> architecture specific asm/perf_event.h header file.
>>
>> For the perf tool the patch implements an Alpha specific section
>> in the perf.h header file and adjusts options used in the
>> Makefile to allow compilation on Alpha.  The -Wcast-align gives
>> a "cast increases required alignment of target type" warning for
>> the list_for_each_entry() macro. The -fstack-protector-all
>> option generates a "not supported for this target" warning which
>> with -Werror causes the compiler to abort.
>>
>> Signed-off-by: Michael Cree <mcree@orcon.net.nz>
>> ---
>>  arch/alpha/Kconfig                  |    1 +
>>  arch/alpha/include/asm/perf_event.h |    9 +++++++++
>>  arch/alpha/include/asm/unistd.h     |    3 ++-
>>  arch/alpha/kernel/systbls.S         |    1 +
>>  tools/perf/Makefile                 |    5 ++---
>>  tools/perf/perf.h                   |    6 ++++++
>>  6 files changed, 21 insertions(+), 4 deletions(-)
>>  create mode 100644 arch/alpha/include/asm/perf_event.h
>>     
>
> Nice!
>
> I've picked up the perf.h bit in an independent commit. Is there a tree 
> for Alpha bits?
>   

Not that I know of.  Note also that this patch is on top of the patch 
"alpha: Wire up missing/new syscalls" recently posted by Daniele Calore 
(http://lkml.org/lkml/2009/10/21/99).  Hopefully this and prior patches 
get picked up by the Alpha maintainers.

> This portion:
>   
>> --- a/tools/perf/Makefile
>> +++ b/tools/perf/Makefile
>> @@ -201,7 +200,7 @@ EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition
>>  EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes
>>  EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement
>>  
>> -CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
>> +CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
>>  LDFLAGS = -lpthread -lrt -lelf -lm
>>  ALL_CFLAGS = $(CFLAGS)
>>  ALL_LDFLAGS = $(LDFLAGS)
>>     
>
> Should be done not by removing the stack-protector build unconditionally 
> - but by auto-testing whether stackprotector is supported by GCC and 
> using it if yes.
>   

Revised patch attached.  It includes a test that the compiler doesn't 
bomb out with -fstack-protector-all and only adds the option to CFLAGS 
if ok.  But I have had to put the test below the definition of the macro 
CC.  This has the side effect of separating the addition of 
-fstack-protector-all from the main definitions of CFLAGS and 
ALL_CFLAGS, and is not ideal in my opinion.  The patch also removes 
-Wcast-align (I forgot to say that in the commit message of the patch).

Michael.



[-- Attachment #2: 0001-Test-fstack-protector-all-compiler-option-for-inclus.patch --]
[-- Type: text/x-patch, Size: 1993 bytes --]

From 92feeaec19635a10145fa32a2f0077c4ddda5c7d Mon Sep 17 00:00:00 2001
From: Michael Cree <mcree@orcon.net.nz>
Date: Tue, 27 Oct 2009 20:56:27 +1300
Subject: [PATCH] Test -fstack-protector-all compiler option for inclusion in CFLAGS.

Some architectures (e.g. Alpha) do not support the -fstack-protector-all
compiler option and the use of the option with -Werror causes the compiler
to abort.  Test that the compiler supports -fstack-protector-all before
inclusion in CFLAGS.
---
 tools/perf/Makefile |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 742a32e..e7dc01d 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -177,8 +177,7 @@ endif
 # Include saner warnings here, which can catch bugs:
 #
 
-EXTRA_WARNINGS := -Wcast-align
-EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat
+EXTRA_WARNINGS := -Wformat
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-security
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wformat-y2k
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wshadow
@@ -201,7 +200,7 @@ EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement
 
-CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
+CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
 LDFLAGS = -lpthread -lrt -lelf -lm
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
@@ -253,6 +252,9 @@ PTHREAD_LIBS = -lpthread
 # explicitly what architecture to check for. Fix this up for yours..
 SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
 
+ifeq ($(shell sh -c "echo 'int foo(void) {char X[2]; return 3;}' | $(CC) -x c -c -Werror -fstack-protector-all - -o /dev/null >/dev/null 2>&1 && echo y"), y)
+  CFLAGS := $(CFLAGS) -fstack-protector-all
+endif
 
 
 ### --- END CONFIGURATION SECTION ---
-- 
1.6.3.3


  reply	other threads:[~2009-10-27  8:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-26  8:32 [PATCH] [alpha] Add minimal support for software performance events Michael Cree
2009-10-26  8:48 ` Ingo Molnar
2009-10-27  8:09   ` Michael Cree [this message]
2009-11-08 12:22     ` Ingo Molnar
2009-11-08 12:27       ` Ingo Molnar
2009-11-11  7:43         ` Michael Cree
2009-10-27 18:29   ` Matt Turner
2009-10-28 20:56     ` Sam Ravnborg
2009-12-01  4:30 ` Matt Turner
2009-12-01  9:31   ` Michael Cree

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AE6AAD3.3000102@orcon.net.nz \
    --to=mcree@orcon.net.nz \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=ink@jurassic.park.msu.ru \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).