History

perf tools: Remove broken __no_tail_call attribute

The GCC specific __attribute__((optimize)) attribute does not what is commonly expected and is explicitly recommended against using in production code by the GCC people. Unlike what is often expected, it doesn't add to the optimization flags, but it fully replaces them, loosing any and all optimization flags provided by the compiler commandline. The only guaranteed upon means of inhibiting tail-calls is by placing a volatile asm with side-effects after the call such that the tail-call simply cannot be done. Given the original commit wasn't specific on which calls were the problem, this removal might re-introduce the problem, which can then be re-analyzed and cured properly.

Peter Zijlstra committed 6 years ago

Commit 9ae1e991 parent 0dfbe4c3 files · +5 −20Browse files

Unified · Split

3 files
  1. tools/include/linux/compiler-gcc.h +0 −12
  2. tools/include/linux/compiler.h +0 −3
  3. tools/perf/tests/dwarf-unwind.c +5 −5
tools/include/linux/compiler-gcc.h+0−12
@@ -27,18 +27,6 @@ · 26 unmodified lines
2727 #define __pure __attribute__((pure))
2828 #endif
2929 #define noinline __attribute__((noinline))
30−#ifdef __has_attribute
31−#if __has_attribute(disable_tail_calls)
32−#define __no_tail_call __attribute__((disable_tail_calls))
33−#endif
34−#endif
35−#ifndef __no_tail_call
36−#if GCC_VERSION > 40201
37−#define __no_tail_call __attribute__((optimize("no-optimize-sibling-calls")))
38−#else
39−#define __no_tail_call
40−#endif
41−#endif
4230 #ifndef __packed
4331 #define __packed __attribute__((packed))
4432 #endif
tools/include/linux/compiler.h+0−3
@@ -47,9 +47,6 @@ · 46 unmodified lines
4747 #ifndef noinline
4848 #define noinline
4949 #endif
50−#ifndef __no_tail_call
51−#define __no_tail_call
52−#endif
5350
5451 /* Are two types/vars the same type (ignoring qualifiers)? */
5552 #ifndef __same_type
tools/perf/tests/dwarf-unwind.c+5−5
@@ -95,7 +95,7 @@ static int unwind_entry(struct unwind_entry *entry, void *arg) · 94 unmodified lines
9595 return strcmp((const char *) symbol, funcs[idx]);
9696 }
9797
98−__no_tail_call noinline int test_dwarf_unwind__thread(struct thread *thread)
98+noinline int test_dwarf_unwind__thread(struct thread *thread)
9999 {
100100 struct perf_sample sample;
101101 unsigned long cnt = 0;
@@ -126,7 +126,7 @@ __no_tail_call noinline int test_dwarf_unwind__thread(struct thread *thread) · 24 unmodified lines
126126
127127 static int global_unwind_retval = -INT_MAX;
128128
129−__no_tail_call noinline int test_dwarf_unwind__compare(void *p1, void *p2)
129+noinline int test_dwarf_unwind__compare(void *p1, void *p2)
130130 {
131131 /* Any possible value should be 'thread' */
132132 struct thread *thread = *(struct thread **)p1;
@@ -145,7 +145,7 @@ __no_tail_call noinline int test_dwarf_unwind__compare(void *p1, void *p2) · 12 unmodified lines
145145 return p1 - p2;
146146 }
147147
148−__no_tail_call noinline int test_dwarf_unwind__krava_3(struct thread *thread)
148+noinline int test_dwarf_unwind__krava_3(struct thread *thread)
149149 {
150150 struct thread *array[2] = {thread, thread};
151151 void *fp = &bsearch;
@@ -164,12 +164,12 @@ __no_tail_call noinline int test_dwarf_unwind__krava_3(struct thread *thread) · 12 unmodified lines
164164 return global_unwind_retval;
165165 }
166166
167−__no_tail_call noinline int test_dwarf_unwind__krava_2(struct thread *thread)
167+noinline int test_dwarf_unwind__krava_2(struct thread *thread)
168168 {
169169 return test_dwarf_unwind__krava_3(thread);
170170 }
171171
172−__no_tail_call noinline int test_dwarf_unwind__krava_1(struct thread *thread)
172+noinline int test_dwarf_unwind__krava_1(struct thread *thread)
173173 {
174174 return test_dwarf_unwind__krava_2(thread);
175175 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t