1 |
commit: 1c12fddcb69afbf1077cbcf5aae1022ad463aaf6 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jul 7 00:43:05 2015 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jul 7 00:43:05 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=1c12fddc |
7 |
|
8 |
Linux patch 3.10.83 |
9 |
|
10 |
0000_README | 4 + |
11 |
1082_linux-3.10.83.patch | 1734 ++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 1738 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index 5e45831..1cfdd1d 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -370,6 +370,10 @@ Patch: 1081_linux-3.10.82.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 3.10.82 |
21 |
|
22 |
+Patch: 1082_linux-3.10.83.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 3.10.83 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1082_linux-3.10.83.patch b/1082_linux-3.10.83.patch |
31 |
new file mode 100644 |
32 |
index 0000000..187a86e |
33 |
--- /dev/null |
34 |
+++ b/1082_linux-3.10.83.patch |
35 |
@@ -0,0 +1,1734 @@ |
36 |
+diff --git a/Makefile b/Makefile |
37 |
+index 5e3e665a10b7..21529dbcc11d 100644 |
38 |
+--- a/Makefile |
39 |
++++ b/Makefile |
40 |
+@@ -1,6 +1,6 @@ |
41 |
+ VERSION = 3 |
42 |
+ PATCHLEVEL = 10 |
43 |
+-SUBLEVEL = 82 |
44 |
++SUBLEVEL = 83 |
45 |
+ EXTRAVERSION = |
46 |
+ NAME = TOSSUG Baby Fish |
47 |
+ |
48 |
+diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c |
49 |
+index e2b5da031f96..8d4f5dc56910 100644 |
50 |
+--- a/arch/arm/mach-dove/common.c |
51 |
++++ b/arch/arm/mach-dove/common.c |
52 |
+@@ -226,7 +226,7 @@ void __init dove_init_early(void) |
53 |
+ orion_time_set_base(TIMER_VIRT_BASE); |
54 |
+ mvebu_mbus_init("marvell,dove-mbus", |
55 |
+ BRIDGE_WINS_BASE, BRIDGE_WINS_SZ, |
56 |
+- DOVE_MC_WINS_BASE, DOVE_MC_WINS_SZ); |
57 |
++ DOVE_MC_WINS_BASE, DOVE_MC_WINS_SZ, 0); |
58 |
+ } |
59 |
+ |
60 |
+ static int __init dove_find_tclk(void) |
61 |
+diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c |
62 |
+index 2acaded8025d..ed00c9e3bfc6 100644 |
63 |
+--- a/arch/arm/mach-imx/clk-imx6q.c |
64 |
++++ b/arch/arm/mach-imx/clk-imx6q.c |
65 |
+@@ -515,7 +515,7 @@ int __init mx6q_clocks_init(void) |
66 |
+ clk[gpmi_io] = imx_clk_gate2("gpmi_io", "enfc", base + 0x78, 28); |
67 |
+ clk[gpmi_apb] = imx_clk_gate2("gpmi_apb", "usdhc3", base + 0x78, 30); |
68 |
+ clk[rom] = imx_clk_gate2("rom", "ahb", base + 0x7c, 0); |
69 |
+- clk[sata] = imx_clk_gate2("sata", "ipg", base + 0x7c, 4); |
70 |
++ clk[sata] = imx_clk_gate2("sata", "ahb", base + 0x7c, 4); |
71 |
+ clk[sdma] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6); |
72 |
+ clk[spba] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12); |
73 |
+ clk[ssi1_ipg] = imx_clk_gate2("ssi1_ipg", "ipg", base + 0x7c, 18); |
74 |
+diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c |
75 |
+index f38922897563..4f6831ea88c5 100644 |
76 |
+--- a/arch/arm/mach-kirkwood/common.c |
77 |
++++ b/arch/arm/mach-kirkwood/common.c |
78 |
+@@ -530,7 +530,7 @@ void __init kirkwood_init_early(void) |
79 |
+ |
80 |
+ mvebu_mbus_init("marvell,kirkwood-mbus", |
81 |
+ BRIDGE_WINS_BASE, BRIDGE_WINS_SZ, |
82 |
+- DDR_WINDOW_CPU_BASE, DDR_WINDOW_CPU_SZ); |
83 |
++ DDR_WINDOW_CPU_BASE, DDR_WINDOW_CPU_SZ, 0); |
84 |
+ } |
85 |
+ |
86 |
+ int kirkwood_tclk; |
87 |
+diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c |
88 |
+index 749a7f8c4992..4722c98dc1bb 100644 |
89 |
+--- a/arch/arm/mach-mv78xx0/common.c |
90 |
++++ b/arch/arm/mach-mv78xx0/common.c |
91 |
+@@ -337,11 +337,11 @@ void __init mv78xx0_init_early(void) |
92 |
+ if (mv78xx0_core_index() == 0) |
93 |
+ mvebu_mbus_init("marvell,mv78xx0-mbus", |
94 |
+ BRIDGE_WINS_CPU0_BASE, BRIDGE_WINS_SZ, |
95 |
+- DDR_WINDOW_CPU0_BASE, DDR_WINDOW_CPU_SZ); |
96 |
++ DDR_WINDOW_CPU0_BASE, DDR_WINDOW_CPU_SZ, 0); |
97 |
+ else |
98 |
+ mvebu_mbus_init("marvell,mv78xx0-mbus", |
99 |
+ BRIDGE_WINS_CPU1_BASE, BRIDGE_WINS_SZ, |
100 |
+- DDR_WINDOW_CPU1_BASE, DDR_WINDOW_CPU_SZ); |
101 |
++ DDR_WINDOW_CPU1_BASE, DDR_WINDOW_CPU_SZ, 0); |
102 |
+ } |
103 |
+ |
104 |
+ void __init_refok mv78xx0_timer_init(void) |
105 |
+diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c |
106 |
+index 1c48890bb72b..4377c3484a62 100644 |
107 |
+--- a/arch/arm/mach-mvebu/armada-370-xp.c |
108 |
++++ b/arch/arm/mach-mvebu/armada-370-xp.c |
109 |
+@@ -66,7 +66,8 @@ void __init armada_370_xp_init_early(void) |
110 |
+ ARMADA_370_XP_MBUS_WINS_BASE, |
111 |
+ ARMADA_370_XP_MBUS_WINS_SIZE, |
112 |
+ ARMADA_370_XP_SDRAM_WINS_BASE, |
113 |
+- ARMADA_370_XP_SDRAM_WINS_SIZE); |
114 |
++ ARMADA_370_XP_SDRAM_WINS_SIZE, |
115 |
++ coherency_available()); |
116 |
+ |
117 |
+ #ifdef CONFIG_CACHE_L2X0 |
118 |
+ l2x0_of_init(0, ~0UL); |
119 |
+diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c |
120 |
+index 3ee701f1d38e..ea26ebb5bb5a 100644 |
121 |
+--- a/arch/arm/mach-mvebu/coherency.c |
122 |
++++ b/arch/arm/mach-mvebu/coherency.c |
123 |
+@@ -137,6 +137,20 @@ static struct notifier_block mvebu_hwcc_platform_nb = { |
124 |
+ .notifier_call = mvebu_hwcc_platform_notifier, |
125 |
+ }; |
126 |
+ |
127 |
++/* |
128 |
++ * Keep track of whether we have IO hardware coherency enabled or not. |
129 |
++ * On Armada 370's we will not be using it for example. We need to make |
130 |
++ * that available [through coherency_available()] so the mbus controller |
131 |
++ * doesn't enable the IO coherency bit in the attribute bits of the |
132 |
++ * chip selects. |
133 |
++ */ |
134 |
++static int coherency_enabled; |
135 |
++ |
136 |
++int coherency_available(void) |
137 |
++{ |
138 |
++ return coherency_enabled; |
139 |
++} |
140 |
++ |
141 |
+ int __init coherency_init(void) |
142 |
+ { |
143 |
+ struct device_node *np; |
144 |
+@@ -170,6 +184,7 @@ int __init coherency_init(void) |
145 |
+ coherency_base = of_iomap(np, 0); |
146 |
+ coherency_cpu_base = of_iomap(np, 1); |
147 |
+ set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0); |
148 |
++ coherency_enabled = 1; |
149 |
+ bus_register_notifier(&platform_bus_type, |
150 |
+ &mvebu_hwcc_platform_nb); |
151 |
+ } |
152 |
+diff --git a/arch/arm/mach-mvebu/coherency.h b/arch/arm/mach-mvebu/coherency.h |
153 |
+index 2f428137f6fe..1501a4e5eea0 100644 |
154 |
+--- a/arch/arm/mach-mvebu/coherency.h |
155 |
++++ b/arch/arm/mach-mvebu/coherency.h |
156 |
+@@ -19,6 +19,7 @@ int coherency_get_cpu_count(void); |
157 |
+ #endif |
158 |
+ |
159 |
+ int set_cpu_coherent(int cpu_id, int smp_group_id); |
160 |
++int coherency_available(void); |
161 |
+ int coherency_init(void); |
162 |
+ |
163 |
+ #endif /* __MACH_370_XP_COHERENCY_H */ |
164 |
+diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c |
165 |
+index f8a6db9239bf..048773926ad4 100644 |
166 |
+--- a/arch/arm/mach-orion5x/common.c |
167 |
++++ b/arch/arm/mach-orion5x/common.c |
168 |
+@@ -213,7 +213,7 @@ void __init orion5x_init_early(void) |
169 |
+ mbus_soc_name = NULL; |
170 |
+ mvebu_mbus_init(mbus_soc_name, ORION5X_BRIDGE_WINS_BASE, |
171 |
+ ORION5X_BRIDGE_WINS_SZ, |
172 |
+- ORION5X_DDR_WINS_BASE, ORION5X_DDR_WINS_SZ); |
173 |
++ ORION5X_DDR_WINS_BASE, ORION5X_DDR_WINS_SZ, 0); |
174 |
+ } |
175 |
+ |
176 |
+ void orion5x_setup_wins(void) |
177 |
+diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig |
178 |
+index 4e5b80d883c8..105ae30a176b 100644 |
179 |
+--- a/arch/x86/Kconfig |
180 |
++++ b/arch/x86/Kconfig |
181 |
+@@ -154,7 +154,7 @@ config SBUS |
182 |
+ |
183 |
+ config NEED_DMA_MAP_STATE |
184 |
+ def_bool y |
185 |
+- depends on X86_64 || INTEL_IOMMU || DMA_API_DEBUG |
186 |
++ depends on X86_64 || INTEL_IOMMU || DMA_API_DEBUG || SWIOTLB |
187 |
+ |
188 |
+ config NEED_SG_DMA_LENGTH |
189 |
+ def_bool y |
190 |
+diff --git a/arch/x86/kernel/microcode_intel_early.c b/arch/x86/kernel/microcode_intel_early.c |
191 |
+index 2e9e12871c2b..a883942aee44 100644 |
192 |
+--- a/arch/x86/kernel/microcode_intel_early.c |
193 |
++++ b/arch/x86/kernel/microcode_intel_early.c |
194 |
+@@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start, |
195 |
+ unsigned int mc_saved_count = mc_saved_data->mc_saved_count; |
196 |
+ int i; |
197 |
+ |
198 |
+- while (leftover) { |
199 |
++ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) { |
200 |
+ mc_header = (struct microcode_header_intel *)ucode_ptr; |
201 |
+ |
202 |
+ mc_size = get_totalsize(mc_header); |
203 |
+diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c |
204 |
+index 8bf40a243d75..224d2ef754cc 100644 |
205 |
+--- a/arch/x86/kvm/svm.c |
206 |
++++ b/arch/x86/kvm/svm.c |
207 |
+@@ -495,8 +495,10 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu) |
208 |
+ { |
209 |
+ struct vcpu_svm *svm = to_svm(vcpu); |
210 |
+ |
211 |
+- if (svm->vmcb->control.next_rip != 0) |
212 |
++ if (svm->vmcb->control.next_rip != 0) { |
213 |
++ WARN_ON(!static_cpu_has(X86_FEATURE_NRIPS)); |
214 |
+ svm->next_rip = svm->vmcb->control.next_rip; |
215 |
++ } |
216 |
+ |
217 |
+ if (!svm->next_rip) { |
218 |
+ if (emulate_instruction(vcpu, EMULTYPE_SKIP) != |
219 |
+@@ -4229,7 +4231,9 @@ static int svm_check_intercept(struct kvm_vcpu *vcpu, |
220 |
+ break; |
221 |
+ } |
222 |
+ |
223 |
+- vmcb->control.next_rip = info->next_rip; |
224 |
++ /* TODO: Advertise NRIPS to guest hypervisor unconditionally */ |
225 |
++ if (static_cpu_has(X86_FEATURE_NRIPS)) |
226 |
++ vmcb->control.next_rip = info->next_rip; |
227 |
+ vmcb->control.exit_code = icpt_info.exit_code; |
228 |
+ vmexit = nested_svm_exit_handled(svm); |
229 |
+ |
230 |
+diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h |
231 |
+index 53666bd9193d..32b0bf32364a 100644 |
232 |
+--- a/drivers/acpi/acpica/acmacros.h |
233 |
++++ b/drivers/acpi/acpica/acmacros.h |
234 |
+@@ -63,19 +63,15 @@ |
235 |
+ #define ACPI_SET64(ptr, val) (*ACPI_CAST64 (ptr) = (u64) (val)) |
236 |
+ |
237 |
+ /* |
238 |
+- * printf() format helpers |
239 |
++ * printf() format helper. This macros is a workaround for the difficulties |
240 |
++ * with emitting 64-bit integers and 64-bit pointers with the same code |
241 |
++ * for both 32-bit and 64-bit hosts. |
242 |
+ */ |
243 |
+ |
244 |
+ /* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ |
245 |
+ |
246 |
+ #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i) |
247 |
+ |
248 |
+-#if ACPI_MACHINE_WIDTH == 64 |
249 |
+-#define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i) |
250 |
+-#else |
251 |
+-#define ACPI_FORMAT_NATIVE_UINT(i) 0, (i) |
252 |
+-#endif |
253 |
+- |
254 |
+ /* |
255 |
+ * Macros for moving data around to/from buffers that are possibly unaligned. |
256 |
+ * If the hardware supports the transfer of unaligned data, just do the store. |
257 |
+diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c |
258 |
+index e9b13b92ba1e..46a37aeaedae 100644 |
259 |
+--- a/drivers/acpi/acpica/dsopcode.c |
260 |
++++ b/drivers/acpi/acpica/dsopcode.c |
261 |
+@@ -446,7 +446,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, |
262 |
+ |
263 |
+ ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", |
264 |
+ obj_desc, |
265 |
+- ACPI_FORMAT_NATIVE_UINT(obj_desc->region.address), |
266 |
++ ACPI_FORMAT_UINT64(obj_desc->region.address), |
267 |
+ obj_desc->region.length)); |
268 |
+ |
269 |
+ /* Now the address and length are valid for this opregion */ |
270 |
+@@ -544,7 +544,7 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state, |
271 |
+ |
272 |
+ ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", |
273 |
+ obj_desc, |
274 |
+- ACPI_FORMAT_NATIVE_UINT(obj_desc->region.address), |
275 |
++ ACPI_FORMAT_UINT64(obj_desc->region.address), |
276 |
+ obj_desc->region.length)); |
277 |
+ |
278 |
+ /* Now the address and length are valid for this opregion */ |
279 |
+diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c |
280 |
+index 8fab9262d98a..ad698893e829 100644 |
281 |
+--- a/drivers/acpi/acpica/evregion.c |
282 |
++++ b/drivers/acpi/acpica/evregion.c |
283 |
+@@ -276,7 +276,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, |
284 |
+ ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
285 |
+ "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", |
286 |
+ ®ion_obj->region.handler->address_space, handler, |
287 |
+- ACPI_FORMAT_NATIVE_UINT(address), |
288 |
++ ACPI_FORMAT_UINT64(address), |
289 |
+ acpi_ut_get_region_name(region_obj->region. |
290 |
+ space_id))); |
291 |
+ |
292 |
+diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c |
293 |
+index e5a3c249f7fa..7e6a56fe1d6e 100644 |
294 |
+--- a/drivers/acpi/acpica/exdump.c |
295 |
++++ b/drivers/acpi/acpica/exdump.c |
296 |
+@@ -621,8 +621,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) |
297 |
+ acpi_os_printf("\n"); |
298 |
+ } else { |
299 |
+ acpi_os_printf(" base %8.8X%8.8X Length %X\n", |
300 |
+- ACPI_FORMAT_NATIVE_UINT(obj_desc->region. |
301 |
+- address), |
302 |
++ ACPI_FORMAT_UINT64(obj_desc->region. |
303 |
++ address), |
304 |
+ obj_desc->region.length); |
305 |
+ } |
306 |
+ break; |
307 |
+diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c |
308 |
+index c84ee956fa4c..dc210c379277 100644 |
309 |
+--- a/drivers/acpi/acpica/exfldio.c |
310 |
++++ b/drivers/acpi/acpica/exfldio.c |
311 |
+@@ -269,17 +269,15 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, |
312 |
+ } |
313 |
+ |
314 |
+ ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD, |
315 |
+- " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %p\n", |
316 |
++ " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n", |
317 |
+ acpi_ut_get_region_name(rgn_desc->region. |
318 |
+ space_id), |
319 |
+ rgn_desc->region.space_id, |
320 |
+ obj_desc->common_field.access_byte_width, |
321 |
+ obj_desc->common_field.base_byte_offset, |
322 |
+- field_datum_byte_offset, ACPI_CAST_PTR(void, |
323 |
+- (rgn_desc-> |
324 |
+- region. |
325 |
+- address + |
326 |
+- region_offset)))); |
327 |
++ field_datum_byte_offset, |
328 |
++ ACPI_FORMAT_UINT64(rgn_desc->region.address + |
329 |
++ region_offset))); |
330 |
+ |
331 |
+ /* Invoke the appropriate address_space/op_region handler */ |
332 |
+ |
333 |
+diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c |
334 |
+index 182abaf045e1..e90c59d35a16 100644 |
335 |
+--- a/drivers/acpi/acpica/exregion.c |
336 |
++++ b/drivers/acpi/acpica/exregion.c |
337 |
+@@ -176,7 +176,7 @@ acpi_ex_system_memory_space_handler(u32 function, |
338 |
+ if (!mem_info->mapped_logical_address) { |
339 |
+ ACPI_ERROR((AE_INFO, |
340 |
+ "Could not map memory at 0x%8.8X%8.8X, size %u", |
341 |
+- ACPI_FORMAT_NATIVE_UINT(address), |
342 |
++ ACPI_FORMAT_UINT64(address), |
343 |
+ (u32) map_length)); |
344 |
+ mem_info->mapped_length = 0; |
345 |
+ return_ACPI_STATUS(AE_NO_MEMORY); |
346 |
+@@ -197,8 +197,7 @@ acpi_ex_system_memory_space_handler(u32 function, |
347 |
+ |
348 |
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
349 |
+ "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n", |
350 |
+- bit_width, function, |
351 |
+- ACPI_FORMAT_NATIVE_UINT(address))); |
352 |
++ bit_width, function, ACPI_FORMAT_UINT64(address))); |
353 |
+ |
354 |
+ /* |
355 |
+ * Perform the memory read or write |
356 |
+@@ -300,8 +299,7 @@ acpi_ex_system_io_space_handler(u32 function, |
357 |
+ |
358 |
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
359 |
+ "System-IO (width %u) R/W %u Address=%8.8X%8.8X\n", |
360 |
+- bit_width, function, |
361 |
+- ACPI_FORMAT_NATIVE_UINT(address))); |
362 |
++ bit_width, function, ACPI_FORMAT_UINT64(address))); |
363 |
+ |
364 |
+ /* Decode the function parameter */ |
365 |
+ |
366 |
+diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c |
367 |
+index eab70d58852a..fae57584a182 100644 |
368 |
+--- a/drivers/acpi/acpica/hwvalid.c |
369 |
++++ b/drivers/acpi/acpica/hwvalid.c |
370 |
+@@ -142,17 +142,17 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width) |
371 |
+ byte_width = ACPI_DIV_8(bit_width); |
372 |
+ last_address = address + byte_width - 1; |
373 |
+ |
374 |
+- ACPI_DEBUG_PRINT((ACPI_DB_IO, "Address %p LastAddress %p Length %X", |
375 |
+- ACPI_CAST_PTR(void, address), ACPI_CAST_PTR(void, |
376 |
+- last_address), |
377 |
+- byte_width)); |
378 |
++ ACPI_DEBUG_PRINT((ACPI_DB_IO, |
379 |
++ "Address %8.8X%8.8X LastAddress %8.8X%8.8X Length %X", |
380 |
++ ACPI_FORMAT_UINT64(address), |
381 |
++ ACPI_FORMAT_UINT64(last_address), byte_width)); |
382 |
+ |
383 |
+ /* Maximum 16-bit address in I/O space */ |
384 |
+ |
385 |
+ if (last_address > ACPI_UINT16_MAX) { |
386 |
+ ACPI_ERROR((AE_INFO, |
387 |
+- "Illegal I/O port address/length above 64K: %p/0x%X", |
388 |
+- ACPI_CAST_PTR(void, address), byte_width)); |
389 |
++ "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X", |
390 |
++ ACPI_FORMAT_UINT64(address), byte_width)); |
391 |
+ return_ACPI_STATUS(AE_LIMIT); |
392 |
+ } |
393 |
+ |
394 |
+@@ -181,8 +181,8 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width) |
395 |
+ |
396 |
+ if (acpi_gbl_osi_data >= port_info->osi_dependency) { |
397 |
+ ACPI_DEBUG_PRINT((ACPI_DB_IO, |
398 |
+- "Denied AML access to port 0x%p/%X (%s 0x%.4X-0x%.4X)", |
399 |
+- ACPI_CAST_PTR(void, address), |
400 |
++ "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)", |
401 |
++ ACPI_FORMAT_UINT64(address), |
402 |
+ byte_width, port_info->name, |
403 |
+ port_info->start, |
404 |
+ port_info->end)); |
405 |
+diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c |
406 |
+index ce6e97326205..20ae5b9bb9f2 100644 |
407 |
+--- a/drivers/acpi/acpica/nsdump.c |
408 |
++++ b/drivers/acpi/acpica/nsdump.c |
409 |
+@@ -258,12 +258,11 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, |
410 |
+ switch (type) { |
411 |
+ case ACPI_TYPE_PROCESSOR: |
412 |
+ |
413 |
+- acpi_os_printf("ID %02X Len %02X Addr %p\n", |
414 |
++ acpi_os_printf("ID %02X Len %02X Addr %8.8X%8.8X\n", |
415 |
+ obj_desc->processor.proc_id, |
416 |
+ obj_desc->processor.length, |
417 |
+- ACPI_CAST_PTR(void, |
418 |
+- obj_desc->processor. |
419 |
+- address)); |
420 |
++ ACPI_FORMAT_UINT64(obj_desc->processor. |
421 |
++ address)); |
422 |
+ break; |
423 |
+ |
424 |
+ case ACPI_TYPE_DEVICE: |
425 |
+@@ -334,8 +333,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, |
426 |
+ space_id)); |
427 |
+ if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { |
428 |
+ acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n", |
429 |
+- ACPI_FORMAT_NATIVE_UINT |
430 |
+- (obj_desc->region.address), |
431 |
++ ACPI_FORMAT_UINT64(obj_desc-> |
432 |
++ region. |
433 |
++ address), |
434 |
+ obj_desc->region.length); |
435 |
+ } else { |
436 |
+ acpi_os_printf |
437 |
+diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c |
438 |
+index ce3d5db39a9c..5c67b2840c58 100644 |
439 |
+--- a/drivers/acpi/acpica/tbutils.c |
440 |
++++ b/drivers/acpi/acpica/tbutils.c |
441 |
+@@ -246,16 +246,12 @@ acpi_tb_print_table_header(acpi_physical_address address, |
442 |
+ { |
443 |
+ struct acpi_table_header local_header; |
444 |
+ |
445 |
+- /* |
446 |
+- * The reason that the Address is cast to a void pointer is so that we |
447 |
+- * can use %p which will work properly on both 32-bit and 64-bit hosts. |
448 |
+- */ |
449 |
+ if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_FACS)) { |
450 |
+ |
451 |
+ /* FACS only has signature and length fields */ |
452 |
+ |
453 |
+- ACPI_INFO((AE_INFO, "%4.4s %p %05X", |
454 |
+- header->signature, ACPI_CAST_PTR(void, address), |
455 |
++ ACPI_INFO((AE_INFO, "%4.4s 0x%8.8X%8.8X %05X", |
456 |
++ header->signature, ACPI_FORMAT_UINT64(address), |
457 |
+ header->length)); |
458 |
+ } else if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_RSDP)) { |
459 |
+ |
460 |
+@@ -266,8 +262,8 @@ acpi_tb_print_table_header(acpi_physical_address address, |
461 |
+ header)->oem_id, ACPI_OEM_ID_SIZE); |
462 |
+ acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE); |
463 |
+ |
464 |
+- ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)", |
465 |
+- ACPI_CAST_PTR (void, address), |
466 |
++ ACPI_INFO((AE_INFO, "RSDP 0x%8.8X%8.8X %05X (v%.2d %6.6s)", |
467 |
++ ACPI_FORMAT_UINT64(address), |
468 |
+ (ACPI_CAST_PTR(struct acpi_table_rsdp, header)-> |
469 |
+ revision > |
470 |
+ 0) ? ACPI_CAST_PTR(struct acpi_table_rsdp, |
471 |
+@@ -281,8 +277,8 @@ acpi_tb_print_table_header(acpi_physical_address address, |
472 |
+ acpi_tb_cleanup_table_header(&local_header, header); |
473 |
+ |
474 |
+ ACPI_INFO((AE_INFO, |
475 |
+- "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)", |
476 |
+- local_header.signature, ACPI_CAST_PTR(void, address), |
477 |
++ "%-4.4s 0x%8.8X%8.8X %05X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)", |
478 |
++ local_header.signature, ACPI_FORMAT_UINT64(address), |
479 |
+ local_header.length, local_header.revision, |
480 |
+ local_header.oem_id, local_header.oem_table_id, |
481 |
+ local_header.oem_revision, |
482 |
+@@ -474,8 +470,8 @@ acpi_tb_install_table(acpi_physical_address address, |
483 |
+ table = acpi_os_map_memory(address, sizeof(struct acpi_table_header)); |
484 |
+ if (!table) { |
485 |
+ ACPI_ERROR((AE_INFO, |
486 |
+- "Could not map memory for table [%s] at %p", |
487 |
+- signature, ACPI_CAST_PTR(void, address))); |
488 |
++ "Could not map memory for table [%s] at %8.8X%8.8X", |
489 |
++ signature, ACPI_FORMAT_UINT64(address))); |
490 |
+ return; |
491 |
+ } |
492 |
+ |
493 |
+diff --git a/drivers/acpi/acpica/utaddress.c b/drivers/acpi/acpica/utaddress.c |
494 |
+index e0a2e2779c2e..3c7770d75773 100644 |
495 |
+--- a/drivers/acpi/acpica/utaddress.c |
496 |
++++ b/drivers/acpi/acpica/utaddress.c |
497 |
+@@ -107,10 +107,10 @@ acpi_ut_add_address_range(acpi_adr_space_type space_id, |
498 |
+ acpi_gbl_address_range_list[space_id] = range_info; |
499 |
+ |
500 |
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
501 |
+- "\nAdded [%4.4s] address range: 0x%p-0x%p\n", |
502 |
++ "\nAdded [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X\n", |
503 |
+ acpi_ut_get_node_name(range_info->region_node), |
504 |
+- ACPI_CAST_PTR(void, address), |
505 |
+- ACPI_CAST_PTR(void, range_info->end_address))); |
506 |
++ ACPI_FORMAT_UINT64(address), |
507 |
++ ACPI_FORMAT_UINT64(range_info->end_address))); |
508 |
+ |
509 |
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
510 |
+ return_ACPI_STATUS(AE_OK); |
511 |
+@@ -160,15 +160,13 @@ acpi_ut_remove_address_range(acpi_adr_space_type space_id, |
512 |
+ } |
513 |
+ |
514 |
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
515 |
+- "\nRemoved [%4.4s] address range: 0x%p-0x%p\n", |
516 |
++ "\nRemoved [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X\n", |
517 |
+ acpi_ut_get_node_name(range_info-> |
518 |
+ region_node), |
519 |
+- ACPI_CAST_PTR(void, |
520 |
+- range_info-> |
521 |
+- start_address), |
522 |
+- ACPI_CAST_PTR(void, |
523 |
+- range_info-> |
524 |
+- end_address))); |
525 |
++ ACPI_FORMAT_UINT64(range_info-> |
526 |
++ start_address), |
527 |
++ ACPI_FORMAT_UINT64(range_info-> |
528 |
++ end_address))); |
529 |
+ |
530 |
+ ACPI_FREE(range_info); |
531 |
+ return_VOID; |
532 |
+@@ -244,9 +242,9 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id, |
533 |
+ region_node); |
534 |
+ |
535 |
+ ACPI_WARNING((AE_INFO, |
536 |
+- "0x%p-0x%p %s conflicts with Region %s %d", |
537 |
+- ACPI_CAST_PTR(void, address), |
538 |
+- ACPI_CAST_PTR(void, end_address), |
539 |
++ "0x%8.8X%8.8X-0x%8.8X%8.8X %s conflicts with Region %s %d", |
540 |
++ ACPI_FORMAT_UINT64(address), |
541 |
++ ACPI_FORMAT_UINT64(end_address), |
542 |
+ acpi_ut_get_region_name(space_id), |
543 |
+ pathname, overlap_count)); |
544 |
+ ACPI_FREE(pathname); |
545 |
+diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c |
546 |
+index 711dcf4a0313..7c437826c2f9 100644 |
547 |
+--- a/drivers/bus/mvebu-mbus.c |
548 |
++++ b/drivers/bus/mvebu-mbus.c |
549 |
+@@ -838,7 +838,7 @@ fs_initcall(mvebu_mbus_debugfs_init); |
550 |
+ int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, |
551 |
+ size_t mbuswins_size, |
552 |
+ phys_addr_t sdramwins_phys_base, |
553 |
+- size_t sdramwins_size) |
554 |
++ size_t sdramwins_size, int is_coherent) |
555 |
+ { |
556 |
+ struct mvebu_mbus_state *mbus = &mbus_state; |
557 |
+ const struct of_device_id *of_id; |
558 |
+@@ -865,8 +865,7 @@ int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, |
559 |
+ return -ENOMEM; |
560 |
+ } |
561 |
+ |
562 |
+- if (of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric")) |
563 |
+- mbus->hw_io_coherency = 1; |
564 |
++ mbus->hw_io_coherency = is_coherent; |
565 |
+ |
566 |
+ for (win = 0; win < mbus->soc->num_wins; win++) |
567 |
+ mvebu_mbus_disable_window(mbus, win); |
568 |
+diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c |
569 |
+index f505e4ca6d58..3bdefbfb4377 100644 |
570 |
+--- a/drivers/edac/sb_edac.c |
571 |
++++ b/drivers/edac/sb_edac.c |
572 |
+@@ -623,7 +623,7 @@ static void get_memory_layout(const struct mem_ctl_info *mci) |
573 |
+ u32 reg; |
574 |
+ u64 limit, prv = 0; |
575 |
+ u64 tmp_mb; |
576 |
+- u32 mb, kb; |
577 |
++ u32 gb, mb; |
578 |
+ u32 rir_way; |
579 |
+ |
580 |
+ /* |
581 |
+@@ -636,8 +636,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci) |
582 |
+ pvt->tolm = GET_TOLM(reg); |
583 |
+ tmp_mb = (1 + pvt->tolm) >> 20; |
584 |
+ |
585 |
+- mb = div_u64_rem(tmp_mb, 1000, &kb); |
586 |
+- edac_dbg(0, "TOLM: %u.%03u GB (0x%016Lx)\n", mb, kb, (u64)pvt->tolm); |
587 |
++ gb = div_u64_rem(tmp_mb, 1024, &mb); |
588 |
++ edac_dbg(0, "TOLM: %u.%03u GB (0x%016Lx)\n", |
589 |
++ gb, (mb*1000)/1024, (u64)pvt->tolm); |
590 |
+ |
591 |
+ /* Address range is already 45:25 */ |
592 |
+ pci_read_config_dword(pvt->pci_sad1, TOHM, |
593 |
+@@ -645,8 +646,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci) |
594 |
+ pvt->tohm = GET_TOHM(reg); |
595 |
+ tmp_mb = (1 + pvt->tohm) >> 20; |
596 |
+ |
597 |
+- mb = div_u64_rem(tmp_mb, 1000, &kb); |
598 |
+- edac_dbg(0, "TOHM: %u.%03u GB (0x%016Lx)\n", mb, kb, (u64)pvt->tohm); |
599 |
++ gb = div_u64_rem(tmp_mb, 1024, &mb); |
600 |
++ edac_dbg(0, "TOHM: %u.%03u GB (0x%016Lx)\n", |
601 |
++ gb, (mb*1000)/1024, (u64)pvt->tohm); |
602 |
+ |
603 |
+ /* |
604 |
+ * Step 2) Get SAD range and SAD Interleave list |
605 |
+@@ -668,11 +670,11 @@ static void get_memory_layout(const struct mem_ctl_info *mci) |
606 |
+ break; |
607 |
+ |
608 |
+ tmp_mb = (limit + 1) >> 20; |
609 |
+- mb = div_u64_rem(tmp_mb, 1000, &kb); |
610 |
++ gb = div_u64_rem(tmp_mb, 1024, &mb); |
611 |
+ edac_dbg(0, "SAD#%d %s up to %u.%03u GB (0x%016Lx) Interleave: %s reg=0x%08x\n", |
612 |
+ n_sads, |
613 |
+ get_dram_attr(reg), |
614 |
+- mb, kb, |
615 |
++ gb, (mb*1000)/1024, |
616 |
+ ((u64)tmp_mb) << 20L, |
617 |
+ INTERLEAVE_MODE(reg) ? "8:6" : "[8:6]XOR[18:16]", |
618 |
+ reg); |
619 |
+@@ -702,9 +704,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci) |
620 |
+ break; |
621 |
+ tmp_mb = (limit + 1) >> 20; |
622 |
+ |
623 |
+- mb = div_u64_rem(tmp_mb, 1000, &kb); |
624 |
++ gb = div_u64_rem(tmp_mb, 1024, &mb); |
625 |
+ edac_dbg(0, "TAD#%d: up to %u.%03u GB (0x%016Lx), socket interleave %d, memory interleave %d, TGT: %d, %d, %d, %d, reg=0x%08x\n", |
626 |
+- n_tads, mb, kb, |
627 |
++ n_tads, gb, (mb*1000)/1024, |
628 |
+ ((u64)tmp_mb) << 20L, |
629 |
+ (u32)TAD_SOCK(reg), |
630 |
+ (u32)TAD_CH(reg), |
631 |
+@@ -727,10 +729,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci) |
632 |
+ tad_ch_nilv_offset[j], |
633 |
+ ®); |
634 |
+ tmp_mb = TAD_OFFSET(reg) >> 20; |
635 |
+- mb = div_u64_rem(tmp_mb, 1000, &kb); |
636 |
++ gb = div_u64_rem(tmp_mb, 1024, &mb); |
637 |
+ edac_dbg(0, "TAD CH#%d, offset #%d: %u.%03u GB (0x%016Lx), reg=0x%08x\n", |
638 |
+ i, j, |
639 |
+- mb, kb, |
640 |
++ gb, (mb*1000)/1024, |
641 |
+ ((u64)tmp_mb) << 20L, |
642 |
+ reg); |
643 |
+ } |
644 |
+@@ -752,10 +754,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci) |
645 |
+ |
646 |
+ tmp_mb = RIR_LIMIT(reg) >> 20; |
647 |
+ rir_way = 1 << RIR_WAY(reg); |
648 |
+- mb = div_u64_rem(tmp_mb, 1000, &kb); |
649 |
++ gb = div_u64_rem(tmp_mb, 1024, &mb); |
650 |
+ edac_dbg(0, "CH#%d RIR#%d, limit: %u.%03u GB (0x%016Lx), way: %d, reg=0x%08x\n", |
651 |
+ i, j, |
652 |
+- mb, kb, |
653 |
++ gb, (mb*1000)/1024, |
654 |
+ ((u64)tmp_mb) << 20L, |
655 |
+ rir_way, |
656 |
+ reg); |
657 |
+@@ -766,10 +768,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci) |
658 |
+ ®); |
659 |
+ tmp_mb = RIR_OFFSET(reg) << 6; |
660 |
+ |
661 |
+- mb = div_u64_rem(tmp_mb, 1000, &kb); |
662 |
++ gb = div_u64_rem(tmp_mb, 1024, &mb); |
663 |
+ edac_dbg(0, "CH#%d RIR#%d INTL#%d, offset %u.%03u GB (0x%016Lx), tgt: %d, reg=0x%08x\n", |
664 |
+ i, j, k, |
665 |
+- mb, kb, |
666 |
++ gb, (mb*1000)/1024, |
667 |
+ ((u64)tmp_mb) << 20L, |
668 |
+ (u32)RIR_RNK_TGT(reg), |
669 |
+ reg); |
670 |
+@@ -806,7 +808,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci, |
671 |
+ u8 ch_way,sck_way; |
672 |
+ u32 tad_offset; |
673 |
+ u32 rir_way; |
674 |
+- u32 mb, kb; |
675 |
++ u32 mb, gb; |
676 |
+ u64 ch_addr, offset, limit, prv = 0; |
677 |
+ |
678 |
+ |
679 |
+@@ -1022,10 +1024,10 @@ static int get_memory_error_data(struct mem_ctl_info *mci, |
680 |
+ continue; |
681 |
+ |
682 |
+ limit = RIR_LIMIT(reg); |
683 |
+- mb = div_u64_rem(limit >> 20, 1000, &kb); |
684 |
++ gb = div_u64_rem(limit >> 20, 1024, &mb); |
685 |
+ edac_dbg(0, "RIR#%d, limit: %u.%03u GB (0x%016Lx), way: %d\n", |
686 |
+ n_rir, |
687 |
+- mb, kb, |
688 |
++ gb, (mb*1000)/1024, |
689 |
+ limit, |
690 |
+ 1 << RIR_WAY(reg)); |
691 |
+ if (ch_addr <= limit) |
692 |
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c |
693 |
+index 62ed744bbe06..a6cdf17e27dc 100644 |
694 |
+--- a/drivers/scsi/hpsa.c |
695 |
++++ b/drivers/scsi/hpsa.c |
696 |
+@@ -3898,10 +3898,6 @@ static int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev) |
697 |
+ |
698 |
+ /* Save the PCI command register */ |
699 |
+ pci_read_config_word(pdev, 4, &command_register); |
700 |
+- /* Turn the board off. This is so that later pci_restore_state() |
701 |
+- * won't turn the board on before the rest of config space is ready. |
702 |
+- */ |
703 |
+- pci_disable_device(pdev); |
704 |
+ pci_save_state(pdev); |
705 |
+ |
706 |
+ /* find the first memory BAR, so we can find the cfg table */ |
707 |
+@@ -3949,11 +3945,6 @@ static int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev) |
708 |
+ goto unmap_cfgtable; |
709 |
+ |
710 |
+ pci_restore_state(pdev); |
711 |
+- rc = pci_enable_device(pdev); |
712 |
+- if (rc) { |
713 |
+- dev_warn(&pdev->dev, "failed to enable device.\n"); |
714 |
+- goto unmap_cfgtable; |
715 |
+- } |
716 |
+ pci_write_config_word(pdev, 4, command_register); |
717 |
+ |
718 |
+ /* Some devices (notably the HP Smart Array 5i Controller) |
719 |
+@@ -4448,6 +4439,23 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev) |
720 |
+ if (!reset_devices) |
721 |
+ return 0; |
722 |
+ |
723 |
++ /* kdump kernel is loading, we don't know in which state is |
724 |
++ * the pci interface. The dev->enable_cnt is equal zero |
725 |
++ * so we call enable+disable, wait a while and switch it on. |
726 |
++ */ |
727 |
++ rc = pci_enable_device(pdev); |
728 |
++ if (rc) { |
729 |
++ dev_warn(&pdev->dev, "Failed to enable PCI device\n"); |
730 |
++ return -ENODEV; |
731 |
++ } |
732 |
++ pci_disable_device(pdev); |
733 |
++ msleep(260); /* a randomly chosen number */ |
734 |
++ rc = pci_enable_device(pdev); |
735 |
++ if (rc) { |
736 |
++ dev_warn(&pdev->dev, "failed to enable device.\n"); |
737 |
++ return -ENODEV; |
738 |
++ } |
739 |
++ pci_set_master(pdev); |
740 |
+ /* Reset the controller with a PCI power-cycle or via doorbell */ |
741 |
+ rc = hpsa_kdump_hard_reset_controller(pdev); |
742 |
+ |
743 |
+@@ -4456,10 +4464,11 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev) |
744 |
+ * "performant mode". Or, it might be 640x, which can't reset |
745 |
+ * due to concerns about shared bbwc between 6402/6404 pair. |
746 |
+ */ |
747 |
+- if (rc == -ENOTSUPP) |
748 |
+- return rc; /* just try to do the kdump anyhow. */ |
749 |
+- if (rc) |
750 |
+- return -ENODEV; |
751 |
++ if (rc) { |
752 |
++ if (rc != -ENOTSUPP) /* just try to do the kdump anyhow. */ |
753 |
++ rc = -ENODEV; |
754 |
++ goto out_disable; |
755 |
++ } |
756 |
+ |
757 |
+ /* Now try to get the controller to respond to a no-op */ |
758 |
+ dev_warn(&pdev->dev, "Waiting for controller to respond to no-op\n"); |
759 |
+@@ -4470,7 +4479,11 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev) |
760 |
+ dev_warn(&pdev->dev, "no-op failed%s\n", |
761 |
+ (i < 11 ? "; re-trying" : "")); |
762 |
+ } |
763 |
+- return 0; |
764 |
++ |
765 |
++out_disable: |
766 |
++ |
767 |
++ pci_disable_device(pdev); |
768 |
++ return rc; |
769 |
+ } |
770 |
+ |
771 |
+ static int hpsa_allocate_cmd_pool(struct ctlr_info *h) |
772 |
+@@ -4613,6 +4626,7 @@ static void hpsa_undo_allocations_after_kdump_soft_reset(struct ctlr_info *h) |
773 |
+ iounmap(h->transtable); |
774 |
+ if (h->cfgtable) |
775 |
+ iounmap(h->cfgtable); |
776 |
++ pci_disable_device(h->pdev); |
777 |
+ pci_release_regions(h->pdev); |
778 |
+ kfree(h); |
779 |
+ } |
780 |
+diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c |
781 |
+index 7fb054ba1b60..82f14a1da542 100644 |
782 |
+--- a/fs/btrfs/ctree.c |
783 |
++++ b/fs/btrfs/ctree.c |
784 |
+@@ -2769,7 +2769,7 @@ done: |
785 |
+ */ |
786 |
+ if (!p->leave_spinning) |
787 |
+ btrfs_set_path_blocking(p); |
788 |
+- if (ret < 0) |
789 |
++ if (ret < 0 && !p->skip_release_on_error) |
790 |
+ btrfs_release_path(p); |
791 |
+ return ret; |
792 |
+ } |
793 |
+diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h |
794 |
+index d6dd49b51ba8..c19444e412be 100644 |
795 |
+--- a/fs/btrfs/ctree.h |
796 |
++++ b/fs/btrfs/ctree.h |
797 |
+@@ -586,6 +586,7 @@ struct btrfs_path { |
798 |
+ unsigned int skip_locking:1; |
799 |
+ unsigned int leave_spinning:1; |
800 |
+ unsigned int search_commit_root:1; |
801 |
++ unsigned int skip_release_on_error:1; |
802 |
+ }; |
803 |
+ |
804 |
+ /* |
805 |
+@@ -3406,6 +3407,10 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans, |
806 |
+ int verify_dir_item(struct btrfs_root *root, |
807 |
+ struct extent_buffer *leaf, |
808 |
+ struct btrfs_dir_item *dir_item); |
809 |
++struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root, |
810 |
++ struct btrfs_path *path, |
811 |
++ const char *name, |
812 |
++ int name_len); |
813 |
+ |
814 |
+ /* orphan.c */ |
815 |
+ int btrfs_insert_orphan_item(struct btrfs_trans_handle *trans, |
816 |
+diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c |
817 |
+index 79e594e341c7..6f61b9b1526f 100644 |
818 |
+--- a/fs/btrfs/dir-item.c |
819 |
++++ b/fs/btrfs/dir-item.c |
820 |
+@@ -21,10 +21,6 @@ |
821 |
+ #include "hash.h" |
822 |
+ #include "transaction.h" |
823 |
+ |
824 |
+-static struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root, |
825 |
+- struct btrfs_path *path, |
826 |
+- const char *name, int name_len); |
827 |
+- |
828 |
+ /* |
829 |
+ * insert a name into a directory, doing overflow properly if there is a hash |
830 |
+ * collision. data_size indicates how big the item inserted should be. On |
831 |
+@@ -383,9 +379,9 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans, |
832 |
+ * this walks through all the entries in a dir item and finds one |
833 |
+ * for a specific name. |
834 |
+ */ |
835 |
+-static struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root, |
836 |
+- struct btrfs_path *path, |
837 |
+- const char *name, int name_len) |
838 |
++struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root, |
839 |
++ struct btrfs_path *path, |
840 |
++ const char *name, int name_len) |
841 |
+ { |
842 |
+ struct btrfs_dir_item *dir_item; |
843 |
+ unsigned long name_ptr; |
844 |
+diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c |
845 |
+index 05740b9789e4..9cf20d63cc99 100644 |
846 |
+--- a/fs/btrfs/xattr.c |
847 |
++++ b/fs/btrfs/xattr.c |
848 |
+@@ -27,6 +27,7 @@ |
849 |
+ #include "transaction.h" |
850 |
+ #include "xattr.h" |
851 |
+ #include "disk-io.h" |
852 |
++#include "locking.h" |
853 |
+ |
854 |
+ |
855 |
+ ssize_t __btrfs_getxattr(struct inode *inode, const char *name, |
856 |
+@@ -89,7 +90,7 @@ static int do_setxattr(struct btrfs_trans_handle *trans, |
857 |
+ struct inode *inode, const char *name, |
858 |
+ const void *value, size_t size, int flags) |
859 |
+ { |
860 |
+- struct btrfs_dir_item *di; |
861 |
++ struct btrfs_dir_item *di = NULL; |
862 |
+ struct btrfs_root *root = BTRFS_I(inode)->root; |
863 |
+ struct btrfs_path *path; |
864 |
+ size_t name_len = strlen(name); |
865 |
+@@ -101,84 +102,128 @@ static int do_setxattr(struct btrfs_trans_handle *trans, |
866 |
+ path = btrfs_alloc_path(); |
867 |
+ if (!path) |
868 |
+ return -ENOMEM; |
869 |
++ path->skip_release_on_error = 1; |
870 |
++ |
871 |
++ if (!value) { |
872 |
++ di = btrfs_lookup_xattr(trans, root, path, btrfs_ino(inode), |
873 |
++ name, name_len, -1); |
874 |
++ if (!di && (flags & XATTR_REPLACE)) |
875 |
++ ret = -ENODATA; |
876 |
++ else if (di) |
877 |
++ ret = btrfs_delete_one_dir_name(trans, root, path, di); |
878 |
++ goto out; |
879 |
++ } |
880 |
+ |
881 |
++ /* |
882 |
++ * For a replace we can't just do the insert blindly. |
883 |
++ * Do a lookup first (read-only btrfs_search_slot), and return if xattr |
884 |
++ * doesn't exist. If it exists, fall down below to the insert/replace |
885 |
++ * path - we can't race with a concurrent xattr delete, because the VFS |
886 |
++ * locks the inode's i_mutex before calling setxattr or removexattr. |
887 |
++ */ |
888 |
+ if (flags & XATTR_REPLACE) { |
889 |
+- di = btrfs_lookup_xattr(trans, root, path, btrfs_ino(inode), name, |
890 |
+- name_len, -1); |
891 |
+- if (IS_ERR(di)) { |
892 |
+- ret = PTR_ERR(di); |
893 |
+- goto out; |
894 |
+- } else if (!di) { |
895 |
++ if(!mutex_is_locked(&inode->i_mutex)) { |
896 |
++ pr_err("BTRFS: assertion failed: %s, file: %s, line: %d", |
897 |
++ "mutex_is_locked(&inode->i_mutex)", __FILE__, |
898 |
++ __LINE__); |
899 |
++ BUG(); |
900 |
++ } |
901 |
++ di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(inode), |
902 |
++ name, name_len, 0); |
903 |
++ if (!di) { |
904 |
+ ret = -ENODATA; |
905 |
+ goto out; |
906 |
+ } |
907 |
+- ret = btrfs_delete_one_dir_name(trans, root, path, di); |
908 |
+- if (ret) |
909 |
+- goto out; |
910 |
+ btrfs_release_path(path); |
911 |
++ di = NULL; |
912 |
++ } |
913 |
+ |
914 |
++ ret = btrfs_insert_xattr_item(trans, root, path, btrfs_ino(inode), |
915 |
++ name, name_len, value, size); |
916 |
++ if (ret == -EOVERFLOW) { |
917 |
+ /* |
918 |
+- * remove the attribute |
919 |
++ * We have an existing item in a leaf, split_leaf couldn't |
920 |
++ * expand it. That item might have or not a dir_item that |
921 |
++ * matches our target xattr, so lets check. |
922 |
+ */ |
923 |
+- if (!value) |
924 |
+- goto out; |
925 |
+- } else { |
926 |
+- di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(inode), |
927 |
+- name, name_len, 0); |
928 |
+- if (IS_ERR(di)) { |
929 |
+- ret = PTR_ERR(di); |
930 |
++ ret = 0; |
931 |
++ btrfs_assert_tree_locked(path->nodes[0]); |
932 |
++ di = btrfs_match_dir_item_name(root, path, name, name_len); |
933 |
++ if (!di && !(flags & XATTR_REPLACE)) { |
934 |
++ ret = -ENOSPC; |
935 |
+ goto out; |
936 |
+ } |
937 |
+- if (!di && !value) |
938 |
+- goto out; |
939 |
+- btrfs_release_path(path); |
940 |
++ } else if (ret == -EEXIST) { |
941 |
++ ret = 0; |
942 |
++ di = btrfs_match_dir_item_name(root, path, name, name_len); |
943 |
++ if(!di) { /* logic error */ |
944 |
++ pr_err("BTRFS: assertion failed: %s, file: %s, line: %d", |
945 |
++ "di", __FILE__, __LINE__); |
946 |
++ BUG(); |
947 |
++ } |
948 |
++ } else if (ret) { |
949 |
++ goto out; |
950 |
+ } |
951 |
+ |
952 |
+-again: |
953 |
+- ret = btrfs_insert_xattr_item(trans, root, path, btrfs_ino(inode), |
954 |
+- name, name_len, value, size); |
955 |
+- /* |
956 |
+- * If we're setting an xattr to a new value but the new value is say |
957 |
+- * exactly BTRFS_MAX_XATTR_SIZE, we could end up with EOVERFLOW getting |
958 |
+- * back from split_leaf. This is because it thinks we'll be extending |
959 |
+- * the existing item size, but we're asking for enough space to add the |
960 |
+- * item itself. So if we get EOVERFLOW just set ret to EEXIST and let |
961 |
+- * the rest of the function figure it out. |
962 |
+- */ |
963 |
+- if (ret == -EOVERFLOW) |
964 |
++ if (di && (flags & XATTR_CREATE)) { |
965 |
+ ret = -EEXIST; |
966 |
++ goto out; |
967 |
++ } |
968 |
+ |
969 |
+- if (ret == -EEXIST) { |
970 |
+- if (flags & XATTR_CREATE) |
971 |
+- goto out; |
972 |
++ if (di) { |
973 |
+ /* |
974 |
+- * We can't use the path we already have since we won't have the |
975 |
+- * proper locking for a delete, so release the path and |
976 |
+- * re-lookup to delete the thing. |
977 |
++ * We're doing a replace, and it must be atomic, that is, at |
978 |
++ * any point in time we have either the old or the new xattr |
979 |
++ * value in the tree. We don't want readers (getxattr and |
980 |
++ * listxattrs) to miss a value, this is specially important |
981 |
++ * for ACLs. |
982 |
+ */ |
983 |
+- btrfs_release_path(path); |
984 |
+- di = btrfs_lookup_xattr(trans, root, path, btrfs_ino(inode), |
985 |
+- name, name_len, -1); |
986 |
+- if (IS_ERR(di)) { |
987 |
+- ret = PTR_ERR(di); |
988 |
+- goto out; |
989 |
+- } else if (!di) { |
990 |
+- /* Shouldn't happen but just in case... */ |
991 |
+- btrfs_release_path(path); |
992 |
+- goto again; |
993 |
++ const int slot = path->slots[0]; |
994 |
++ struct extent_buffer *leaf = path->nodes[0]; |
995 |
++ const u16 old_data_len = btrfs_dir_data_len(leaf, di); |
996 |
++ const u32 item_size = btrfs_item_size_nr(leaf, slot); |
997 |
++ const u32 data_size = sizeof(*di) + name_len + size; |
998 |
++ struct btrfs_item *item; |
999 |
++ unsigned long data_ptr; |
1000 |
++ char *ptr; |
1001 |
++ |
1002 |
++ if (size > old_data_len) { |
1003 |
++ if (btrfs_leaf_free_space(root, leaf) < |
1004 |
++ (size - old_data_len)) { |
1005 |
++ ret = -ENOSPC; |
1006 |
++ goto out; |
1007 |
++ } |
1008 |
+ } |
1009 |
+ |
1010 |
+- ret = btrfs_delete_one_dir_name(trans, root, path, di); |
1011 |
+- if (ret) |
1012 |
+- goto out; |
1013 |
++ if (old_data_len + name_len + sizeof(*di) == item_size) { |
1014 |
++ /* No other xattrs packed in the same leaf item. */ |
1015 |
++ if (size > old_data_len) |
1016 |
++ btrfs_extend_item(root, path, |
1017 |
++ size - old_data_len); |
1018 |
++ else if (size < old_data_len) |
1019 |
++ btrfs_truncate_item(root, path, data_size, 1); |
1020 |
++ } else { |
1021 |
++ /* There are other xattrs packed in the same item. */ |
1022 |
++ ret = btrfs_delete_one_dir_name(trans, root, path, di); |
1023 |
++ if (ret) |
1024 |
++ goto out; |
1025 |
++ btrfs_extend_item(root, path, data_size); |
1026 |
++ } |
1027 |
+ |
1028 |
++ item = btrfs_item_nr(NULL, slot); |
1029 |
++ ptr = btrfs_item_ptr(leaf, slot, char); |
1030 |
++ ptr += btrfs_item_size(leaf, item) - data_size; |
1031 |
++ di = (struct btrfs_dir_item *)ptr; |
1032 |
++ btrfs_set_dir_data_len(leaf, di, size); |
1033 |
++ data_ptr = ((unsigned long)(di + 1)) + name_len; |
1034 |
++ write_extent_buffer(leaf, value, data_ptr, size); |
1035 |
++ btrfs_mark_buffer_dirty(leaf); |
1036 |
++ } else { |
1037 |
+ /* |
1038 |
+- * We have a value to set, so go back and try to insert it now. |
1039 |
++ * Insert, and we had space for the xattr, so path->slots[0] is |
1040 |
++ * where our xattr dir_item is and btrfs_insert_xattr_item() |
1041 |
++ * filled it. |
1042 |
+ */ |
1043 |
+- if (value) { |
1044 |
+- btrfs_release_path(path); |
1045 |
+- goto again; |
1046 |
+- } |
1047 |
+ } |
1048 |
+ out: |
1049 |
+ btrfs_free_path(path); |
1050 |
+diff --git a/fs/dcache.c b/fs/dcache.c |
1051 |
+index e2800926ae05..38c4a302fab4 100644 |
1052 |
+--- a/fs/dcache.c |
1053 |
++++ b/fs/dcache.c |
1054 |
+@@ -1053,13 +1053,13 @@ ascend: |
1055 |
+ /* might go back up the wrong parent if we have had a rename. */ |
1056 |
+ if (!locked && read_seqretry(&rename_lock, seq)) |
1057 |
+ goto rename_retry; |
1058 |
+- next = child->d_child.next; |
1059 |
+- while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) { |
1060 |
++ /* go into the first sibling still alive */ |
1061 |
++ do { |
1062 |
++ next = child->d_child.next; |
1063 |
+ if (next == &this_parent->d_subdirs) |
1064 |
+ goto ascend; |
1065 |
+ child = list_entry(next, struct dentry, d_child); |
1066 |
+- next = next->next; |
1067 |
+- } |
1068 |
++ } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)); |
1069 |
+ rcu_read_unlock(); |
1070 |
+ goto resume; |
1071 |
+ } |
1072 |
+@@ -2977,13 +2977,13 @@ ascend: |
1073 |
+ /* might go back up the wrong parent if we have had a rename. */ |
1074 |
+ if (!locked && read_seqretry(&rename_lock, seq)) |
1075 |
+ goto rename_retry; |
1076 |
+- next = child->d_child.next; |
1077 |
+- while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) { |
1078 |
++ /* go into the first sibling still alive */ |
1079 |
++ do { |
1080 |
++ next = child->d_child.next; |
1081 |
+ if (next == &this_parent->d_subdirs) |
1082 |
+ goto ascend; |
1083 |
+ child = list_entry(next, struct dentry, d_child); |
1084 |
+- next = next->next; |
1085 |
+- } |
1086 |
++ } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)); |
1087 |
+ rcu_read_unlock(); |
1088 |
+ goto resume; |
1089 |
+ } |
1090 |
+diff --git a/fs/exec.c b/fs/exec.c |
1091 |
+index dd6aa61c8548..acbd7ac2deda 100644 |
1092 |
+--- a/fs/exec.c |
1093 |
++++ b/fs/exec.c |
1094 |
+@@ -1265,6 +1265,53 @@ static int check_unsafe_exec(struct linux_binprm *bprm) |
1095 |
+ return res; |
1096 |
+ } |
1097 |
+ |
1098 |
++static void bprm_fill_uid(struct linux_binprm *bprm) |
1099 |
++{ |
1100 |
++ struct inode *inode; |
1101 |
++ unsigned int mode; |
1102 |
++ kuid_t uid; |
1103 |
++ kgid_t gid; |
1104 |
++ |
1105 |
++ /* clear any previous set[ug]id data from a previous binary */ |
1106 |
++ bprm->cred->euid = current_euid(); |
1107 |
++ bprm->cred->egid = current_egid(); |
1108 |
++ |
1109 |
++ if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) |
1110 |
++ return; |
1111 |
++ |
1112 |
++ if (current->no_new_privs) |
1113 |
++ return; |
1114 |
++ |
1115 |
++ inode = file_inode(bprm->file); |
1116 |
++ mode = ACCESS_ONCE(inode->i_mode); |
1117 |
++ if (!(mode & (S_ISUID|S_ISGID))) |
1118 |
++ return; |
1119 |
++ |
1120 |
++ /* Be careful if suid/sgid is set */ |
1121 |
++ mutex_lock(&inode->i_mutex); |
1122 |
++ |
1123 |
++ /* reload atomically mode/uid/gid now that lock held */ |
1124 |
++ mode = inode->i_mode; |
1125 |
++ uid = inode->i_uid; |
1126 |
++ gid = inode->i_gid; |
1127 |
++ mutex_unlock(&inode->i_mutex); |
1128 |
++ |
1129 |
++ /* We ignore suid/sgid if there are no mappings for them in the ns */ |
1130 |
++ if (!kuid_has_mapping(bprm->cred->user_ns, uid) || |
1131 |
++ !kgid_has_mapping(bprm->cred->user_ns, gid)) |
1132 |
++ return; |
1133 |
++ |
1134 |
++ if (mode & S_ISUID) { |
1135 |
++ bprm->per_clear |= PER_CLEAR_ON_SETID; |
1136 |
++ bprm->cred->euid = uid; |
1137 |
++ } |
1138 |
++ |
1139 |
++ if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { |
1140 |
++ bprm->per_clear |= PER_CLEAR_ON_SETID; |
1141 |
++ bprm->cred->egid = gid; |
1142 |
++ } |
1143 |
++} |
1144 |
++ |
1145 |
+ /* |
1146 |
+ * Fill the binprm structure from the inode. |
1147 |
+ * Check permissions, then read the first 128 (BINPRM_BUF_SIZE) bytes |
1148 |
+@@ -1273,39 +1320,12 @@ static int check_unsafe_exec(struct linux_binprm *bprm) |
1149 |
+ */ |
1150 |
+ int prepare_binprm(struct linux_binprm *bprm) |
1151 |
+ { |
1152 |
+- umode_t mode; |
1153 |
+- struct inode * inode = file_inode(bprm->file); |
1154 |
+ int retval; |
1155 |
+ |
1156 |
+- mode = inode->i_mode; |
1157 |
+ if (bprm->file->f_op == NULL) |
1158 |
+ return -EACCES; |
1159 |
+ |
1160 |
+- /* clear any previous set[ug]id data from a previous binary */ |
1161 |
+- bprm->cred->euid = current_euid(); |
1162 |
+- bprm->cred->egid = current_egid(); |
1163 |
+- |
1164 |
+- if (!(bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) && |
1165 |
+- !current->no_new_privs && |
1166 |
+- kuid_has_mapping(bprm->cred->user_ns, inode->i_uid) && |
1167 |
+- kgid_has_mapping(bprm->cred->user_ns, inode->i_gid)) { |
1168 |
+- /* Set-uid? */ |
1169 |
+- if (mode & S_ISUID) { |
1170 |
+- bprm->per_clear |= PER_CLEAR_ON_SETID; |
1171 |
+- bprm->cred->euid = inode->i_uid; |
1172 |
+- } |
1173 |
+- |
1174 |
+- /* Set-gid? */ |
1175 |
+- /* |
1176 |
+- * If setgid is set but no group execute bit then this |
1177 |
+- * is a candidate for mandatory locking, not a setgid |
1178 |
+- * executable. |
1179 |
+- */ |
1180 |
+- if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { |
1181 |
+- bprm->per_clear |= PER_CLEAR_ON_SETID; |
1182 |
+- bprm->cred->egid = inode->i_gid; |
1183 |
+- } |
1184 |
+- } |
1185 |
++ bprm_fill_uid(bprm); |
1186 |
+ |
1187 |
+ /* fill in binprm security blob */ |
1188 |
+ retval = security_bprm_set_creds(bprm); |
1189 |
+diff --git a/fs/file_table.c b/fs/file_table.c |
1190 |
+index 54a34be444f9..28f02a7cbba1 100644 |
1191 |
+--- a/fs/file_table.c |
1192 |
++++ b/fs/file_table.c |
1193 |
+@@ -36,8 +36,6 @@ struct files_stat_struct files_stat = { |
1194 |
+ .max_files = NR_FILE |
1195 |
+ }; |
1196 |
+ |
1197 |
+-DEFINE_STATIC_LGLOCK(files_lglock); |
1198 |
+- |
1199 |
+ /* SLAB cache for file structures */ |
1200 |
+ static struct kmem_cache *filp_cachep __read_mostly; |
1201 |
+ |
1202 |
+@@ -134,7 +132,6 @@ struct file *get_empty_filp(void) |
1203 |
+ return ERR_PTR(error); |
1204 |
+ } |
1205 |
+ |
1206 |
+- INIT_LIST_HEAD(&f->f_u.fu_list); |
1207 |
+ atomic_long_set(&f->f_count, 1); |
1208 |
+ rwlock_init(&f->f_owner.lock); |
1209 |
+ spin_lock_init(&f->f_lock); |
1210 |
+@@ -265,18 +262,15 @@ static void __fput(struct file *file) |
1211 |
+ mntput(mnt); |
1212 |
+ } |
1213 |
+ |
1214 |
+-static DEFINE_SPINLOCK(delayed_fput_lock); |
1215 |
+-static LIST_HEAD(delayed_fput_list); |
1216 |
++static LLIST_HEAD(delayed_fput_list); |
1217 |
+ static void delayed_fput(struct work_struct *unused) |
1218 |
+ { |
1219 |
+- LIST_HEAD(head); |
1220 |
+- spin_lock_irq(&delayed_fput_lock); |
1221 |
+- list_splice_init(&delayed_fput_list, &head); |
1222 |
+- spin_unlock_irq(&delayed_fput_lock); |
1223 |
+- while (!list_empty(&head)) { |
1224 |
+- struct file *f = list_first_entry(&head, struct file, f_u.fu_list); |
1225 |
+- list_del_init(&f->f_u.fu_list); |
1226 |
+- __fput(f); |
1227 |
++ struct llist_node *node = llist_del_all(&delayed_fput_list); |
1228 |
++ struct llist_node *next; |
1229 |
++ |
1230 |
++ for (; node; node = next) { |
1231 |
++ next = llist_next(node); |
1232 |
++ __fput(llist_entry(node, struct file, f_u.fu_llist)); |
1233 |
+ } |
1234 |
+ } |
1235 |
+ |
1236 |
+@@ -306,18 +300,15 @@ void fput(struct file *file) |
1237 |
+ { |
1238 |
+ if (atomic_long_dec_and_test(&file->f_count)) { |
1239 |
+ struct task_struct *task = current; |
1240 |
+- unsigned long flags; |
1241 |
+ |
1242 |
+- file_sb_list_del(file); |
1243 |
+ if (likely(!in_interrupt() && !(task->flags & PF_KTHREAD))) { |
1244 |
+ init_task_work(&file->f_u.fu_rcuhead, ____fput); |
1245 |
+ if (!task_work_add(task, &file->f_u.fu_rcuhead, true)) |
1246 |
+ return; |
1247 |
+ } |
1248 |
+- spin_lock_irqsave(&delayed_fput_lock, flags); |
1249 |
+- list_add(&file->f_u.fu_list, &delayed_fput_list); |
1250 |
+- schedule_work(&delayed_fput_work); |
1251 |
+- spin_unlock_irqrestore(&delayed_fput_lock, flags); |
1252 |
++ |
1253 |
++ if (llist_add(&file->f_u.fu_llist, &delayed_fput_list)) |
1254 |
++ schedule_work(&delayed_fput_work); |
1255 |
+ } |
1256 |
+ } |
1257 |
+ |
1258 |
+@@ -333,7 +324,6 @@ void __fput_sync(struct file *file) |
1259 |
+ { |
1260 |
+ if (atomic_long_dec_and_test(&file->f_count)) { |
1261 |
+ struct task_struct *task = current; |
1262 |
+- file_sb_list_del(file); |
1263 |
+ BUG_ON(!(task->flags & PF_KTHREAD)); |
1264 |
+ __fput(file); |
1265 |
+ } |
1266 |
+@@ -345,127 +335,10 @@ void put_filp(struct file *file) |
1267 |
+ { |
1268 |
+ if (atomic_long_dec_and_test(&file->f_count)) { |
1269 |
+ security_file_free(file); |
1270 |
+- file_sb_list_del(file); |
1271 |
+ file_free(file); |
1272 |
+ } |
1273 |
+ } |
1274 |
+ |
1275 |
+-static inline int file_list_cpu(struct file *file) |
1276 |
+-{ |
1277 |
+-#ifdef CONFIG_SMP |
1278 |
+- return file->f_sb_list_cpu; |
1279 |
+-#else |
1280 |
+- return smp_processor_id(); |
1281 |
+-#endif |
1282 |
+-} |
1283 |
+- |
1284 |
+-/* helper for file_sb_list_add to reduce ifdefs */ |
1285 |
+-static inline void __file_sb_list_add(struct file *file, struct super_block *sb) |
1286 |
+-{ |
1287 |
+- struct list_head *list; |
1288 |
+-#ifdef CONFIG_SMP |
1289 |
+- int cpu; |
1290 |
+- cpu = smp_processor_id(); |
1291 |
+- file->f_sb_list_cpu = cpu; |
1292 |
+- list = per_cpu_ptr(sb->s_files, cpu); |
1293 |
+-#else |
1294 |
+- list = &sb->s_files; |
1295 |
+-#endif |
1296 |
+- list_add(&file->f_u.fu_list, list); |
1297 |
+-} |
1298 |
+- |
1299 |
+-/** |
1300 |
+- * file_sb_list_add - add a file to the sb's file list |
1301 |
+- * @file: file to add |
1302 |
+- * @sb: sb to add it to |
1303 |
+- * |
1304 |
+- * Use this function to associate a file with the superblock of the inode it |
1305 |
+- * refers to. |
1306 |
+- */ |
1307 |
+-void file_sb_list_add(struct file *file, struct super_block *sb) |
1308 |
+-{ |
1309 |
+- lg_local_lock(&files_lglock); |
1310 |
+- __file_sb_list_add(file, sb); |
1311 |
+- lg_local_unlock(&files_lglock); |
1312 |
+-} |
1313 |
+- |
1314 |
+-/** |
1315 |
+- * file_sb_list_del - remove a file from the sb's file list |
1316 |
+- * @file: file to remove |
1317 |
+- * @sb: sb to remove it from |
1318 |
+- * |
1319 |
+- * Use this function to remove a file from its superblock. |
1320 |
+- */ |
1321 |
+-void file_sb_list_del(struct file *file) |
1322 |
+-{ |
1323 |
+- if (!list_empty(&file->f_u.fu_list)) { |
1324 |
+- lg_local_lock_cpu(&files_lglock, file_list_cpu(file)); |
1325 |
+- list_del_init(&file->f_u.fu_list); |
1326 |
+- lg_local_unlock_cpu(&files_lglock, file_list_cpu(file)); |
1327 |
+- } |
1328 |
+-} |
1329 |
+- |
1330 |
+-#ifdef CONFIG_SMP |
1331 |
+- |
1332 |
+-/* |
1333 |
+- * These macros iterate all files on all CPUs for a given superblock. |
1334 |
+- * files_lglock must be held globally. |
1335 |
+- */ |
1336 |
+-#define do_file_list_for_each_entry(__sb, __file) \ |
1337 |
+-{ \ |
1338 |
+- int i; \ |
1339 |
+- for_each_possible_cpu(i) { \ |
1340 |
+- struct list_head *list; \ |
1341 |
+- list = per_cpu_ptr((__sb)->s_files, i); \ |
1342 |
+- list_for_each_entry((__file), list, f_u.fu_list) |
1343 |
+- |
1344 |
+-#define while_file_list_for_each_entry \ |
1345 |
+- } \ |
1346 |
+-} |
1347 |
+- |
1348 |
+-#else |
1349 |
+- |
1350 |
+-#define do_file_list_for_each_entry(__sb, __file) \ |
1351 |
+-{ \ |
1352 |
+- struct list_head *list; \ |
1353 |
+- list = &(sb)->s_files; \ |
1354 |
+- list_for_each_entry((__file), list, f_u.fu_list) |
1355 |
+- |
1356 |
+-#define while_file_list_for_each_entry \ |
1357 |
+-} |
1358 |
+- |
1359 |
+-#endif |
1360 |
+- |
1361 |
+-/** |
1362 |
+- * mark_files_ro - mark all files read-only |
1363 |
+- * @sb: superblock in question |
1364 |
+- * |
1365 |
+- * All files are marked read-only. We don't care about pending |
1366 |
+- * delete files so this should be used in 'force' mode only. |
1367 |
+- */ |
1368 |
+-void mark_files_ro(struct super_block *sb) |
1369 |
+-{ |
1370 |
+- struct file *f; |
1371 |
+- |
1372 |
+- lg_global_lock(&files_lglock); |
1373 |
+- do_file_list_for_each_entry(sb, f) { |
1374 |
+- if (!S_ISREG(file_inode(f)->i_mode)) |
1375 |
+- continue; |
1376 |
+- if (!file_count(f)) |
1377 |
+- continue; |
1378 |
+- if (!(f->f_mode & FMODE_WRITE)) |
1379 |
+- continue; |
1380 |
+- spin_lock(&f->f_lock); |
1381 |
+- f->f_mode &= ~FMODE_WRITE; |
1382 |
+- spin_unlock(&f->f_lock); |
1383 |
+- if (file_check_writeable(f) != 0) |
1384 |
+- continue; |
1385 |
+- __mnt_drop_write(f->f_path.mnt); |
1386 |
+- file_release_write(f); |
1387 |
+- } while_file_list_for_each_entry; |
1388 |
+- lg_global_unlock(&files_lglock); |
1389 |
+-} |
1390 |
+- |
1391 |
+ void __init files_init(unsigned long mempages) |
1392 |
+ { |
1393 |
+ unsigned long n; |
1394 |
+@@ -481,6 +354,5 @@ void __init files_init(unsigned long mempages) |
1395 |
+ n = (mempages * (PAGE_SIZE / 1024)) / 10; |
1396 |
+ files_stat.max_files = max_t(unsigned long, n, NR_FILE); |
1397 |
+ files_defer_init(); |
1398 |
+- lg_lock_init(&files_lglock, "files_lglock"); |
1399 |
+ percpu_counter_init(&nr_files, 0); |
1400 |
+ } |
1401 |
+diff --git a/fs/internal.h b/fs/internal.h |
1402 |
+index 68121584ae37..2ffa65a36ca0 100644 |
1403 |
+--- a/fs/internal.h |
1404 |
++++ b/fs/internal.h |
1405 |
+@@ -74,9 +74,6 @@ extern void chroot_fs_refs(const struct path *, const struct path *); |
1406 |
+ /* |
1407 |
+ * file_table.c |
1408 |
+ */ |
1409 |
+-extern void file_sb_list_add(struct file *f, struct super_block *sb); |
1410 |
+-extern void file_sb_list_del(struct file *f); |
1411 |
+-extern void mark_files_ro(struct super_block *); |
1412 |
+ extern struct file *get_empty_filp(void); |
1413 |
+ |
1414 |
+ /* |
1415 |
+diff --git a/fs/open.c b/fs/open.c |
1416 |
+index 86092bde31f4..5f129683b7d7 100644 |
1417 |
+--- a/fs/open.c |
1418 |
++++ b/fs/open.c |
1419 |
+@@ -674,7 +674,6 @@ static int do_dentry_open(struct file *f, |
1420 |
+ } |
1421 |
+ |
1422 |
+ f->f_mapping = inode->i_mapping; |
1423 |
+- file_sb_list_add(f, inode->i_sb); |
1424 |
+ |
1425 |
+ if (unlikely(f->f_mode & FMODE_PATH)) { |
1426 |
+ f->f_op = &empty_fops; |
1427 |
+@@ -709,7 +708,6 @@ static int do_dentry_open(struct file *f, |
1428 |
+ |
1429 |
+ cleanup_all: |
1430 |
+ fops_put(f->f_op); |
1431 |
+- file_sb_list_del(f); |
1432 |
+ if (f->f_mode & FMODE_WRITE) { |
1433 |
+ if (!special_file(inode->i_mode)) { |
1434 |
+ /* |
1435 |
+diff --git a/fs/super.c b/fs/super.c |
1436 |
+index e028b508db25..97280e76179c 100644 |
1437 |
+--- a/fs/super.c |
1438 |
++++ b/fs/super.c |
1439 |
+@@ -163,19 +163,6 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags) |
1440 |
+ s = NULL; |
1441 |
+ goto out; |
1442 |
+ } |
1443 |
+-#ifdef CONFIG_SMP |
1444 |
+- s->s_files = alloc_percpu(struct list_head); |
1445 |
+- if (!s->s_files) |
1446 |
+- goto err_out; |
1447 |
+- else { |
1448 |
+- int i; |
1449 |
+- |
1450 |
+- for_each_possible_cpu(i) |
1451 |
+- INIT_LIST_HEAD(per_cpu_ptr(s->s_files, i)); |
1452 |
+- } |
1453 |
+-#else |
1454 |
+- INIT_LIST_HEAD(&s->s_files); |
1455 |
+-#endif |
1456 |
+ if (init_sb_writers(s, type)) |
1457 |
+ goto err_out; |
1458 |
+ s->s_flags = flags; |
1459 |
+@@ -225,10 +212,6 @@ out: |
1460 |
+ return s; |
1461 |
+ err_out: |
1462 |
+ security_sb_free(s); |
1463 |
+-#ifdef CONFIG_SMP |
1464 |
+- if (s->s_files) |
1465 |
+- free_percpu(s->s_files); |
1466 |
+-#endif |
1467 |
+ destroy_sb_writers(s); |
1468 |
+ kfree(s); |
1469 |
+ s = NULL; |
1470 |
+@@ -243,9 +226,6 @@ err_out: |
1471 |
+ */ |
1472 |
+ static inline void destroy_super(struct super_block *s) |
1473 |
+ { |
1474 |
+-#ifdef CONFIG_SMP |
1475 |
+- free_percpu(s->s_files); |
1476 |
+-#endif |
1477 |
+ destroy_sb_writers(s); |
1478 |
+ security_sb_free(s); |
1479 |
+ WARN_ON(!list_empty(&s->s_mounts)); |
1480 |
+@@ -727,7 +707,8 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) |
1481 |
+ make sure there are no rw files opened */ |
1482 |
+ if (remount_ro) { |
1483 |
+ if (force) { |
1484 |
+- mark_files_ro(sb); |
1485 |
++ sb->s_readonly_remount = 1; |
1486 |
++ smp_wmb(); |
1487 |
+ } else { |
1488 |
+ retval = sb_prepare_remount_readonly(sb); |
1489 |
+ if (retval) |
1490 |
+diff --git a/include/linux/fs.h b/include/linux/fs.h |
1491 |
+index d57bc5df7225..5c9dc8471da5 100644 |
1492 |
+--- a/include/linux/fs.h |
1493 |
++++ b/include/linux/fs.h |
1494 |
+@@ -10,6 +10,7 @@ |
1495 |
+ #include <linux/stat.h> |
1496 |
+ #include <linux/cache.h> |
1497 |
+ #include <linux/list.h> |
1498 |
++#include <linux/llist.h> |
1499 |
+ #include <linux/radix-tree.h> |
1500 |
+ #include <linux/rbtree.h> |
1501 |
+ #include <linux/init.h> |
1502 |
+@@ -761,12 +762,8 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index) |
1503 |
+ #define FILE_MNT_WRITE_RELEASED 2 |
1504 |
+ |
1505 |
+ struct file { |
1506 |
+- /* |
1507 |
+- * fu_list becomes invalid after file_free is called and queued via |
1508 |
+- * fu_rcuhead for RCU freeing |
1509 |
+- */ |
1510 |
+ union { |
1511 |
+- struct list_head fu_list; |
1512 |
++ struct llist_node fu_llist; |
1513 |
+ struct rcu_head fu_rcuhead; |
1514 |
+ } f_u; |
1515 |
+ struct path f_path; |
1516 |
+@@ -779,9 +776,6 @@ struct file { |
1517 |
+ * Must not be taken from IRQ context. |
1518 |
+ */ |
1519 |
+ spinlock_t f_lock; |
1520 |
+-#ifdef CONFIG_SMP |
1521 |
+- int f_sb_list_cpu; |
1522 |
+-#endif |
1523 |
+ atomic_long_t f_count; |
1524 |
+ unsigned int f_flags; |
1525 |
+ fmode_t f_mode; |
1526 |
+@@ -1257,11 +1251,6 @@ struct super_block { |
1527 |
+ |
1528 |
+ struct list_head s_inodes; /* all inodes */ |
1529 |
+ struct hlist_bl_head s_anon; /* anonymous dentries for (nfs) exporting */ |
1530 |
+-#ifdef CONFIG_SMP |
1531 |
+- struct list_head __percpu *s_files; |
1532 |
+-#else |
1533 |
+- struct list_head s_files; |
1534 |
+-#endif |
1535 |
+ struct list_head s_mounts; /* list of mounts; _not_ for fs use */ |
1536 |
+ /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */ |
1537 |
+ struct list_head s_dentry_lru; /* unused dentry lru */ |
1538 |
+diff --git a/include/linux/mbus.h b/include/linux/mbus.h |
1539 |
+index dba482e31a13..e80b9c7ec8da 100644 |
1540 |
+--- a/include/linux/mbus.h |
1541 |
++++ b/include/linux/mbus.h |
1542 |
+@@ -67,6 +67,6 @@ int mvebu_mbus_add_window(const char *devname, phys_addr_t base, |
1543 |
+ int mvebu_mbus_del_window(phys_addr_t base, size_t size); |
1544 |
+ int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base, |
1545 |
+ size_t mbus_size, phys_addr_t sdram_phys_base, |
1546 |
+- size_t sdram_size); |
1547 |
++ size_t sdram_size, int is_coherent); |
1548 |
+ |
1549 |
+ #endif /* __LINUX_MBUS_H */ |
1550 |
+diff --git a/include/linux/sched.h b/include/linux/sched.h |
1551 |
+index 00c1d4f45072..7cf305d036db 100644 |
1552 |
+--- a/include/linux/sched.h |
1553 |
++++ b/include/linux/sched.h |
1554 |
+@@ -2203,15 +2203,15 @@ static inline bool thread_group_leader(struct task_struct *p) |
1555 |
+ * all we care about is that we have a task with the appropriate |
1556 |
+ * pid, we don't actually care if we have the right task. |
1557 |
+ */ |
1558 |
+-static inline int has_group_leader_pid(struct task_struct *p) |
1559 |
++static inline bool has_group_leader_pid(struct task_struct *p) |
1560 |
+ { |
1561 |
+- return p->pid == p->tgid; |
1562 |
++ return task_pid(p) == p->signal->leader_pid; |
1563 |
+ } |
1564 |
+ |
1565 |
+ static inline |
1566 |
+-int same_thread_group(struct task_struct *p1, struct task_struct *p2) |
1567 |
++bool same_thread_group(struct task_struct *p1, struct task_struct *p2) |
1568 |
+ { |
1569 |
+- return p1->tgid == p2->tgid; |
1570 |
++ return p1->signal == p2->signal; |
1571 |
+ } |
1572 |
+ |
1573 |
+ static inline struct task_struct *next_thread(const struct task_struct *p) |
1574 |
+diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h |
1575 |
+index 665e0cee59bd..5e661a979694 100644 |
1576 |
+--- a/include/net/ip6_fib.h |
1577 |
++++ b/include/net/ip6_fib.h |
1578 |
+@@ -301,7 +301,7 @@ extern void inet6_rt_notify(int event, struct rt6_info *rt, |
1579 |
+ struct nl_info *info); |
1580 |
+ |
1581 |
+ extern void fib6_run_gc(unsigned long expires, |
1582 |
+- struct net *net); |
1583 |
++ struct net *net, bool force); |
1584 |
+ |
1585 |
+ extern void fib6_gc_cleanup(void); |
1586 |
+ |
1587 |
+diff --git a/kernel/ptrace.c b/kernel/ptrace.c |
1588 |
+index 118323bc8529..30ab20623bca 100644 |
1589 |
+--- a/kernel/ptrace.c |
1590 |
++++ b/kernel/ptrace.c |
1591 |
+@@ -236,7 +236,7 @@ static int __ptrace_may_access(struct task_struct *task, unsigned int mode) |
1592 |
+ */ |
1593 |
+ int dumpable = 0; |
1594 |
+ /* Don't let security modules deny introspection */ |
1595 |
+- if (task == current) |
1596 |
++ if (same_thread_group(task, current)) |
1597 |
+ return 0; |
1598 |
+ rcu_read_lock(); |
1599 |
+ tcred = __task_cred(task); |
1600 |
+diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c |
1601 |
+index 9a459be24af7..9b5b5ddf8cd4 100644 |
1602 |
+--- a/net/ipv4/xfrm4_policy.c |
1603 |
++++ b/net/ipv4/xfrm4_policy.c |
1604 |
+@@ -235,7 +235,7 @@ static struct dst_ops xfrm4_dst_ops = { |
1605 |
+ .destroy = xfrm4_dst_destroy, |
1606 |
+ .ifdown = xfrm4_dst_ifdown, |
1607 |
+ .local_out = __ip_local_out, |
1608 |
+- .gc_thresh = 1024, |
1609 |
++ .gc_thresh = 32768, |
1610 |
+ }; |
1611 |
+ |
1612 |
+ static struct xfrm_policy_afinfo xfrm4_policy_afinfo = { |
1613 |
+diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c |
1614 |
+index ceeb9458bb60..46458ee31939 100644 |
1615 |
+--- a/net/ipv6/ip6_fib.c |
1616 |
++++ b/net/ipv6/ip6_fib.c |
1617 |
+@@ -1648,27 +1648,28 @@ static int fib6_age(struct rt6_info *rt, void *arg) |
1618 |
+ |
1619 |
+ static DEFINE_SPINLOCK(fib6_gc_lock); |
1620 |
+ |
1621 |
+-void fib6_run_gc(unsigned long expires, struct net *net) |
1622 |
++void fib6_run_gc(unsigned long expires, struct net *net, bool force) |
1623 |
+ { |
1624 |
+- if (expires != ~0UL) { |
1625 |
++ unsigned long now; |
1626 |
++ |
1627 |
++ if (force) { |
1628 |
+ spin_lock_bh(&fib6_gc_lock); |
1629 |
+- gc_args.timeout = expires ? (int)expires : |
1630 |
+- net->ipv6.sysctl.ip6_rt_gc_interval; |
1631 |
+- } else { |
1632 |
+- if (!spin_trylock_bh(&fib6_gc_lock)) { |
1633 |
+- mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); |
1634 |
+- return; |
1635 |
+- } |
1636 |
+- gc_args.timeout = net->ipv6.sysctl.ip6_rt_gc_interval; |
1637 |
++ } else if (!spin_trylock_bh(&fib6_gc_lock)) { |
1638 |
++ mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); |
1639 |
++ return; |
1640 |
+ } |
1641 |
++ gc_args.timeout = expires ? (int)expires : |
1642 |
++ net->ipv6.sysctl.ip6_rt_gc_interval; |
1643 |
+ |
1644 |
+ gc_args.more = icmp6_dst_gc(); |
1645 |
+ |
1646 |
+ fib6_clean_all(net, fib6_age, 0, NULL); |
1647 |
++ now = jiffies; |
1648 |
++ net->ipv6.ip6_rt_last_gc = now; |
1649 |
+ |
1650 |
+ if (gc_args.more) |
1651 |
+ mod_timer(&net->ipv6.ip6_fib_timer, |
1652 |
+- round_jiffies(jiffies |
1653 |
++ round_jiffies(now |
1654 |
+ + net->ipv6.sysctl.ip6_rt_gc_interval)); |
1655 |
+ else |
1656 |
+ del_timer(&net->ipv6.ip6_fib_timer); |
1657 |
+@@ -1677,7 +1678,7 @@ void fib6_run_gc(unsigned long expires, struct net *net) |
1658 |
+ |
1659 |
+ static void fib6_gc_timer_cb(unsigned long arg) |
1660 |
+ { |
1661 |
+- fib6_run_gc(0, (struct net *)arg); |
1662 |
++ fib6_run_gc(0, (struct net *)arg, true); |
1663 |
+ } |
1664 |
+ |
1665 |
+ static int __net_init fib6_net_init(struct net *net) |
1666 |
+diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c |
1667 |
+index 05f361338c2e..deedf7ddbc6e 100644 |
1668 |
+--- a/net/ipv6/ndisc.c |
1669 |
++++ b/net/ipv6/ndisc.c |
1670 |
+@@ -1584,7 +1584,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, |
1671 |
+ switch (event) { |
1672 |
+ case NETDEV_CHANGEADDR: |
1673 |
+ neigh_changeaddr(&nd_tbl, dev); |
1674 |
+- fib6_run_gc(~0UL, net); |
1675 |
++ fib6_run_gc(0, net, false); |
1676 |
+ idev = in6_dev_get(dev); |
1677 |
+ if (!idev) |
1678 |
+ break; |
1679 |
+@@ -1594,7 +1594,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, |
1680 |
+ break; |
1681 |
+ case NETDEV_DOWN: |
1682 |
+ neigh_ifdown(&nd_tbl, dev); |
1683 |
+- fib6_run_gc(~0UL, net); |
1684 |
++ fib6_run_gc(0, net, false); |
1685 |
+ break; |
1686 |
+ case NETDEV_NOTIFY_PEERS: |
1687 |
+ ndisc_send_unsol_na(dev); |
1688 |
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
1689 |
+index d94d224f7e68..6ebefd46f718 100644 |
1690 |
+--- a/net/ipv6/route.c |
1691 |
++++ b/net/ipv6/route.c |
1692 |
+@@ -1334,7 +1334,6 @@ static void icmp6_clean_all(int (*func)(struct rt6_info *rt, void *arg), |
1693 |
+ |
1694 |
+ static int ip6_dst_gc(struct dst_ops *ops) |
1695 |
+ { |
1696 |
+- unsigned long now = jiffies; |
1697 |
+ struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops); |
1698 |
+ int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval; |
1699 |
+ int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size; |
1700 |
+@@ -1344,13 +1343,12 @@ static int ip6_dst_gc(struct dst_ops *ops) |
1701 |
+ int entries; |
1702 |
+ |
1703 |
+ entries = dst_entries_get_fast(ops); |
1704 |
+- if (time_after(rt_last_gc + rt_min_interval, now) && |
1705 |
++ if (time_after(rt_last_gc + rt_min_interval, jiffies) && |
1706 |
+ entries <= rt_max_size) |
1707 |
+ goto out; |
1708 |
+ |
1709 |
+ net->ipv6.ip6_rt_gc_expire++; |
1710 |
+- fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net); |
1711 |
+- net->ipv6.ip6_rt_last_gc = now; |
1712 |
++ fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, entries > rt_max_size); |
1713 |
+ entries = dst_entries_get_slow(ops); |
1714 |
+ if (entries < ops->gc_thresh) |
1715 |
+ net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1; |
1716 |
+@@ -2849,7 +2847,7 @@ int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, |
1717 |
+ net = (struct net *)ctl->extra1; |
1718 |
+ delay = net->ipv6.sysctl.flush_delay; |
1719 |
+ proc_dointvec(ctl, write, buffer, lenp, ppos); |
1720 |
+- fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net); |
1721 |
++ fib6_run_gc(delay <= 0 ? 0 : (unsigned long)delay, net, delay > 0); |
1722 |
+ return 0; |
1723 |
+ } |
1724 |
+ |
1725 |
+diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c |
1726 |
+index 23ed03d786c8..1c2e0c9ba8a1 100644 |
1727 |
+--- a/net/ipv6/xfrm6_policy.c |
1728 |
++++ b/net/ipv6/xfrm6_policy.c |
1729 |
+@@ -284,7 +284,7 @@ static struct dst_ops xfrm6_dst_ops = { |
1730 |
+ .destroy = xfrm6_dst_destroy, |
1731 |
+ .ifdown = xfrm6_dst_ifdown, |
1732 |
+ .local_out = __ip6_local_out, |
1733 |
+- .gc_thresh = 1024, |
1734 |
++ .gc_thresh = 32768, |
1735 |
+ }; |
1736 |
+ |
1737 |
+ static struct xfrm_policy_afinfo xfrm6_policy_afinfo = { |
1738 |
+diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c |
1739 |
+index a191b6db657e..3b283edec027 100644 |
1740 |
+--- a/net/netfilter/nfnetlink_cthelper.c |
1741 |
++++ b/net/netfilter/nfnetlink_cthelper.c |
1742 |
+@@ -74,6 +74,9 @@ nfnl_cthelper_parse_tuple(struct nf_conntrack_tuple *tuple, |
1743 |
+ if (!tb[NFCTH_TUPLE_L3PROTONUM] || !tb[NFCTH_TUPLE_L4PROTONUM]) |
1744 |
+ return -EINVAL; |
1745 |
+ |
1746 |
++ /* Not all fields are initialized so first zero the tuple */ |
1747 |
++ memset(tuple, 0, sizeof(struct nf_conntrack_tuple)); |
1748 |
++ |
1749 |
+ tuple->src.l3num = ntohs(nla_get_be16(tb[NFCTH_TUPLE_L3PROTONUM])); |
1750 |
+ tuple->dst.protonum = nla_get_u8(tb[NFCTH_TUPLE_L4PROTONUM]); |
1751 |
+ |
1752 |
+@@ -83,7 +86,7 @@ nfnl_cthelper_parse_tuple(struct nf_conntrack_tuple *tuple, |
1753 |
+ static int |
1754 |
+ nfnl_cthelper_from_nlattr(struct nlattr *attr, struct nf_conn *ct) |
1755 |
+ { |
1756 |
+- const struct nf_conn_help *help = nfct_help(ct); |
1757 |
++ struct nf_conn_help *help = nfct_help(ct); |
1758 |
+ |
1759 |
+ if (attr == NULL) |
1760 |
+ return -EINVAL; |
1761 |
+@@ -91,7 +94,7 @@ nfnl_cthelper_from_nlattr(struct nlattr *attr, struct nf_conn *ct) |
1762 |
+ if (help->helper->data_len == 0) |
1763 |
+ return -EINVAL; |
1764 |
+ |
1765 |
+- memcpy(&help->data, nla_data(attr), help->helper->data_len); |
1766 |
++ memcpy(help->data, nla_data(attr), help->helper->data_len); |
1767 |
+ return 0; |
1768 |
+ } |
1769 |
+ |