cdf8bac32325a7629d77940010ccb2086de69abd
[openwrt/staging/hauke.git] / target / linux / generic / pending-4.14 / 220-optimize_inlining.patch
1 --- a/arch/arm/include/asm/hardirq.h
2 +++ b/arch/arm/include/asm/hardirq.h
3 @@ -6,6 +6,7 @@
4 #include <linux/threads.h>
5 #include <asm/irq.h>
6
7 +/* number of IPIS _not_ including IPI_CPU_BACKTRACE */
8 #define NR_IPI 7
9
10 typedef struct {
11 --- a/arch/arm/kernel/atags.h
12 +++ b/arch/arm/kernel/atags.h
13 @@ -5,7 +5,7 @@ void convert_to_tag_list(struct tag *tag
14 const struct machine_desc *setup_machine_tags(phys_addr_t __atags_pointer,
15 unsigned int machine_nr);
16 #else
17 -static inline const struct machine_desc *
18 +static inline const struct machine_desc * __init __noreturn
19 setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr)
20 {
21 early_print("no ATAGS support: can't continue\n");
22 --- a/arch/arm/kernel/smp.c
23 +++ b/arch/arm/kernel/smp.c
24 @@ -76,6 +76,10 @@ enum ipi_msg_type {
25 IPI_CPU_STOP,
26 IPI_IRQ_WORK,
27 IPI_COMPLETION,
28 + /*
29 + * CPU_BACKTRACE is special and not included in NR_IPI
30 + * or tracable with trace_ipi_*
31 + */
32 IPI_CPU_BACKTRACE,
33 /*
34 * SGI8-15 can be reserved by secure firmware, and thus may
35 @@ -801,7 +805,7 @@ core_initcall(register_cpufreq_notifier)
36
37 static void raise_nmi(cpumask_t *mask)
38 {
39 - smp_cross_call(mask, IPI_CPU_BACKTRACE);
40 + __smp_cross_call(mask, IPI_CPU_BACKTRACE);
41 }
42
43 void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self)
44 --- a/arch/arm64/include/asm/cpufeature.h
45 +++ b/arch/arm64/include/asm/cpufeature.h
46 @@ -125,7 +125,7 @@ static inline bool cpu_have_feature(unsi
47 }
48
49 /* System capability check for constant caps */
50 -static inline bool __cpus_have_const_cap(int num)
51 +static __always_inline bool __cpus_have_const_cap(int num)
52 {
53 if (num >= ARM64_NCAPS)
54 return false;
55 @@ -139,7 +139,7 @@ static inline bool cpus_have_cap(unsigne
56 return test_bit(num, cpu_hwcaps);
57 }
58
59 -static inline bool cpus_have_const_cap(int num)
60 +static __always_inline bool cpus_have_const_cap(int num)
61 {
62 if (static_branch_likely(&arm64_const_caps_ready))
63 return __cpus_have_const_cap(num);
64 --- a/arch/mips/include/asm/bitops.h
65 +++ b/arch/mips/include/asm/bitops.h
66 @@ -462,7 +462,7 @@ static inline void __clear_bit_unlock(un
67 * Return the bit position (0..63) of the most significant 1 bit in a word
68 * Returns -1 if no 1 bit exists
69 */
70 -static inline unsigned long __fls(unsigned long word)
71 +static __always_inline unsigned long __fls(unsigned long word)
72 {
73 int num;
74
75 @@ -528,7 +528,7 @@ static inline unsigned long __fls(unsign
76 * Returns 0..SZLONG-1
77 * Undefined if no bit exists, so code should check against 0 first.
78 */
79 -static inline unsigned long __ffs(unsigned long word)
80 +static __always_inline unsigned long __ffs(unsigned long word)
81 {
82 return __fls(word & -word);
83 }
84 --- a/arch/mips/kernel/cpu-bugs64.c
85 +++ b/arch/mips/kernel/cpu-bugs64.c
86 @@ -42,8 +42,8 @@ static inline void align_mod(const int a
87 : GCC_IMM_ASM() (align), GCC_IMM_ASM() (mod));
88 }
89
90 -static inline void mult_sh_align_mod(long *v1, long *v2, long *w,
91 - const int align, const int mod)
92 +static __always_inline void mult_sh_align_mod(long *v1, long *v2, long *w,
93 + const int align, const int mod)
94 {
95 unsigned long flags;
96 int m1, m2;
97 --- a/arch/powerpc/kernel/prom_init.c
98 +++ b/arch/powerpc/kernel/prom_init.c
99 @@ -474,14 +474,14 @@ static int __init prom_next_node(phandle
100 }
101 }
102
103 -static inline int prom_getprop(phandle node, const char *pname,
104 - void *value, size_t valuelen)
105 +static inline int __init prom_getprop(phandle node, const char *pname,
106 + void *value, size_t valuelen)
107 {
108 return call_prom("getprop", 4, 1, node, ADDR(pname),
109 (u32)(unsigned long) value, (u32) valuelen);
110 }
111
112 -static inline int prom_getproplen(phandle node, const char *pname)
113 +static inline int __init prom_getproplen(phandle node, const char *pname)
114 {
115 return call_prom("getproplen", 2, 1, node, ADDR(pname));
116 }
117 --- a/arch/s390/include/asm/cpacf.h
118 +++ b/arch/s390/include/asm/cpacf.h
119 @@ -184,7 +184,7 @@ static inline int __cpacf_check_opcode(u
120 }
121 }
122
123 -static inline int cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
124 +static __always_inline int cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
125 {
126 if (__cpacf_check_opcode(opcode)) {
127 __cpacf_query(opcode, mask);
128 --- a/arch/x86/Kconfig.debug
129 +++ b/arch/x86/Kconfig.debug
130 @@ -284,20 +284,6 @@ config CPA_DEBUG
131 ---help---
132 Do change_page_attr() self-tests every 30 seconds.
133
134 -config OPTIMIZE_INLINING
135 - bool "Allow gcc to uninline functions marked 'inline'"
136 - ---help---
137 - This option determines if the kernel forces gcc to inline the functions
138 - developers have marked 'inline'. Doing so takes away freedom from gcc to
139 - do what it thinks is best, which is desirable for the gcc 3.x series of
140 - compilers. The gcc 4.x series have a rewritten inlining algorithm and
141 - enabling this option will generate a smaller kernel there. Hopefully
142 - this algorithm is so good that allowing gcc 4.x and above to make the
143 - decision will become the default in the future. Until then this option
144 - is there to test gcc for this.
145 -
146 - If unsure, say N.
147 -
148 config DEBUG_ENTRY
149 bool "Debug low-level entry code"
150 depends on DEBUG_KERNEL
151 --- a/lib/Kconfig.debug
152 +++ b/lib/Kconfig.debug
153 @@ -305,6 +305,20 @@ config HEADERS_CHECK
154 exported to $(INSTALL_HDR_PATH) (usually 'usr/include' in
155 your build tree), to make sure they're suitable.
156
157 +config OPTIMIZE_INLINING
158 + bool "Allow compiler to uninline functions marked 'inline'"
159 + help
160 + This option determines if the kernel forces gcc to inline the functions
161 + developers have marked 'inline'. Doing so takes away freedom from gcc to
162 + do what it thinks is best, which is desirable for the gcc 3.x series of
163 + compilers. The gcc 4.x series have a rewritten inlining algorithm and
164 + enabling this option will generate a smaller kernel there. Hopefully
165 + this algorithm is so good that allowing gcc 4.x and above to make the
166 + decision will become the default in the future. Until then this option
167 + is there to test gcc for this.
168 +
169 + If unsure, say N.
170 +
171 config DEBUG_SECTION_MISMATCH
172 bool "Enable full Section mismatch analysis"
173 help
174 --- a/arch/x86/Kconfig
175 +++ b/arch/x86/Kconfig
176 @@ -296,9 +296,6 @@ config ZONE_DMA32
177 config AUDIT_ARCH
178 def_bool y if X86_64
179
180 -config ARCH_SUPPORTS_OPTIMIZED_INLINING
181 - def_bool y
182 -
183 config ARCH_SUPPORTS_DEBUG_PAGEALLOC
184 def_bool y
185
186 --- a/include/linux/compiler-gcc.h
187 +++ b/include/linux/compiler-gcc.h
188 @@ -90,8 +90,7 @@
189 * of extern inline functions at link time.
190 * A lot of inline functions can cause havoc with function tracing.
191 */
192 -#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
193 - !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
194 +#if !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
195 #define inline \
196 inline __attribute__((always_inline, unused)) notrace __gnu_inline
197 #else