Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.9 commit in: /
Date: Sat, 20 Oct 2018 12:43:53
Message-Id: 1540039397.017a1ef3e1cf814e9eae5df7295615f0378390a6.mpagano@gentoo
1 commit: 017a1ef3e1cf814e9eae5df7295615f0378390a6
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 20 12:43:17 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 20 12:43:17 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=017a1ef3
7
8 Linux patch 4.9.135
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 10 +-
13 1134_linux-4.9.135.patch | 1613 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1620 insertions(+), 3 deletions(-)
15
16 diff --git a/0000_README b/0000_README
17 index 99ea31b..0a80b16 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -567,15 +567,19 @@ Patch: 1130_linux-4.9.131.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.9.131
23
24 -Patch: 1130_linux-4.9.132.patch
25 +Patch: 1131_linux-4.9.132.patch
26 From: http://www.kernel.org
27 Desc: Linux 4.9.132
28
29 -Patch: 1130_linux-4.9.133.patch
30 +Patch: 1132_linux-4.9.133.patch
31 From: http://www.kernel.org
32 Desc: Linux 4.9.133
33
34 -Patch: 1131_linux-4.9.134.patch
35 +Patch: 1133_linux-4.9.134.patch
36 +From: http://www.kernel.org
37 +Desc: Linux 4.9.134
38 +
39 +Patch: 1134_linux-4.9.135.patch
40 From: http://www.kernel.org
41 Desc: Linux 4.9.134
42
43
44 diff --git a/1134_linux-4.9.135.patch b/1134_linux-4.9.135.patch
45 new file mode 100644
46 index 0000000..f321d7f
47 --- /dev/null
48 +++ b/1134_linux-4.9.135.patch
49 @@ -0,0 +1,1613 @@
50 +diff --git a/Makefile b/Makefile
51 +index 46135e4333e6..3678e4d19ebc 100644
52 +--- a/Makefile
53 ++++ b/Makefile
54 +@@ -1,6 +1,6 @@
55 + VERSION = 4
56 + PATCHLEVEL = 9
57 +-SUBLEVEL = 134
58 ++SUBLEVEL = 135
59 + EXTRAVERSION =
60 + NAME = Roaring Lionus
61 +
62 +diff --git a/arch/arc/Makefile b/arch/arc/Makefile
63 +index 8447eed836ef..a3b456008201 100644
64 +--- a/arch/arc/Makefile
65 ++++ b/arch/arc/Makefile
66 +@@ -8,34 +8,12 @@
67 +
68 + UTS_MACHINE := arc
69 +
70 +-ifeq ($(CROSS_COMPILE),)
71 +-ifndef CONFIG_CPU_BIG_ENDIAN
72 +-CROSS_COMPILE := arc-linux-
73 +-else
74 +-CROSS_COMPILE := arceb-linux-
75 +-endif
76 +-endif
77 +-
78 + KBUILD_DEFCONFIG := nsim_700_defconfig
79 +
80 + cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
81 + cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7
82 + cflags-$(CONFIG_ISA_ARCV2) += -mcpu=archs
83 +
84 +-is_700 = $(shell $(CC) -dM -E - < /dev/null | grep -q "ARC700" && echo 1 || echo 0)
85 +-
86 +-ifdef CONFIG_ISA_ARCOMPACT
87 +-ifeq ($(is_700), 0)
88 +- $(error Toolchain not configured for ARCompact builds)
89 +-endif
90 +-endif
91 +-
92 +-ifdef CONFIG_ISA_ARCV2
93 +-ifeq ($(is_700), 1)
94 +- $(error Toolchain not configured for ARCv2 builds)
95 +-endif
96 +-endif
97 +-
98 + ifdef CONFIG_ARC_CURR_IN_REG
99 + # For a global register defintion, make sure it gets passed to every file
100 + # We had a customer reported bug where some code built in kernel was NOT using
101 +@@ -89,7 +67,7 @@ ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
102 + # --build-id w/o "-marclinux". Default arc-elf32-ld is OK
103 + ldflags-$(upto_gcc44) += -marclinux
104 +
105 +-LIBGCC := $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
106 ++LIBGCC = $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
107 +
108 + # Modules with short calls might break for calls into builtin-kernel
109 + KBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode
110 +diff --git a/arch/powerpc/kernel/tm.S b/arch/powerpc/kernel/tm.S
111 +index 3a2d04134da9..f59b73810630 100644
112 +--- a/arch/powerpc/kernel/tm.S
113 ++++ b/arch/powerpc/kernel/tm.S
114 +@@ -166,13 +166,27 @@ _GLOBAL(tm_reclaim)
115 + std r1, PACATMSCRATCH(r13)
116 + ld r1, PACAR1(r13)
117 +
118 +- /* Store the PPR in r11 and reset to decent value */
119 + std r11, GPR11(r1) /* Temporary stash */
120 +
121 ++ /*
122 ++ * Move the saved user r1 to the kernel stack in case PACATMSCRATCH is
123 ++ * clobbered by an exception once we turn on MSR_RI below.
124 ++ */
125 ++ ld r11, PACATMSCRATCH(r13)
126 ++ std r11, GPR1(r1)
127 ++
128 ++ /*
129 ++ * Store r13 away so we can free up the scratch SPR for the SLB fault
130 ++ * handler (needed once we start accessing the thread_struct).
131 ++ */
132 ++ GET_SCRATCH0(r11)
133 ++ std r11, GPR13(r1)
134 ++
135 + /* Reset MSR RI so we can take SLB faults again */
136 + li r11, MSR_RI
137 + mtmsrd r11, 1
138 +
139 ++ /* Store the PPR in r11 and reset to decent value */
140 + mfspr r11, SPRN_PPR
141 + HMT_MEDIUM
142 +
143 +@@ -197,11 +211,11 @@ _GLOBAL(tm_reclaim)
144 + SAVE_GPR(8, r7) /* user r8 */
145 + SAVE_GPR(9, r7) /* user r9 */
146 + SAVE_GPR(10, r7) /* user r10 */
147 +- ld r3, PACATMSCRATCH(r13) /* user r1 */
148 ++ ld r3, GPR1(r1) /* user r1 */
149 + ld r4, GPR7(r1) /* user r7 */
150 + ld r5, GPR11(r1) /* user r11 */
151 + ld r6, GPR12(r1) /* user r12 */
152 +- GET_SCRATCH0(8) /* user r13 */
153 ++ ld r8, GPR13(r1) /* user r13 */
154 + std r3, GPR1(r7)
155 + std r4, GPR7(r7)
156 + std r5, GPR11(r7)
157 +diff --git a/arch/s390/appldata/appldata_os.c b/arch/s390/appldata/appldata_os.c
158 +index 69b23b25ac34..08b9e942a262 100644
159 +--- a/arch/s390/appldata/appldata_os.c
160 ++++ b/arch/s390/appldata/appldata_os.c
161 +@@ -113,21 +113,21 @@ static void appldata_get_os_data(void *data)
162 + j = 0;
163 + for_each_online_cpu(i) {
164 + os_data->os_cpu[j].per_cpu_user =
165 +- cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_USER]);
166 ++ nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_USER]);
167 + os_data->os_cpu[j].per_cpu_nice =
168 +- cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_NICE]);
169 ++ nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_NICE]);
170 + os_data->os_cpu[j].per_cpu_system =
171 +- cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]);
172 ++ nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]);
173 + os_data->os_cpu[j].per_cpu_idle =
174 +- cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IDLE]);
175 ++ nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IDLE]);
176 + os_data->os_cpu[j].per_cpu_irq =
177 +- cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IRQ]);
178 ++ nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IRQ]);
179 + os_data->os_cpu[j].per_cpu_softirq =
180 +- cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]);
181 ++ nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]);
182 + os_data->os_cpu[j].per_cpu_iowait =
183 +- cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IOWAIT]);
184 ++ nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IOWAIT]);
185 + os_data->os_cpu[j].per_cpu_steal =
186 +- cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_STEAL]);
187 ++ nsecs_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_STEAL]);
188 + os_data->os_cpu[j].cpu_id = i;
189 + j++;
190 + }
191 +diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
192 +index dfdb7e21ba56..93d089c9509a 100644
193 +--- a/arch/x86/include/asm/pgtable_types.h
194 ++++ b/arch/x86/include/asm/pgtable_types.h
195 +@@ -134,7 +134,7 @@
196 + */
197 + #define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \
198 + _PAGE_SPECIAL | _PAGE_ACCESSED | _PAGE_DIRTY | \
199 +- _PAGE_SOFT_DIRTY)
200 ++ _PAGE_SOFT_DIRTY | _PAGE_DEVMAP)
201 + #define _HPAGE_CHG_MASK (_PAGE_CHG_MASK | _PAGE_PSE)
202 +
203 + /* The ASID is the lower 12 bits of CR3 */
204 +diff --git a/drivers/clocksource/timer-ti-32k.c b/drivers/clocksource/timer-ti-32k.c
205 +index cf5b14e442e4..e9ab92d0c358 100644
206 +--- a/drivers/clocksource/timer-ti-32k.c
207 ++++ b/drivers/clocksource/timer-ti-32k.c
208 +@@ -98,6 +98,9 @@ static int __init ti_32k_timer_init(struct device_node *np)
209 + return -ENXIO;
210 + }
211 +
212 ++ if (!of_machine_is_compatible("ti,am43"))
213 ++ ti_32k_timer.cs.flags |= CLOCK_SOURCE_SUSPEND_NONSTOP;
214 ++
215 + ti_32k_timer.counter = ti_32k_timer.base;
216 +
217 + /*
218 +diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
219 +index af5eff6835a8..d6d91e8afa9e 100644
220 +--- a/drivers/cpufreq/cpufreq.c
221 ++++ b/drivers/cpufreq/cpufreq.c
222 +@@ -132,7 +132,7 @@ static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall)
223 + u64 cur_wall_time;
224 + u64 busy_time;
225 +
226 +- cur_wall_time = jiffies64_to_cputime64(get_jiffies_64());
227 ++ cur_wall_time = jiffies64_to_nsecs(get_jiffies_64());
228 +
229 + busy_time = kcpustat_cpu(cpu).cpustat[CPUTIME_USER];
230 + busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SYSTEM];
231 +@@ -143,9 +143,9 @@ static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall)
232 +
233 + idle_time = cur_wall_time - busy_time;
234 + if (wall)
235 +- *wall = cputime_to_usecs(cur_wall_time);
236 ++ *wall = div_u64(cur_wall_time, NSEC_PER_USEC);
237 +
238 +- return cputime_to_usecs(idle_time);
239 ++ return div_u64(idle_time, NSEC_PER_USEC);
240 + }
241 +
242 + u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy)
243 +diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c
244 +index 642dd0f183a8..38d1a8216084 100644
245 +--- a/drivers/cpufreq/cpufreq_governor.c
246 ++++ b/drivers/cpufreq/cpufreq_governor.c
247 +@@ -152,7 +152,7 @@ unsigned int dbs_update(struct cpufreq_policy *policy)
248 + if (ignore_nice) {
249 + u64 cur_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE];
250 +
251 +- idle_time += cputime_to_usecs(cur_nice - j_cdbs->prev_cpu_nice);
252 ++ idle_time += div_u64(cur_nice - j_cdbs->prev_cpu_nice, NSEC_PER_USEC);
253 + j_cdbs->prev_cpu_nice = cur_nice;
254 + }
255 +
256 +diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
257 +index 06d3abdffd3a..b084708fd113 100644
258 +--- a/drivers/cpufreq/cpufreq_stats.c
259 ++++ b/drivers/cpufreq/cpufreq_stats.c
260 +@@ -13,7 +13,6 @@
261 + #include <linux/cpufreq.h>
262 + #include <linux/module.h>
263 + #include <linux/slab.h>
264 +-#include <linux/cputime.h>
265 +
266 + static DEFINE_SPINLOCK(cpufreq_stats_lock);
267 +
268 +diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
269 +index 9280358b8f15..59d484736b4e 100644
270 +--- a/drivers/gpu/drm/arm/malidp_drv.c
271 ++++ b/drivers/gpu/drm/arm/malidp_drv.c
272 +@@ -378,6 +378,7 @@ static int malidp_bind(struct device *dev)
273 + goto irq_init_fail;
274 +
275 + ret = drm_vblank_init(drm, drm->mode_config.num_crtc);
276 ++ drm_crtc_vblank_reset(&malidp->crtc);
277 + if (ret < 0) {
278 + DRM_ERROR("failed to initialise vblank\n");
279 + goto vblank_fail;
280 +diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
281 +index 2248b330c047..70597854397f 100644
282 +--- a/drivers/hid/hid-core.c
283 ++++ b/drivers/hid/hid-core.c
284 +@@ -1853,6 +1853,9 @@ static const struct hid_device_id hid_have_special_driver[] = {
285 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) },
286 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS) },
287 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI) },
288 ++ { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI) },
289 ++ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_ANSI) },
290 ++ { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_ANSI) },
291 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
292 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
293 + { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD) },
294 +diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c
295 +index 5e1fdc8d32ab..2fd0f119a67b 100644
296 +--- a/drivers/hv/hv_kvp.c
297 ++++ b/drivers/hv/hv_kvp.c
298 +@@ -616,21 +616,22 @@ void hv_kvp_onchannelcallback(void *context)
299 + NEGO_IN_PROGRESS,
300 + NEGO_FINISHED} host_negotiatied = NEGO_NOT_STARTED;
301 +
302 +- if (host_negotiatied == NEGO_NOT_STARTED &&
303 +- kvp_transaction.state < HVUTIL_READY) {
304 ++ if (kvp_transaction.state < HVUTIL_READY) {
305 + /*
306 + * If userspace daemon is not connected and host is asking
307 + * us to negotiate we need to delay to not lose messages.
308 + * This is important for Failover IP setting.
309 + */
310 +- host_negotiatied = NEGO_IN_PROGRESS;
311 +- schedule_delayed_work(&kvp_host_handshake_work,
312 ++ if (host_negotiatied == NEGO_NOT_STARTED) {
313 ++ host_negotiatied = NEGO_IN_PROGRESS;
314 ++ schedule_delayed_work(&kvp_host_handshake_work,
315 + HV_UTIL_NEGO_TIMEOUT * HZ);
316 ++ }
317 + return;
318 + }
319 + if (kvp_transaction.state > HVUTIL_READY)
320 + return;
321 +-
322 ++recheck:
323 + vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 4, &recvlen,
324 + &requestid);
325 +
326 +@@ -707,6 +708,8 @@ void hv_kvp_onchannelcallback(void *context)
327 + VM_PKT_DATA_INBAND, 0);
328 +
329 + host_negotiatied = NEGO_FINISHED;
330 ++
331 ++ goto recheck;
332 + }
333 +
334 + }
335 +diff --git a/drivers/input/keyboard/atakbd.c b/drivers/input/keyboard/atakbd.c
336 +index f1235831283d..fdeda0b0fbd6 100644
337 +--- a/drivers/input/keyboard/atakbd.c
338 ++++ b/drivers/input/keyboard/atakbd.c
339 +@@ -79,8 +79,7 @@ MODULE_LICENSE("GPL");
340 + */
341 +
342 +
343 +-static unsigned char atakbd_keycode[0x72] = { /* American layout */
344 +- [0] = KEY_GRAVE,
345 ++static unsigned char atakbd_keycode[0x73] = { /* American layout */
346 + [1] = KEY_ESC,
347 + [2] = KEY_1,
348 + [3] = KEY_2,
349 +@@ -121,9 +120,9 @@ static unsigned char atakbd_keycode[0x72] = { /* American layout */
350 + [38] = KEY_L,
351 + [39] = KEY_SEMICOLON,
352 + [40] = KEY_APOSTROPHE,
353 +- [41] = KEY_BACKSLASH, /* FIXME, '#' */
354 ++ [41] = KEY_GRAVE,
355 + [42] = KEY_LEFTSHIFT,
356 +- [43] = KEY_GRAVE, /* FIXME: '~' */
357 ++ [43] = KEY_BACKSLASH,
358 + [44] = KEY_Z,
359 + [45] = KEY_X,
360 + [46] = KEY_C,
361 +@@ -149,45 +148,34 @@ static unsigned char atakbd_keycode[0x72] = { /* American layout */
362 + [66] = KEY_F8,
363 + [67] = KEY_F9,
364 + [68] = KEY_F10,
365 +- [69] = KEY_ESC,
366 +- [70] = KEY_DELETE,
367 +- [71] = KEY_KP7,
368 +- [72] = KEY_KP8,
369 +- [73] = KEY_KP9,
370 ++ [71] = KEY_HOME,
371 ++ [72] = KEY_UP,
372 + [74] = KEY_KPMINUS,
373 +- [75] = KEY_KP4,
374 +- [76] = KEY_KP5,
375 +- [77] = KEY_KP6,
376 ++ [75] = KEY_LEFT,
377 ++ [77] = KEY_RIGHT,
378 + [78] = KEY_KPPLUS,
379 +- [79] = KEY_KP1,
380 +- [80] = KEY_KP2,
381 +- [81] = KEY_KP3,
382 +- [82] = KEY_KP0,
383 +- [83] = KEY_KPDOT,
384 +- [90] = KEY_KPLEFTPAREN,
385 +- [91] = KEY_KPRIGHTPAREN,
386 +- [92] = KEY_KPASTERISK, /* FIXME */
387 +- [93] = KEY_KPASTERISK,
388 +- [94] = KEY_KPPLUS,
389 +- [95] = KEY_HELP,
390 ++ [80] = KEY_DOWN,
391 ++ [82] = KEY_INSERT,
392 ++ [83] = KEY_DELETE,
393 + [96] = KEY_102ND,
394 +- [97] = KEY_KPASTERISK, /* FIXME */
395 +- [98] = KEY_KPSLASH,
396 ++ [97] = KEY_UNDO,
397 ++ [98] = KEY_HELP,
398 + [99] = KEY_KPLEFTPAREN,
399 + [100] = KEY_KPRIGHTPAREN,
400 + [101] = KEY_KPSLASH,
401 + [102] = KEY_KPASTERISK,
402 +- [103] = KEY_UP,
403 +- [104] = KEY_KPASTERISK, /* FIXME */
404 +- [105] = KEY_LEFT,
405 +- [106] = KEY_RIGHT,
406 +- [107] = KEY_KPASTERISK, /* FIXME */
407 +- [108] = KEY_DOWN,
408 +- [109] = KEY_KPASTERISK, /* FIXME */
409 +- [110] = KEY_KPASTERISK, /* FIXME */
410 +- [111] = KEY_KPASTERISK, /* FIXME */
411 +- [112] = KEY_KPASTERISK, /* FIXME */
412 +- [113] = KEY_KPASTERISK /* FIXME */
413 ++ [103] = KEY_KP7,
414 ++ [104] = KEY_KP8,
415 ++ [105] = KEY_KP9,
416 ++ [106] = KEY_KP4,
417 ++ [107] = KEY_KP5,
418 ++ [108] = KEY_KP6,
419 ++ [109] = KEY_KP1,
420 ++ [110] = KEY_KP2,
421 ++ [111] = KEY_KP3,
422 ++ [112] = KEY_KP0,
423 ++ [113] = KEY_KPDOT,
424 ++ [114] = KEY_KPENTER,
425 + };
426 +
427 + static struct input_dev *atakbd_dev;
428 +@@ -195,21 +183,15 @@ static struct input_dev *atakbd_dev;
429 + static void atakbd_interrupt(unsigned char scancode, char down)
430 + {
431 +
432 +- if (scancode < 0x72) { /* scancodes < 0xf2 are keys */
433 ++ if (scancode < 0x73) { /* scancodes < 0xf3 are keys */
434 +
435 + // report raw events here?
436 +
437 + scancode = atakbd_keycode[scancode];
438 +
439 +- if (scancode == KEY_CAPSLOCK) { /* CapsLock is a toggle switch key on Amiga */
440 +- input_report_key(atakbd_dev, scancode, 1);
441 +- input_report_key(atakbd_dev, scancode, 0);
442 +- input_sync(atakbd_dev);
443 +- } else {
444 +- input_report_key(atakbd_dev, scancode, down);
445 +- input_sync(atakbd_dev);
446 +- }
447 +- } else /* scancodes >= 0xf2 are mouse data, most likely */
448 ++ input_report_key(atakbd_dev, scancode, down);
449 ++ input_sync(atakbd_dev);
450 ++ } else /* scancodes >= 0xf3 are mouse data, most likely */
451 + printk(KERN_INFO "atakbd: unhandled scancode %x\n", scancode);
452 +
453 + return;
454 +diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
455 +index 16199b36a11e..bba1b9f2f782 100644
456 +--- a/drivers/iommu/amd_iommu.c
457 ++++ b/drivers/iommu/amd_iommu.c
458 +@@ -288,7 +288,13 @@ static u16 get_alias(struct device *dev)
459 +
460 + /* The callers make sure that get_device_id() does not fail here */
461 + devid = get_device_id(dev);
462 ++
463 ++ /* For ACPI HID devices, we simply return the devid as such */
464 ++ if (!dev_is_pci(dev))
465 ++ return devid;
466 ++
467 + ivrs_alias = amd_iommu_alias_table[devid];
468 ++
469 + pci_for_each_dma_alias(pdev, __last_alias, &pci_alias);
470 +
471 + if (ivrs_alias == pci_alias)
472 +diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c
473 +index 25852e399ab2..c5aba26c604a 100644
474 +--- a/drivers/macintosh/rack-meter.c
475 ++++ b/drivers/macintosh/rack-meter.c
476 +@@ -52,8 +52,8 @@ struct rackmeter_dma {
477 + struct rackmeter_cpu {
478 + struct delayed_work sniffer;
479 + struct rackmeter *rm;
480 +- cputime64_t prev_wall;
481 +- cputime64_t prev_idle;
482 ++ u64 prev_wall;
483 ++ u64 prev_idle;
484 + int zero;
485 + } ____cacheline_aligned;
486 +
487 +@@ -81,7 +81,7 @@ static int rackmeter_ignore_nice;
488 + /* This is copied from cpufreq_ondemand, maybe we should put it in
489 + * a common header somewhere
490 + */
491 +-static inline cputime64_t get_cpu_idle_time(unsigned int cpu)
492 ++static inline u64 get_cpu_idle_time(unsigned int cpu)
493 + {
494 + u64 retval;
495 +
496 +@@ -217,23 +217,23 @@ static void rackmeter_do_timer(struct work_struct *work)
497 + container_of(work, struct rackmeter_cpu, sniffer.work);
498 + struct rackmeter *rm = rcpu->rm;
499 + unsigned int cpu = smp_processor_id();
500 +- cputime64_t cur_jiffies, total_idle_ticks;
501 +- unsigned int total_ticks, idle_ticks;
502 ++ u64 cur_nsecs, total_idle_nsecs;
503 ++ u64 total_nsecs, idle_nsecs;
504 + int i, offset, load, cumm, pause;
505 +
506 +- cur_jiffies = jiffies64_to_cputime64(get_jiffies_64());
507 +- total_ticks = (unsigned int) (cur_jiffies - rcpu->prev_wall);
508 +- rcpu->prev_wall = cur_jiffies;
509 ++ cur_nsecs = jiffies64_to_nsecs(get_jiffies_64());
510 ++ total_nsecs = cur_nsecs - rcpu->prev_wall;
511 ++ rcpu->prev_wall = cur_nsecs;
512 +
513 +- total_idle_ticks = get_cpu_idle_time(cpu);
514 +- idle_ticks = (unsigned int) (total_idle_ticks - rcpu->prev_idle);
515 +- idle_ticks = min(idle_ticks, total_ticks);
516 +- rcpu->prev_idle = total_idle_ticks;
517 ++ total_idle_nsecs = get_cpu_idle_time(cpu);
518 ++ idle_nsecs = total_idle_nsecs - rcpu->prev_idle;
519 ++ idle_nsecs = min(idle_nsecs, total_nsecs);
520 ++ rcpu->prev_idle = total_idle_nsecs;
521 +
522 + /* We do a very dumb calculation to update the LEDs for now,
523 + * we'll do better once we have actual PWM implemented
524 + */
525 +- load = (9 * (total_ticks - idle_ticks)) / total_ticks;
526 ++ load = div64_u64(9 * (total_nsecs - idle_nsecs), total_nsecs);
527 +
528 + offset = cpu << 3;
529 + cumm = 0;
530 +@@ -278,7 +278,7 @@ static void rackmeter_init_cpu_sniffer(struct rackmeter *rm)
531 + continue;
532 + rcpu = &rm->cpu[cpu];
533 + rcpu->prev_idle = get_cpu_idle_time(cpu);
534 +- rcpu->prev_wall = jiffies64_to_cputime64(get_jiffies_64());
535 ++ rcpu->prev_wall = jiffies64_to_nsecs(get_jiffies_64());
536 + schedule_delayed_work_on(cpu, &rm->cpu[cpu].sniffer,
537 + msecs_to_jiffies(CPU_SAMPLING_RATE));
538 + }
539 +diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
540 +index 8961dd732522..64be30d53847 100644
541 +--- a/drivers/media/usb/dvb-usb-v2/af9035.c
542 ++++ b/drivers/media/usb/dvb-usb-v2/af9035.c
543 +@@ -406,8 +406,10 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
544 + msg[0].addr == (state->af9033_i2c_addr[1] >> 1))
545 + reg |= 0x100000;
546 +
547 +- ret = af9035_wr_regs(d, reg, &msg[0].buf[3],
548 +- msg[0].len - 3);
549 ++ ret = (msg[0].len >= 3) ? af9035_wr_regs(d, reg,
550 ++ &msg[0].buf[3],
551 ++ msg[0].len - 3)
552 ++ : -EOPNOTSUPP;
553 + } else {
554 + /* I2C write */
555 + u8 buf[MAX_XFER_SIZE];
556 +diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
557 +index 0509996957d9..e70d6fe504b8 100644
558 +--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
559 ++++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
560 +@@ -240,7 +240,8 @@ static void mlx4_set_eq_affinity_hint(struct mlx4_priv *priv, int vec)
561 + struct mlx4_dev *dev = &priv->dev;
562 + struct mlx4_eq *eq = &priv->eq_table.eq[vec];
563 +
564 +- if (!eq->affinity_mask || cpumask_empty(eq->affinity_mask))
565 ++ if (!cpumask_available(eq->affinity_mask) ||
566 ++ cpumask_empty(eq->affinity_mask))
567 + return;
568 +
569 + hint_err = irq_set_affinity_hint(eq->irq, eq->affinity_mask);
570 +diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
571 +index f1109661a533..410399070639 100644
572 +--- a/drivers/net/ethernet/renesas/ravb.h
573 ++++ b/drivers/net/ethernet/renesas/ravb.h
574 +@@ -421,6 +421,7 @@ enum EIS_BIT {
575 + EIS_CULF1 = 0x00000080,
576 + EIS_TFFF = 0x00000100,
577 + EIS_QFS = 0x00010000,
578 ++ EIS_RESERVED = (GENMASK(31, 17) | GENMASK(15, 11)),
579 + };
580 +
581 + /* RIC0 */
582 +@@ -465,6 +466,7 @@ enum RIS0_BIT {
583 + RIS0_FRF15 = 0x00008000,
584 + RIS0_FRF16 = 0x00010000,
585 + RIS0_FRF17 = 0x00020000,
586 ++ RIS0_RESERVED = GENMASK(31, 18),
587 + };
588 +
589 + /* RIC1 */
590 +@@ -521,6 +523,7 @@ enum RIS2_BIT {
591 + RIS2_QFF16 = 0x00010000,
592 + RIS2_QFF17 = 0x00020000,
593 + RIS2_RFFF = 0x80000000,
594 ++ RIS2_RESERVED = GENMASK(30, 18),
595 + };
596 +
597 + /* TIC */
598 +@@ -537,6 +540,7 @@ enum TIS_BIT {
599 + TIS_FTF1 = 0x00000002, /* Undocumented? */
600 + TIS_TFUF = 0x00000100,
601 + TIS_TFWF = 0x00000200,
602 ++ TIS_RESERVED = (GENMASK(31, 20) | GENMASK(15, 12) | GENMASK(7, 4))
603 + };
604 +
605 + /* ISS */
606 +@@ -610,6 +614,7 @@ enum GIC_BIT {
607 + enum GIS_BIT {
608 + GIS_PTCF = 0x00000001, /* Undocumented? */
609 + GIS_PTMF = 0x00000004,
610 ++ GIS_RESERVED = GENMASK(15, 10),
611 + };
612 +
613 + /* GIE (R-Car Gen3 only) */
614 +diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
615 +index 307ecd500dac..71836a7f56b0 100644
616 +--- a/drivers/net/ethernet/renesas/ravb_main.c
617 ++++ b/drivers/net/ethernet/renesas/ravb_main.c
618 +@@ -717,10 +717,11 @@ static void ravb_error_interrupt(struct net_device *ndev)
619 + u32 eis, ris2;
620 +
621 + eis = ravb_read(ndev, EIS);
622 +- ravb_write(ndev, ~EIS_QFS, EIS);
623 ++ ravb_write(ndev, ~(EIS_QFS | EIS_RESERVED), EIS);
624 + if (eis & EIS_QFS) {
625 + ris2 = ravb_read(ndev, RIS2);
626 +- ravb_write(ndev, ~(RIS2_QFF0 | RIS2_RFFF), RIS2);
627 ++ ravb_write(ndev, ~(RIS2_QFF0 | RIS2_RFFF | RIS2_RESERVED),
628 ++ RIS2);
629 +
630 + /* Receive Descriptor Empty int */
631 + if (ris2 & RIS2_QFF0)
632 +@@ -773,7 +774,7 @@ static bool ravb_timestamp_interrupt(struct net_device *ndev)
633 + u32 tis = ravb_read(ndev, TIS);
634 +
635 + if (tis & TIS_TFUF) {
636 +- ravb_write(ndev, ~TIS_TFUF, TIS);
637 ++ ravb_write(ndev, ~(TIS_TFUF | TIS_RESERVED), TIS);
638 + ravb_get_tx_tstamp(ndev);
639 + return true;
640 + }
641 +@@ -908,7 +909,7 @@ static int ravb_poll(struct napi_struct *napi, int budget)
642 + /* Processing RX Descriptor Ring */
643 + if (ris0 & mask) {
644 + /* Clear RX interrupt */
645 +- ravb_write(ndev, ~mask, RIS0);
646 ++ ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0);
647 + if (ravb_rx(ndev, &quota, q))
648 + goto out;
649 + }
650 +@@ -916,7 +917,7 @@ static int ravb_poll(struct napi_struct *napi, int budget)
651 + if (tis & mask) {
652 + spin_lock_irqsave(&priv->lock, flags);
653 + /* Clear TX interrupt */
654 +- ravb_write(ndev, ~mask, TIS);
655 ++ ravb_write(ndev, ~(mask | TIS_RESERVED), TIS);
656 + ravb_tx_free(ndev, q, true);
657 + netif_wake_subqueue(ndev, q);
658 + mmiowb();
659 +diff --git a/drivers/net/ethernet/renesas/ravb_ptp.c b/drivers/net/ethernet/renesas/ravb_ptp.c
660 +index eede70ec37f8..9e3222fd69f9 100644
661 +--- a/drivers/net/ethernet/renesas/ravb_ptp.c
662 ++++ b/drivers/net/ethernet/renesas/ravb_ptp.c
663 +@@ -319,7 +319,7 @@ void ravb_ptp_interrupt(struct net_device *ndev)
664 + }
665 + }
666 +
667 +- ravb_write(ndev, ~gis, GIS);
668 ++ ravb_write(ndev, ~(gis | GIS_RESERVED), GIS);
669 + }
670 +
671 + void ravb_ptp_init(struct net_device *ndev, struct platform_device *pdev)
672 +diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
673 +index 04148438d7ec..5ed28111c3c3 100644
674 +--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
675 ++++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
676 +@@ -3342,11 +3342,10 @@ static int ibmvscsis_probe(struct vio_dev *vdev,
677 + vscsi->dds.window[LOCAL].liobn,
678 + vscsi->dds.window[REMOTE].liobn);
679 +
680 +- strcpy(vscsi->eye, "VSCSI ");
681 +- strncat(vscsi->eye, vdev->name, MAX_EYE);
682 ++ snprintf(vscsi->eye, sizeof(vscsi->eye), "VSCSI %s", vdev->name);
683 +
684 + vscsi->dds.unit_id = vdev->unit_address;
685 +- strncpy(vscsi->dds.partition_name, partition_name,
686 ++ strscpy(vscsi->dds.partition_name, partition_name,
687 + sizeof(vscsi->dds.partition_name));
688 + vscsi->dds.partition_num = partition_number;
689 +
690 +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
691 +index f8b6bf56c48e..ab999c4444b8 100644
692 +--- a/drivers/scsi/sd.c
693 ++++ b/drivers/scsi/sd.c
694 +@@ -1158,7 +1158,8 @@ static int sd_init_command(struct scsi_cmnd *cmd)
695 + case REQ_OP_WRITE:
696 + return sd_setup_read_write_cmnd(cmd);
697 + default:
698 +- BUG();
699 ++ WARN_ON_ONCE(1);
700 ++ return BLKPREP_KILL;
701 + }
702 + }
703 +
704 +diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
705 +index e0cd1e4c8892..2f151e0aa6da 100644
706 +--- a/drivers/usb/gadget/function/u_serial.c
707 ++++ b/drivers/usb/gadget/function/u_serial.c
708 +@@ -537,7 +537,7 @@ static void gs_rx_push(unsigned long _port)
709 + }
710 +
711 + /* push data to (open) tty */
712 +- if (req->actual) {
713 ++ if (req->actual && tty) {
714 + char *packet = req->buf;
715 + unsigned size = req->actual;
716 + unsigned n;
717 +diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
718 +index 43e27d8ec770..567a6c7af677 100644
719 +--- a/fs/ext4/ext4.h
720 ++++ b/fs/ext4/ext4.h
721 +@@ -3038,9 +3038,6 @@ extern struct buffer_head *ext4_get_first_inline_block(struct inode *inode,
722 + extern int ext4_inline_data_fiemap(struct inode *inode,
723 + struct fiemap_extent_info *fieinfo,
724 + int *has_inline, __u64 start, __u64 len);
725 +-extern int ext4_try_to_evict_inline_data(handle_t *handle,
726 +- struct inode *inode,
727 +- int needed);
728 + extern void ext4_inline_data_truncate(struct inode *inode, int *has_inline);
729 +
730 + extern int ext4_convert_inline_data(struct inode *inode);
731 +diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
732 +index 211539a7adfc..6779a9f1de3b 100644
733 +--- a/fs/ext4/inline.c
734 ++++ b/fs/ext4/inline.c
735 +@@ -889,11 +889,11 @@ retry_journal:
736 + flags |= AOP_FLAG_NOFS;
737 +
738 + if (ret == -ENOSPC) {
739 ++ ext4_journal_stop(handle);
740 + ret = ext4_da_convert_inline_data_to_extent(mapping,
741 + inode,
742 + flags,
743 + fsdata);
744 +- ext4_journal_stop(handle);
745 + if (ret == -ENOSPC &&
746 + ext4_should_retry_alloc(inode->i_sb, &retries))
747 + goto retry_journal;
748 +@@ -1865,42 +1865,6 @@ out:
749 + return (error < 0 ? error : 0);
750 + }
751 +
752 +-/*
753 +- * Called during xattr set, and if we can sparse space 'needed',
754 +- * just create the extent tree evict the data to the outer block.
755 +- *
756 +- * We use jbd2 instead of page cache to move data to the 1st block
757 +- * so that the whole transaction can be committed as a whole and
758 +- * the data isn't lost because of the delayed page cache write.
759 +- */
760 +-int ext4_try_to_evict_inline_data(handle_t *handle,
761 +- struct inode *inode,
762 +- int needed)
763 +-{
764 +- int error;
765 +- struct ext4_xattr_entry *entry;
766 +- struct ext4_inode *raw_inode;
767 +- struct ext4_iloc iloc;
768 +-
769 +- error = ext4_get_inode_loc(inode, &iloc);
770 +- if (error)
771 +- return error;
772 +-
773 +- raw_inode = ext4_raw_inode(&iloc);
774 +- entry = (struct ext4_xattr_entry *)((void *)raw_inode +
775 +- EXT4_I(inode)->i_inline_off);
776 +- if (EXT4_XATTR_LEN(entry->e_name_len) +
777 +- EXT4_XATTR_SIZE(le32_to_cpu(entry->e_value_size)) < needed) {
778 +- error = -ENOSPC;
779 +- goto out;
780 +- }
781 +-
782 +- error = ext4_convert_inline_data_nolock(handle, inode, &iloc);
783 +-out:
784 +- brelse(iloc.bh);
785 +- return error;
786 +-}
787 +-
788 + void ext4_inline_data_truncate(struct inode *inode, int *has_inline)
789 + {
790 + handle_t *handle;
791 +diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
792 +index 7d6da09e637b..38385bcb9148 100644
793 +--- a/fs/ext4/xattr.c
794 ++++ b/fs/ext4/xattr.c
795 +@@ -1086,22 +1086,8 @@ int ext4_xattr_ibody_inline_set(handle_t *handle, struct inode *inode,
796 + if (EXT4_I(inode)->i_extra_isize == 0)
797 + return -ENOSPC;
798 + error = ext4_xattr_set_entry(i, s, inode);
799 +- if (error) {
800 +- if (error == -ENOSPC &&
801 +- ext4_has_inline_data(inode)) {
802 +- error = ext4_try_to_evict_inline_data(handle, inode,
803 +- EXT4_XATTR_LEN(strlen(i->name) +
804 +- EXT4_XATTR_SIZE(i->value_len)));
805 +- if (error)
806 +- return error;
807 +- error = ext4_xattr_ibody_find(inode, i, is);
808 +- if (error)
809 +- return error;
810 +- error = ext4_xattr_set_entry(i, s, inode);
811 +- }
812 +- if (error)
813 +- return error;
814 +- }
815 ++ if (error)
816 ++ return error;
817 + header = IHDR(inode, ext4_raw_inode(&is->iloc));
818 + if (!IS_LAST_ENTRY(s->first)) {
819 + header->h_magic = cpu_to_le32(EXT4_XATTR_MAGIC);
820 +diff --git a/fs/proc/stat.c b/fs/proc/stat.c
821 +index d700c42b3572..44475a44cbf1 100644
822 +--- a/fs/proc/stat.c
823 ++++ b/fs/proc/stat.c
824 +@@ -21,23 +21,23 @@
825 +
826 + #ifdef arch_idle_time
827 +
828 +-static cputime64_t get_idle_time(int cpu)
829 ++static u64 get_idle_time(int cpu)
830 + {
831 +- cputime64_t idle;
832 ++ u64 idle;
833 +
834 + idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
835 + if (cpu_online(cpu) && !nr_iowait_cpu(cpu))
836 +- idle += arch_idle_time(cpu);
837 ++ idle += cputime_to_nsecs(arch_idle_time(cpu));
838 + return idle;
839 + }
840 +
841 +-static cputime64_t get_iowait_time(int cpu)
842 ++static u64 get_iowait_time(int cpu)
843 + {
844 +- cputime64_t iowait;
845 ++ u64 iowait;
846 +
847 + iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
848 + if (cpu_online(cpu) && nr_iowait_cpu(cpu))
849 +- iowait += arch_idle_time(cpu);
850 ++ iowait += cputime_to_nsecs(arch_idle_time(cpu));
851 + return iowait;
852 + }
853 +
854 +@@ -45,32 +45,32 @@ static cputime64_t get_iowait_time(int cpu)
855 +
856 + static u64 get_idle_time(int cpu)
857 + {
858 +- u64 idle, idle_time = -1ULL;
859 ++ u64 idle, idle_usecs = -1ULL;
860 +
861 + if (cpu_online(cpu))
862 +- idle_time = get_cpu_idle_time_us(cpu, NULL);
863 ++ idle_usecs = get_cpu_idle_time_us(cpu, NULL);
864 +
865 +- if (idle_time == -1ULL)
866 ++ if (idle_usecs == -1ULL)
867 + /* !NO_HZ or cpu offline so we can rely on cpustat.idle */
868 + idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
869 + else
870 +- idle = usecs_to_cputime64(idle_time);
871 ++ idle = idle_usecs * NSEC_PER_USEC;
872 +
873 + return idle;
874 + }
875 +
876 + static u64 get_iowait_time(int cpu)
877 + {
878 +- u64 iowait, iowait_time = -1ULL;
879 ++ u64 iowait, iowait_usecs = -1ULL;
880 +
881 + if (cpu_online(cpu))
882 +- iowait_time = get_cpu_iowait_time_us(cpu, NULL);
883 ++ iowait_usecs = get_cpu_iowait_time_us(cpu, NULL);
884 +
885 +- if (iowait_time == -1ULL)
886 ++ if (iowait_usecs == -1ULL)
887 + /* !NO_HZ or cpu offline so we can rely on cpustat.iowait */
888 + iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
889 + else
890 +- iowait = usecs_to_cputime64(iowait_time);
891 ++ iowait = iowait_usecs * NSEC_PER_USEC;
892 +
893 + return iowait;
894 + }
895 +@@ -115,16 +115,16 @@ static int show_stat(struct seq_file *p, void *v)
896 + }
897 + sum += arch_irq_stat();
898 +
899 +- seq_put_decimal_ull(p, "cpu ", cputime64_to_clock_t(user));
900 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(nice));
901 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(system));
902 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(idle));
903 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(iowait));
904 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(irq));
905 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(softirq));
906 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(steal));
907 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(guest));
908 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(guest_nice));
909 ++ seq_put_decimal_ull(p, "cpu ", nsec_to_clock_t(user));
910 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(nice));
911 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(system));
912 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(idle));
913 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(iowait));
914 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(irq));
915 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(softirq));
916 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(steal));
917 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(guest));
918 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(guest_nice));
919 + seq_putc(p, '\n');
920 +
921 + for_each_online_cpu(i) {
922 +@@ -140,16 +140,16 @@ static int show_stat(struct seq_file *p, void *v)
923 + guest = kcpustat_cpu(i).cpustat[CPUTIME_GUEST];
924 + guest_nice = kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE];
925 + seq_printf(p, "cpu%d", i);
926 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(user));
927 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(nice));
928 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(system));
929 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(idle));
930 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(iowait));
931 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(irq));
932 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(softirq));
933 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(steal));
934 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(guest));
935 +- seq_put_decimal_ull(p, " ", cputime64_to_clock_t(guest_nice));
936 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(user));
937 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(nice));
938 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(system));
939 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(idle));
940 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(iowait));
941 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(irq));
942 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(softirq));
943 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(steal));
944 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(guest));
945 ++ seq_put_decimal_ull(p, " ", nsec_to_clock_t(guest_nice));
946 + seq_putc(p, '\n');
947 + }
948 + seq_put_decimal_ull(p, "intr ", (unsigned long long)sum);
949 +diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c
950 +index 33de567c25af..7981c4ffe787 100644
951 +--- a/fs/proc/uptime.c
952 ++++ b/fs/proc/uptime.c
953 +@@ -5,23 +5,20 @@
954 + #include <linux/seq_file.h>
955 + #include <linux/time.h>
956 + #include <linux/kernel_stat.h>
957 +-#include <linux/cputime.h>
958 +
959 + static int uptime_proc_show(struct seq_file *m, void *v)
960 + {
961 + struct timespec uptime;
962 + struct timespec idle;
963 +- u64 idletime;
964 + u64 nsec;
965 + u32 rem;
966 + int i;
967 +
968 +- idletime = 0;
969 ++ nsec = 0;
970 + for_each_possible_cpu(i)
971 +- idletime += (__force u64) kcpustat_cpu(i).cpustat[CPUTIME_IDLE];
972 ++ nsec += (__force u64) kcpustat_cpu(i).cpustat[CPUTIME_IDLE];
973 +
974 + get_monotonic_boottime(&uptime);
975 +- nsec = cputime64_to_jiffies64(idletime) * TICK_NSEC;
976 + idle.tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem);
977 + idle.tv_nsec = rem;
978 + seq_printf(m, "%lu.%02lu %lu.%02lu\n",
979 +diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
980 +index e35e6de633b9..9b9f65d99873 100644
981 +--- a/include/linux/huge_mm.h
982 ++++ b/include/linux/huge_mm.h
983 +@@ -22,7 +22,7 @@ extern int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
984 + unsigned char *vec);
985 + extern bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr,
986 + unsigned long new_addr, unsigned long old_end,
987 +- pmd_t *old_pmd, pmd_t *new_pmd, bool *need_flush);
988 ++ pmd_t *old_pmd, pmd_t *new_pmd);
989 + extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
990 + unsigned long addr, pgprot_t newprot,
991 + int prot_numa);
992 +diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
993 +index bc0b309c3f19..4c882791c10c 100644
994 +--- a/kernel/sched/cpuacct.c
995 ++++ b/kernel/sched/cpuacct.c
996 +@@ -297,7 +297,7 @@ static int cpuacct_stats_show(struct seq_file *sf, void *v)
997 + for (stat = 0; stat < CPUACCT_STAT_NSTATS; stat++) {
998 + seq_printf(sf, "%s %lld\n",
999 + cpuacct_stat_desc[stat],
1000 +- cputime64_to_clock_t(val[stat]));
1001 ++ nsec_to_clock_t(val[stat]));
1002 + }
1003 +
1004 + return 0;
1005 +diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
1006 +index 5ebee3164e64..448d6426fa5f 100644
1007 +--- a/kernel/sched/cputime.c
1008 ++++ b/kernel/sched/cputime.c
1009 +@@ -37,6 +37,18 @@ void disable_sched_clock_irqtime(void)
1010 + sched_clock_irqtime = 0;
1011 + }
1012 +
1013 ++static void irqtime_account_delta(struct irqtime *irqtime, u64 delta,
1014 ++ enum cpu_usage_stat idx)
1015 ++{
1016 ++ u64 *cpustat = kcpustat_this_cpu->cpustat;
1017 ++
1018 ++ u64_stats_update_begin(&irqtime->sync);
1019 ++ cpustat[idx] += delta;
1020 ++ irqtime->total += delta;
1021 ++ irqtime->tick_delta += delta;
1022 ++ u64_stats_update_end(&irqtime->sync);
1023 ++}
1024 ++
1025 + /*
1026 + * Called before incrementing preempt_count on {soft,}irq_enter
1027 + * and before decrementing preempt_count on {soft,}irq_exit.
1028 +@@ -54,7 +66,6 @@ void irqtime_account_irq(struct task_struct *curr)
1029 + delta = sched_clock_cpu(cpu) - irqtime->irq_start_time;
1030 + irqtime->irq_start_time += delta;
1031 +
1032 +- u64_stats_update_begin(&irqtime->sync);
1033 + /*
1034 + * We do not account for softirq time from ksoftirqd here.
1035 + * We want to continue accounting softirq time to ksoftirqd thread
1036 +@@ -62,48 +73,29 @@ void irqtime_account_irq(struct task_struct *curr)
1037 + * that do not consume any time, but still wants to run.
1038 + */
1039 + if (hardirq_count())
1040 +- irqtime->hardirq_time += delta;
1041 ++ irqtime_account_delta(irqtime, delta, CPUTIME_IRQ);
1042 + else if (in_serving_softirq() && curr != this_cpu_ksoftirqd())
1043 +- irqtime->softirq_time += delta;
1044 +-
1045 +- u64_stats_update_end(&irqtime->sync);
1046 ++ irqtime_account_delta(irqtime, delta, CPUTIME_SOFTIRQ);
1047 + }
1048 + EXPORT_SYMBOL_GPL(irqtime_account_irq);
1049 +
1050 +-static cputime_t irqtime_account_update(u64 irqtime, int idx, cputime_t maxtime)
1051 ++static cputime_t irqtime_tick_accounted(cputime_t maxtime)
1052 + {
1053 +- u64 *cpustat = kcpustat_this_cpu->cpustat;
1054 +- cputime_t irq_cputime;
1055 +-
1056 +- irq_cputime = nsecs_to_cputime64(irqtime) - cpustat[idx];
1057 +- irq_cputime = min(irq_cputime, maxtime);
1058 +- cpustat[idx] += irq_cputime;
1059 +-
1060 +- return irq_cputime;
1061 +-}
1062 ++ struct irqtime *irqtime = this_cpu_ptr(&cpu_irqtime);
1063 ++ cputime_t delta;
1064 +
1065 +-static cputime_t irqtime_account_hi_update(cputime_t maxtime)
1066 +-{
1067 +- return irqtime_account_update(__this_cpu_read(cpu_irqtime.hardirq_time),
1068 +- CPUTIME_IRQ, maxtime);
1069 +-}
1070 ++ delta = nsecs_to_cputime(irqtime->tick_delta);
1071 ++ delta = min(delta, maxtime);
1072 ++ irqtime->tick_delta -= cputime_to_nsecs(delta);
1073 +
1074 +-static cputime_t irqtime_account_si_update(cputime_t maxtime)
1075 +-{
1076 +- return irqtime_account_update(__this_cpu_read(cpu_irqtime.softirq_time),
1077 +- CPUTIME_SOFTIRQ, maxtime);
1078 ++ return delta;
1079 + }
1080 +
1081 + #else /* CONFIG_IRQ_TIME_ACCOUNTING */
1082 +
1083 + #define sched_clock_irqtime (0)
1084 +
1085 +-static cputime_t irqtime_account_hi_update(cputime_t dummy)
1086 +-{
1087 +- return 0;
1088 +-}
1089 +-
1090 +-static cputime_t irqtime_account_si_update(cputime_t dummy)
1091 ++static cputime_t irqtime_tick_accounted(cputime_t dummy)
1092 + {
1093 + return 0;
1094 + }
1095 +@@ -143,7 +135,7 @@ void account_user_time(struct task_struct *p, cputime_t cputime,
1096 + index = (task_nice(p) > 0) ? CPUTIME_NICE : CPUTIME_USER;
1097 +
1098 + /* Add user time to cpustat. */
1099 +- task_group_account_field(p, index, (__force u64) cputime);
1100 ++ task_group_account_field(p, index, cputime_to_nsecs(cputime));
1101 +
1102 + /* Account for user time used */
1103 + acct_account_cputime(p);
1104 +@@ -168,11 +160,11 @@ static void account_guest_time(struct task_struct *p, cputime_t cputime,
1105 +
1106 + /* Add guest time to cpustat. */
1107 + if (task_nice(p) > 0) {
1108 +- cpustat[CPUTIME_NICE] += (__force u64) cputime;
1109 +- cpustat[CPUTIME_GUEST_NICE] += (__force u64) cputime;
1110 ++ cpustat[CPUTIME_NICE] += cputime_to_nsecs(cputime);
1111 ++ cpustat[CPUTIME_GUEST_NICE] += cputime_to_nsecs(cputime);
1112 + } else {
1113 +- cpustat[CPUTIME_USER] += (__force u64) cputime;
1114 +- cpustat[CPUTIME_GUEST] += (__force u64) cputime;
1115 ++ cpustat[CPUTIME_USER] += cputime_to_nsecs(cputime);
1116 ++ cpustat[CPUTIME_GUEST] += cputime_to_nsecs(cputime);
1117 + }
1118 + }
1119 +
1120 +@@ -193,7 +185,7 @@ void __account_system_time(struct task_struct *p, cputime_t cputime,
1121 + account_group_system_time(p, cputime);
1122 +
1123 + /* Add system time to cpustat. */
1124 +- task_group_account_field(p, index, (__force u64) cputime);
1125 ++ task_group_account_field(p, index, cputime_to_nsecs(cputime));
1126 +
1127 + /* Account for system time used */
1128 + acct_account_cputime(p);
1129 +@@ -234,7 +226,7 @@ void account_steal_time(cputime_t cputime)
1130 + {
1131 + u64 *cpustat = kcpustat_this_cpu->cpustat;
1132 +
1133 +- cpustat[CPUTIME_STEAL] += (__force u64) cputime;
1134 ++ cpustat[CPUTIME_STEAL] += cputime_to_nsecs(cputime);
1135 + }
1136 +
1137 + /*
1138 +@@ -247,9 +239,9 @@ void account_idle_time(cputime_t cputime)
1139 + struct rq *rq = this_rq();
1140 +
1141 + if (atomic_read(&rq->nr_iowait) > 0)
1142 +- cpustat[CPUTIME_IOWAIT] += (__force u64) cputime;
1143 ++ cpustat[CPUTIME_IOWAIT] += cputime_to_nsecs(cputime);
1144 + else
1145 +- cpustat[CPUTIME_IDLE] += (__force u64) cputime;
1146 ++ cpustat[CPUTIME_IDLE] += cputime_to_nsecs(cputime);
1147 + }
1148 +
1149 + /*
1150 +@@ -290,10 +282,7 @@ static inline cputime_t account_other_time(cputime_t max)
1151 + accounted = steal_account_process_time(max);
1152 +
1153 + if (accounted < max)
1154 +- accounted += irqtime_account_hi_update(max - accounted);
1155 +-
1156 +- if (accounted < max)
1157 +- accounted += irqtime_account_si_update(max - accounted);
1158 ++ accounted += irqtime_tick_accounted(max - accounted);
1159 +
1160 + return accounted;
1161 + }
1162 +diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
1163 +index f564a1d2c9d5..923cc35e8490 100644
1164 +--- a/kernel/sched/sched.h
1165 ++++ b/kernel/sched/sched.h
1166 +@@ -4,6 +4,7 @@
1167 + #include <linux/sched/rt.h>
1168 + #include <linux/u64_stats_sync.h>
1169 + #include <linux/sched/deadline.h>
1170 ++#include <linux/kernel_stat.h>
1171 + #include <linux/binfmts.h>
1172 + #include <linux/mutex.h>
1173 + #include <linux/spinlock.h>
1174 +@@ -1742,14 +1743,19 @@ static inline void nohz_balance_exit_idle(unsigned int cpu) { }
1175 +
1176 + #ifdef CONFIG_IRQ_TIME_ACCOUNTING
1177 + struct irqtime {
1178 +- u64 hardirq_time;
1179 +- u64 softirq_time;
1180 ++ u64 total;
1181 ++ u64 tick_delta;
1182 + u64 irq_start_time;
1183 + struct u64_stats_sync sync;
1184 + };
1185 +
1186 + DECLARE_PER_CPU(struct irqtime, cpu_irqtime);
1187 +
1188 ++/*
1189 ++ * Returns the irqtime minus the softirq time computed by ksoftirqd.
1190 ++ * Otherwise ksoftirqd's sum_exec_runtime is substracted its own runtime
1191 ++ * and never move forward.
1192 ++ */
1193 + static inline u64 irq_time_read(int cpu)
1194 + {
1195 + struct irqtime *irqtime = &per_cpu(cpu_irqtime, cpu);
1196 +@@ -1758,7 +1764,7 @@ static inline u64 irq_time_read(int cpu)
1197 +
1198 + do {
1199 + seq = __u64_stats_fetch_begin(&irqtime->sync);
1200 +- total = irqtime->softirq_time + irqtime->hardirq_time;
1201 ++ total = irqtime->total;
1202 + } while (__u64_stats_fetch_retry(&irqtime->sync, seq));
1203 +
1204 + return total;
1205 +diff --git a/mm/huge_memory.c b/mm/huge_memory.c
1206 +index e4c6c3edaf6a..9f7bba700e4e 100644
1207 +--- a/mm/huge_memory.c
1208 ++++ b/mm/huge_memory.c
1209 +@@ -1445,7 +1445,7 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
1210 +
1211 + bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr,
1212 + unsigned long new_addr, unsigned long old_end,
1213 +- pmd_t *old_pmd, pmd_t *new_pmd, bool *need_flush)
1214 ++ pmd_t *old_pmd, pmd_t *new_pmd)
1215 + {
1216 + spinlock_t *old_ptl, *new_ptl;
1217 + pmd_t pmd;
1218 +@@ -1476,7 +1476,7 @@ bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr,
1219 + if (new_ptl != old_ptl)
1220 + spin_lock_nested(new_ptl, SINGLE_DEPTH_NESTING);
1221 + pmd = pmdp_huge_get_and_clear(mm, old_addr, old_pmd);
1222 +- if (pmd_present(pmd) && pmd_dirty(pmd))
1223 ++ if (pmd_present(pmd))
1224 + force_flush = true;
1225 + VM_BUG_ON(!pmd_none(*new_pmd));
1226 +
1227 +@@ -1487,12 +1487,10 @@ bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr,
1228 + pgtable_trans_huge_deposit(mm, new_pmd, pgtable);
1229 + }
1230 + set_pmd_at(mm, new_addr, new_pmd, pmd_mksoft_dirty(pmd));
1231 +- if (new_ptl != old_ptl)
1232 +- spin_unlock(new_ptl);
1233 + if (force_flush)
1234 + flush_tlb_range(vma, old_addr, old_addr + PMD_SIZE);
1235 +- else
1236 +- *need_flush = true;
1237 ++ if (new_ptl != old_ptl)
1238 ++ spin_unlock(new_ptl);
1239 + spin_unlock(old_ptl);
1240 + return true;
1241 + }
1242 +diff --git a/mm/mremap.c b/mm/mremap.c
1243 +index 15976716dd40..9e6035969d7b 100644
1244 +--- a/mm/mremap.c
1245 ++++ b/mm/mremap.c
1246 +@@ -104,7 +104,7 @@ static pte_t move_soft_dirty_pte(pte_t pte)
1247 + static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd,
1248 + unsigned long old_addr, unsigned long old_end,
1249 + struct vm_area_struct *new_vma, pmd_t *new_pmd,
1250 +- unsigned long new_addr, bool need_rmap_locks, bool *need_flush)
1251 ++ unsigned long new_addr, bool need_rmap_locks)
1252 + {
1253 + struct mm_struct *mm = vma->vm_mm;
1254 + pte_t *old_pte, *new_pte, pte;
1255 +@@ -152,15 +152,17 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd,
1256 +
1257 + pte = ptep_get_and_clear(mm, old_addr, old_pte);
1258 + /*
1259 +- * If we are remapping a dirty PTE, make sure
1260 ++ * If we are remapping a valid PTE, make sure
1261 + * to flush TLB before we drop the PTL for the
1262 +- * old PTE or we may race with page_mkclean().
1263 ++ * PTE.
1264 + *
1265 +- * This check has to be done after we removed the
1266 +- * old PTE from page tables or another thread may
1267 +- * dirty it after the check and before the removal.
1268 ++ * NOTE! Both old and new PTL matter: the old one
1269 ++ * for racing with page_mkclean(), the new one to
1270 ++ * make sure the physical page stays valid until
1271 ++ * the TLB entry for the old mapping has been
1272 ++ * flushed.
1273 + */
1274 +- if (pte_present(pte) && pte_dirty(pte))
1275 ++ if (pte_present(pte))
1276 + force_flush = true;
1277 + pte = move_pte(pte, new_vma->vm_page_prot, old_addr, new_addr);
1278 + pte = move_soft_dirty_pte(pte);
1279 +@@ -168,13 +170,11 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd,
1280 + }
1281 +
1282 + arch_leave_lazy_mmu_mode();
1283 ++ if (force_flush)
1284 ++ flush_tlb_range(vma, old_end - len, old_end);
1285 + if (new_ptl != old_ptl)
1286 + spin_unlock(new_ptl);
1287 + pte_unmap(new_pte - 1);
1288 +- if (force_flush)
1289 +- flush_tlb_range(vma, old_end - len, old_end);
1290 +- else
1291 +- *need_flush = true;
1292 + pte_unmap_unlock(old_pte - 1, old_ptl);
1293 + if (need_rmap_locks)
1294 + drop_rmap_locks(vma);
1295 +@@ -189,7 +189,6 @@ unsigned long move_page_tables(struct vm_area_struct *vma,
1296 + {
1297 + unsigned long extent, next, old_end;
1298 + pmd_t *old_pmd, *new_pmd;
1299 +- bool need_flush = false;
1300 + unsigned long mmun_start; /* For mmu_notifiers */
1301 + unsigned long mmun_end; /* For mmu_notifiers */
1302 +
1303 +@@ -220,8 +219,7 @@ unsigned long move_page_tables(struct vm_area_struct *vma,
1304 + if (need_rmap_locks)
1305 + take_rmap_locks(vma);
1306 + moved = move_huge_pmd(vma, old_addr, new_addr,
1307 +- old_end, old_pmd, new_pmd,
1308 +- &need_flush);
1309 ++ old_end, old_pmd, new_pmd);
1310 + if (need_rmap_locks)
1311 + drop_rmap_locks(vma);
1312 + if (moved)
1313 +@@ -239,10 +237,8 @@ unsigned long move_page_tables(struct vm_area_struct *vma,
1314 + if (extent > LATENCY_LIMIT)
1315 + extent = LATENCY_LIMIT;
1316 + move_ptes(vma, old_pmd, old_addr, old_addr + extent, new_vma,
1317 +- new_pmd, new_addr, need_rmap_locks, &need_flush);
1318 ++ new_pmd, new_addr, need_rmap_locks);
1319 + }
1320 +- if (need_flush)
1321 +- flush_tlb_range(vma, old_end-len, old_addr);
1322 +
1323 + mmu_notifier_invalidate_range_end(vma->vm_mm, mmun_start, mmun_end);
1324 +
1325 +diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
1326 +index ee08540ce503..5d79004de25c 100644
1327 +--- a/net/batman-adv/bat_v_elp.c
1328 ++++ b/net/batman-adv/bat_v_elp.c
1329 +@@ -243,6 +243,7 @@ static void batadv_v_elp_periodic_work(struct work_struct *work)
1330 + struct batadv_priv *bat_priv;
1331 + struct sk_buff *skb;
1332 + u32 elp_interval;
1333 ++ bool ret;
1334 +
1335 + bat_v = container_of(work, struct batadv_hard_iface_bat_v, elp_wq.work);
1336 + hard_iface = container_of(bat_v, struct batadv_hard_iface, bat_v);
1337 +@@ -304,8 +305,11 @@ static void batadv_v_elp_periodic_work(struct work_struct *work)
1338 + * may sleep and that is not allowed in an rcu protected
1339 + * context. Therefore schedule a task for that.
1340 + */
1341 +- queue_work(batadv_event_workqueue,
1342 +- &hardif_neigh->bat_v.metric_work);
1343 ++ ret = queue_work(batadv_event_workqueue,
1344 ++ &hardif_neigh->bat_v.metric_work);
1345 ++
1346 ++ if (!ret)
1347 ++ batadv_hardif_neigh_put(hardif_neigh);
1348 + }
1349 + rcu_read_unlock();
1350 +
1351 +diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
1352 +index 582e27698bf0..8b6f654bc85d 100644
1353 +--- a/net/batman-adv/bridge_loop_avoidance.c
1354 ++++ b/net/batman-adv/bridge_loop_avoidance.c
1355 +@@ -1767,6 +1767,7 @@ batadv_bla_loopdetect_check(struct batadv_priv *bat_priv, struct sk_buff *skb,
1356 + {
1357 + struct batadv_bla_backbone_gw *backbone_gw;
1358 + struct ethhdr *ethhdr;
1359 ++ bool ret;
1360 +
1361 + ethhdr = eth_hdr(skb);
1362 +
1363 +@@ -1790,8 +1791,13 @@ batadv_bla_loopdetect_check(struct batadv_priv *bat_priv, struct sk_buff *skb,
1364 + if (unlikely(!backbone_gw))
1365 + return true;
1366 +
1367 +- queue_work(batadv_event_workqueue, &backbone_gw->report_work);
1368 +- /* backbone_gw is unreferenced in the report work function function */
1369 ++ ret = queue_work(batadv_event_workqueue, &backbone_gw->report_work);
1370 ++
1371 ++ /* backbone_gw is unreferenced in the report work function function
1372 ++ * if queue_work() call was successful
1373 ++ */
1374 ++ if (!ret)
1375 ++ batadv_backbone_gw_put(backbone_gw);
1376 +
1377 + return true;
1378 + }
1379 +diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c
1380 +index e3baf697a35c..a7b5cf08d363 100644
1381 +--- a/net/batman-adv/network-coding.c
1382 ++++ b/net/batman-adv/network-coding.c
1383 +@@ -845,16 +845,27 @@ batadv_nc_get_nc_node(struct batadv_priv *bat_priv,
1384 + spinlock_t *lock; /* Used to lock list selected by "int in_coding" */
1385 + struct list_head *list;
1386 +
1387 ++ /* Select ingoing or outgoing coding node */
1388 ++ if (in_coding) {
1389 ++ lock = &orig_neigh_node->in_coding_list_lock;
1390 ++ list = &orig_neigh_node->in_coding_list;
1391 ++ } else {
1392 ++ lock = &orig_neigh_node->out_coding_list_lock;
1393 ++ list = &orig_neigh_node->out_coding_list;
1394 ++ }
1395 ++
1396 ++ spin_lock_bh(lock);
1397 ++
1398 + /* Check if nc_node is already added */
1399 + nc_node = batadv_nc_find_nc_node(orig_node, orig_neigh_node, in_coding);
1400 +
1401 + /* Node found */
1402 + if (nc_node)
1403 +- return nc_node;
1404 ++ goto unlock;
1405 +
1406 + nc_node = kzalloc(sizeof(*nc_node), GFP_ATOMIC);
1407 + if (!nc_node)
1408 +- return NULL;
1409 ++ goto unlock;
1410 +
1411 + /* Initialize nc_node */
1412 + INIT_LIST_HEAD(&nc_node->list);
1413 +@@ -863,22 +874,14 @@ batadv_nc_get_nc_node(struct batadv_priv *bat_priv,
1414 + kref_get(&orig_neigh_node->refcount);
1415 + nc_node->orig_node = orig_neigh_node;
1416 +
1417 +- /* Select ingoing or outgoing coding node */
1418 +- if (in_coding) {
1419 +- lock = &orig_neigh_node->in_coding_list_lock;
1420 +- list = &orig_neigh_node->in_coding_list;
1421 +- } else {
1422 +- lock = &orig_neigh_node->out_coding_list_lock;
1423 +- list = &orig_neigh_node->out_coding_list;
1424 +- }
1425 +-
1426 + batadv_dbg(BATADV_DBG_NC, bat_priv, "Adding nc_node %pM -> %pM\n",
1427 + nc_node->addr, nc_node->orig_node->orig);
1428 +
1429 + /* Add nc_node to orig_node */
1430 +- spin_lock_bh(lock);
1431 + kref_get(&nc_node->refcount);
1432 + list_add_tail_rcu(&nc_node->list, list);
1433 ++
1434 ++unlock:
1435 + spin_unlock_bh(lock);
1436 +
1437 + return nc_node;
1438 +diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
1439 +index 84c1b388d9ed..05bc176decf0 100644
1440 +--- a/net/batman-adv/soft-interface.c
1441 ++++ b/net/batman-adv/soft-interface.c
1442 +@@ -565,15 +565,20 @@ int batadv_softif_create_vlan(struct batadv_priv *bat_priv, unsigned short vid)
1443 + struct batadv_softif_vlan *vlan;
1444 + int err;
1445 +
1446 ++ spin_lock_bh(&bat_priv->softif_vlan_list_lock);
1447 ++
1448 + vlan = batadv_softif_vlan_get(bat_priv, vid);
1449 + if (vlan) {
1450 + batadv_softif_vlan_put(vlan);
1451 ++ spin_unlock_bh(&bat_priv->softif_vlan_list_lock);
1452 + return -EEXIST;
1453 + }
1454 +
1455 + vlan = kzalloc(sizeof(*vlan), GFP_ATOMIC);
1456 +- if (!vlan)
1457 ++ if (!vlan) {
1458 ++ spin_unlock_bh(&bat_priv->softif_vlan_list_lock);
1459 + return -ENOMEM;
1460 ++ }
1461 +
1462 + vlan->bat_priv = bat_priv;
1463 + vlan->vid = vid;
1464 +@@ -581,17 +586,23 @@ int batadv_softif_create_vlan(struct batadv_priv *bat_priv, unsigned short vid)
1465 +
1466 + atomic_set(&vlan->ap_isolation, 0);
1467 +
1468 ++ kref_get(&vlan->refcount);
1469 ++ hlist_add_head_rcu(&vlan->list, &bat_priv->softif_vlan_list);
1470 ++ spin_unlock_bh(&bat_priv->softif_vlan_list_lock);
1471 ++
1472 ++ /* batadv_sysfs_add_vlan cannot be in the spinlock section due to the
1473 ++ * sleeping behavior of the sysfs functions and the fs_reclaim lock
1474 ++ */
1475 + err = batadv_sysfs_add_vlan(bat_priv->soft_iface, vlan);
1476 + if (err) {
1477 +- kfree(vlan);
1478 ++ /* ref for the function */
1479 ++ batadv_softif_vlan_put(vlan);
1480 ++
1481 ++ /* ref for the list */
1482 ++ batadv_softif_vlan_put(vlan);
1483 + return err;
1484 + }
1485 +
1486 +- spin_lock_bh(&bat_priv->softif_vlan_list_lock);
1487 +- kref_get(&vlan->refcount);
1488 +- hlist_add_head_rcu(&vlan->list, &bat_priv->softif_vlan_list);
1489 +- spin_unlock_bh(&bat_priv->softif_vlan_list_lock);
1490 +-
1491 + /* add a new TT local entry. This one will be marked with the NOPURGE
1492 + * flag
1493 + */
1494 +diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c
1495 +index 02d96f224c60..31d7e239a1fd 100644
1496 +--- a/net/batman-adv/sysfs.c
1497 ++++ b/net/batman-adv/sysfs.c
1498 +@@ -187,7 +187,8 @@ ssize_t batadv_store_##_name(struct kobject *kobj, \
1499 + \
1500 + return __batadv_store_uint_attr(buff, count, _min, _max, \
1501 + _post_func, attr, \
1502 +- &bat_priv->_var, net_dev); \
1503 ++ &bat_priv->_var, net_dev, \
1504 ++ NULL); \
1505 + }
1506 +
1507 + #define BATADV_ATTR_SIF_SHOW_UINT(_name, _var) \
1508 +@@ -261,7 +262,9 @@ ssize_t batadv_store_##_name(struct kobject *kobj, \
1509 + \
1510 + length = __batadv_store_uint_attr(buff, count, _min, _max, \
1511 + _post_func, attr, \
1512 +- &hard_iface->_var, net_dev); \
1513 ++ &hard_iface->_var, \
1514 ++ hard_iface->soft_iface, \
1515 ++ net_dev); \
1516 + \
1517 + batadv_hardif_put(hard_iface); \
1518 + return length; \
1519 +@@ -355,10 +358,12 @@ __batadv_store_bool_attr(char *buff, size_t count,
1520 +
1521 + static int batadv_store_uint_attr(const char *buff, size_t count,
1522 + struct net_device *net_dev,
1523 ++ struct net_device *slave_dev,
1524 + const char *attr_name,
1525 + unsigned int min, unsigned int max,
1526 + atomic_t *attr)
1527 + {
1528 ++ char ifname[IFNAMSIZ + 3] = "";
1529 + unsigned long uint_val;
1530 + int ret;
1531 +
1532 +@@ -384,8 +389,11 @@ static int batadv_store_uint_attr(const char *buff, size_t count,
1533 + if (atomic_read(attr) == uint_val)
1534 + return count;
1535 +
1536 +- batadv_info(net_dev, "%s: Changing from: %i to: %lu\n",
1537 +- attr_name, atomic_read(attr), uint_val);
1538 ++ if (slave_dev)
1539 ++ snprintf(ifname, sizeof(ifname), "%s: ", slave_dev->name);
1540 ++
1541 ++ batadv_info(net_dev, "%s: %sChanging from: %i to: %lu\n",
1542 ++ attr_name, ifname, atomic_read(attr), uint_val);
1543 +
1544 + atomic_set(attr, uint_val);
1545 + return count;
1546 +@@ -396,12 +404,13 @@ static ssize_t __batadv_store_uint_attr(const char *buff, size_t count,
1547 + void (*post_func)(struct net_device *),
1548 + const struct attribute *attr,
1549 + atomic_t *attr_store,
1550 +- struct net_device *net_dev)
1551 ++ struct net_device *net_dev,
1552 ++ struct net_device *slave_dev)
1553 + {
1554 + int ret;
1555 +
1556 +- ret = batadv_store_uint_attr(buff, count, net_dev, attr->name, min, max,
1557 +- attr_store);
1558 ++ ret = batadv_store_uint_attr(buff, count, net_dev, slave_dev,
1559 ++ attr->name, min, max, attr_store);
1560 + if (post_func && ret)
1561 + post_func(net_dev);
1562 +
1563 +@@ -570,7 +579,7 @@ static ssize_t batadv_store_gw_sel_class(struct kobject *kobj,
1564 + return __batadv_store_uint_attr(buff, count, 1, BATADV_TQ_MAX_VALUE,
1565 + batadv_post_gw_reselect, attr,
1566 + &bat_priv->gw.sel_class,
1567 +- bat_priv->soft_iface);
1568 ++ bat_priv->soft_iface, NULL);
1569 + }
1570 +
1571 + static ssize_t batadv_show_gw_bwidth(struct kobject *kobj,
1572 +@@ -1084,8 +1093,9 @@ static ssize_t batadv_store_throughput_override(struct kobject *kobj,
1573 + if (old_tp_override == tp_override)
1574 + goto out;
1575 +
1576 +- batadv_info(net_dev, "%s: Changing from: %u.%u MBit to: %u.%u MBit\n",
1577 +- "throughput_override",
1578 ++ batadv_info(hard_iface->soft_iface,
1579 ++ "%s: %s: Changing from: %u.%u MBit to: %u.%u MBit\n",
1580 ++ "throughput_override", net_dev->name,
1581 + old_tp_override / 10, old_tp_override % 10,
1582 + tp_override / 10, tp_override % 10);
1583 +
1584 +diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
1585 +index 0dc85eb1cb7a..b9f9a310eb78 100644
1586 +--- a/net/batman-adv/translation-table.c
1587 ++++ b/net/batman-adv/translation-table.c
1588 +@@ -1550,6 +1550,8 @@ batadv_tt_global_orig_entry_add(struct batadv_tt_global_entry *tt_global,
1589 + {
1590 + struct batadv_tt_orig_list_entry *orig_entry;
1591 +
1592 ++ spin_lock_bh(&tt_global->list_lock);
1593 ++
1594 + orig_entry = batadv_tt_global_orig_entry_find(tt_global, orig_node);
1595 + if (orig_entry) {
1596 + /* refresh the ttvn: the current value could be a bogus one that
1597 +@@ -1570,16 +1572,16 @@ batadv_tt_global_orig_entry_add(struct batadv_tt_global_entry *tt_global,
1598 + orig_entry->ttvn = ttvn;
1599 + kref_init(&orig_entry->refcount);
1600 +
1601 +- spin_lock_bh(&tt_global->list_lock);
1602 + kref_get(&orig_entry->refcount);
1603 + hlist_add_head_rcu(&orig_entry->list,
1604 + &tt_global->orig_list);
1605 +- spin_unlock_bh(&tt_global->list_lock);
1606 + atomic_inc(&tt_global->orig_list_count);
1607 +
1608 + out:
1609 + if (orig_entry)
1610 + batadv_tt_orig_list_entry_put(orig_entry);
1611 ++
1612 ++ spin_unlock_bh(&tt_global->list_lock);
1613 + }
1614 +
1615 + /**
1616 +diff --git a/net/batman-adv/tvlv.c b/net/batman-adv/tvlv.c
1617 +index 77654f055f24..8e91a26e9b00 100644
1618 +--- a/net/batman-adv/tvlv.c
1619 ++++ b/net/batman-adv/tvlv.c
1620 +@@ -528,15 +528,20 @@ void batadv_tvlv_handler_register(struct batadv_priv *bat_priv,
1621 + {
1622 + struct batadv_tvlv_handler *tvlv_handler;
1623 +
1624 ++ spin_lock_bh(&bat_priv->tvlv.handler_list_lock);
1625 ++
1626 + tvlv_handler = batadv_tvlv_handler_get(bat_priv, type, version);
1627 + if (tvlv_handler) {
1628 ++ spin_unlock_bh(&bat_priv->tvlv.handler_list_lock);
1629 + batadv_tvlv_handler_put(tvlv_handler);
1630 + return;
1631 + }
1632 +
1633 + tvlv_handler = kzalloc(sizeof(*tvlv_handler), GFP_ATOMIC);
1634 +- if (!tvlv_handler)
1635 ++ if (!tvlv_handler) {
1636 ++ spin_unlock_bh(&bat_priv->tvlv.handler_list_lock);
1637 + return;
1638 ++ }
1639 +
1640 + tvlv_handler->ogm_handler = optr;
1641 + tvlv_handler->unicast_handler = uptr;
1642 +@@ -546,7 +551,6 @@ void batadv_tvlv_handler_register(struct batadv_priv *bat_priv,
1643 + kref_init(&tvlv_handler->refcount);
1644 + INIT_HLIST_NODE(&tvlv_handler->list);
1645 +
1646 +- spin_lock_bh(&bat_priv->tvlv.handler_list_lock);
1647 + kref_get(&tvlv_handler->refcount);
1648 + hlist_add_head_rcu(&tvlv_handler->list, &bat_priv->tvlv.handler_list);
1649 + spin_unlock_bh(&bat_priv->tvlv.handler_list_lock);
1650 +diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c
1651 +index 624d6e4dcd5c..51b0d832bd07 100644
1652 +--- a/net/netfilter/nf_nat_core.c
1653 ++++ b/net/netfilter/nf_nat_core.c
1654 +@@ -421,7 +421,7 @@ nf_nat_setup_info(struct nf_conn *ct,
1655 + else
1656 + ct->status |= IPS_DST_NAT;
1657 +
1658 +- if (nfct_help(ct))
1659 ++ if (nfct_help(ct) && !nfct_seqadj(ct))
1660 + if (!nfct_seqadj_ext_add(ct))
1661 + return NF_DROP;
1662 + }