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, 21 Oct 2017 20:15:17
Message-Id: 1508616901.8f54decd9aeae66b06a1e63ab9fd02605b94f345.mpagano@gentoo
1 commit: 8f54decd9aeae66b06a1e63ab9fd02605b94f345
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 21 20:15:01 2017 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 21 20:15:01 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=8f54decd
7
8 Linux patch 4.9.58
9
10 0000_README | 4 +
11 1057_linux-4.9.58.patch | 1491 +++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 1495 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index 2263df0..76bcc9e 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -271,6 +271,10 @@ Patch: 1056_linux-4.9.57.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.9.57
21
22 +Patch: 1057_linux-4.9.58.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.9.58
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/1057_linux-4.9.58.patch b/1057_linux-4.9.58.patch
31 new file mode 100644
32 index 0000000..6bda02c
33 --- /dev/null
34 +++ b/1057_linux-4.9.58.patch
35 @@ -0,0 +1,1491 @@
36 +diff --git a/Makefile b/Makefile
37 +index d5a2ab9b3291..32686667bb7e 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,6 +1,6 @@
41 + VERSION = 4
42 + PATCHLEVEL = 9
43 +-SUBLEVEL = 57
44 ++SUBLEVEL = 58
45 + EXTRAVERSION =
46 + NAME = Roaring Lionus
47 +
48 +diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h
49 +index ddd1c918103b..c5d351786416 100644
50 +--- a/arch/mips/include/asm/irq.h
51 ++++ b/arch/mips/include/asm/irq.h
52 +@@ -18,7 +18,7 @@
53 + #include <irq.h>
54 +
55 + #define IRQ_STACK_SIZE THREAD_SIZE
56 +-#define IRQ_STACK_START (IRQ_STACK_SIZE - sizeof(unsigned long))
57 ++#define IRQ_STACK_START (IRQ_STACK_SIZE - 16)
58 +
59 + extern void *irq_stack[NR_CPUS];
60 +
61 +diff --git a/arch/powerpc/perf/isa207-common.h b/arch/powerpc/perf/isa207-common.h
62 +index 4d0a4e5017c2..8e6dd17fe603 100644
63 +--- a/arch/powerpc/perf/isa207-common.h
64 ++++ b/arch/powerpc/perf/isa207-common.h
65 +@@ -201,6 +201,10 @@
66 + CNST_PMC_VAL(1) | CNST_PMC_VAL(2) | CNST_PMC_VAL(3) | \
67 + CNST_PMC_VAL(4) | CNST_PMC_VAL(5) | CNST_PMC_VAL(6) | CNST_NC_VAL
68 +
69 ++/*
70 ++ * Lets restrict use of PMC5 for instruction counting.
71 ++ */
72 ++#define P9_DD1_TEST_ADDER (ISA207_TEST_ADDER | CNST_PMC_VAL(5))
73 +
74 + /* Bits in MMCR1 for PowerISA v2.07 */
75 + #define MMCR1_UNIT_SHIFT(pmc) (60 - (4 * ((pmc) - 1)))
76 +diff --git a/arch/powerpc/perf/power9-pmu.c b/arch/powerpc/perf/power9-pmu.c
77 +index 8e9a81967ff8..9abcd8f65504 100644
78 +--- a/arch/powerpc/perf/power9-pmu.c
79 ++++ b/arch/powerpc/perf/power9-pmu.c
80 +@@ -295,7 +295,7 @@ static struct power_pmu power9_pmu = {
81 + .name = "POWER9",
82 + .n_counter = MAX_PMU_COUNTERS,
83 + .add_fields = ISA207_ADD_FIELDS,
84 +- .test_adder = ISA207_TEST_ADDER,
85 ++ .test_adder = P9_DD1_TEST_ADDER,
86 + .compute_mmcr = isa207_compute_mmcr,
87 + .config_bhrb = power9_config_bhrb,
88 + .bhrb_filter_map = power9_bhrb_filter_map,
89 +diff --git a/arch/sparc/include/asm/setup.h b/arch/sparc/include/asm/setup.h
90 +index be0cc1beed41..3fae200dd251 100644
91 +--- a/arch/sparc/include/asm/setup.h
92 ++++ b/arch/sparc/include/asm/setup.h
93 +@@ -59,8 +59,11 @@ extern atomic_t dcpage_flushes;
94 + extern atomic_t dcpage_flushes_xcall;
95 +
96 + extern int sysctl_tsb_ratio;
97 +-#endif
98 +
99 ++#ifdef CONFIG_SERIAL_SUNHV
100 ++void sunhv_migrate_hvcons_irq(int cpu);
101 ++#endif
102 ++#endif
103 + void sun_do_break(void);
104 + extern int stop_a_enabled;
105 + extern int scons_pwroff;
106 +diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
107 +index 2deb89ef1d5f..ca7cb8e57ab0 100644
108 +--- a/arch/sparc/kernel/smp_64.c
109 ++++ b/arch/sparc/kernel/smp_64.c
110 +@@ -1465,8 +1465,12 @@ void smp_send_stop(void)
111 + int cpu;
112 +
113 + if (tlb_type == hypervisor) {
114 ++ int this_cpu = smp_processor_id();
115 ++#ifdef CONFIG_SERIAL_SUNHV
116 ++ sunhv_migrate_hvcons_irq(this_cpu);
117 ++#endif
118 + for_each_online_cpu(cpu) {
119 +- if (cpu == smp_processor_id())
120 ++ if (cpu == this_cpu)
121 + continue;
122 + #ifdef CONFIG_SUN_LDOMS
123 + if (ldom_domaining_enabled) {
124 +diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
125 +index 9a324fc8bed8..3e27ded6ac65 100644
126 +--- a/arch/x86/mm/init_64.c
127 ++++ b/arch/x86/mm/init_64.c
128 +@@ -689,7 +689,7 @@ static void __meminit free_pagetable(struct page *page, int order)
129 + if (PageReserved(page)) {
130 + __ClearPageReserved(page);
131 +
132 +- magic = (unsigned long)page->lru.next;
133 ++ magic = (unsigned long)page->freelist;
134 + if (magic == SECTION_INFO || magic == MIX_SECTION_INFO) {
135 + while (nr_pages--)
136 + put_page_bootmem(page++);
137 +diff --git a/block/bsg-lib.c b/block/bsg-lib.c
138 +index 341b8d858e67..650f427d915b 100644
139 +--- a/block/bsg-lib.c
140 ++++ b/block/bsg-lib.c
141 +@@ -147,6 +147,7 @@ static int bsg_create_job(struct device *dev, struct request *req)
142 + failjob_rls_rqst_payload:
143 + kfree(job->request_payload.sg_list);
144 + failjob_rls_job:
145 ++ kfree(job);
146 + return -ENOMEM;
147 + }
148 +
149 +diff --git a/crypto/Kconfig b/crypto/Kconfig
150 +index 84d71482bf08..fa98ad7edb60 100644
151 +--- a/crypto/Kconfig
152 ++++ b/crypto/Kconfig
153 +@@ -360,6 +360,7 @@ config CRYPTO_XTS
154 + select CRYPTO_BLKCIPHER
155 + select CRYPTO_MANAGER
156 + select CRYPTO_GF128MUL
157 ++ select CRYPTO_ECB
158 + help
159 + XTS: IEEE1619/D16 narrow block cipher use with aes-xts-plain,
160 + key size 256, 384 or 512 bits. This implementation currently
161 +diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
162 +index d02f2c14df32..c738baeb6d45 100644
163 +--- a/drivers/bluetooth/btmrvl_sdio.c
164 ++++ b/drivers/bluetooth/btmrvl_sdio.c
165 +@@ -1682,8 +1682,12 @@ static int btmrvl_sdio_resume(struct device *dev)
166 + /* Disable platform specific wakeup interrupt */
167 + if (card->plt_wake_cfg && card->plt_wake_cfg->irq_bt >= 0) {
168 + disable_irq_wake(card->plt_wake_cfg->irq_bt);
169 +- if (!card->plt_wake_cfg->wake_by_bt)
170 +- disable_irq(card->plt_wake_cfg->irq_bt);
171 ++ disable_irq(card->plt_wake_cfg->irq_bt);
172 ++ if (card->plt_wake_cfg->wake_by_bt)
173 ++ /* Undo our disable, since interrupt handler already
174 ++ * did this.
175 ++ */
176 ++ enable_irq(card->plt_wake_cfg->irq_bt);
177 + }
178 +
179 + return 0;
180 +diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
181 +index d89b8afe23b6..bc3917d6015a 100644
182 +--- a/drivers/cpufreq/Kconfig.arm
183 ++++ b/drivers/cpufreq/Kconfig.arm
184 +@@ -244,7 +244,7 @@ config ARM_PXA2xx_CPUFREQ
185 +
186 + config ACPI_CPPC_CPUFREQ
187 + tristate "CPUFreq driver based on the ACPI CPPC spec"
188 +- depends on ACPI
189 ++ depends on ACPI_PROCESSOR
190 + select ACPI_CPPC_LIB
191 + default n
192 + help
193 +diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c
194 +index daaac2c79ca7..7db692ed3dea 100644
195 +--- a/drivers/edac/mce_amd.c
196 ++++ b/drivers/edac/mce_amd.c
197 +@@ -981,20 +981,19 @@ int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data)
198 + pr_cont("]: 0x%016llx\n", m->status);
199 +
200 + if (m->status & MCI_STATUS_ADDRV)
201 +- pr_emerg(HW_ERR "Error Addr: 0x%016llx", m->addr);
202 ++ pr_emerg(HW_ERR "Error Addr: 0x%016llx\n", m->addr);
203 +
204 + if (boot_cpu_has(X86_FEATURE_SMCA)) {
205 ++ pr_emerg(HW_ERR "IPID: 0x%016llx", m->ipid);
206 ++
207 + if (m->status & MCI_STATUS_SYNDV)
208 + pr_cont(", Syndrome: 0x%016llx", m->synd);
209 +
210 +- pr_cont(", IPID: 0x%016llx", m->ipid);
211 +-
212 + pr_cont("\n");
213 +
214 + decode_smca_errors(m);
215 + goto err_code;
216 +- } else
217 +- pr_cont("\n");
218 ++ }
219 +
220 + if (!fam_ops)
221 + goto err_code;
222 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
223 +index 264899df9bfc..05ff98b43c50 100644
224 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
225 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
226 +@@ -491,6 +491,9 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
227 + case TTM_PL_TT:
228 + break;
229 + case TTM_PL_VRAM:
230 ++ if (mem->start == AMDGPU_BO_INVALID_OFFSET)
231 ++ return -EINVAL;
232 ++
233 + mem->bus.offset = mem->start << PAGE_SHIFT;
234 + /* check if it's visible */
235 + if ((mem->bus.offset + mem->bus.size) > adev->mc.visible_vram_size)
236 +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
237 +index 6584d505460c..133f89600279 100644
238 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
239 ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
240 +@@ -1129,7 +1129,7 @@ gf100_gr_trap_intr(struct gf100_gr *gr)
241 + if (trap & 0x00000008) {
242 + u32 stat = nvkm_rd32(device, 0x408030);
243 +
244 +- nvkm_snprintbf(error, sizeof(error), gf100_m2mf_error,
245 ++ nvkm_snprintbf(error, sizeof(error), gf100_ccache_error,
246 + stat & 0x3fffffff);
247 + nvkm_error(subdev, "CCACHE %08x [%s]\n", stat, error);
248 + nvkm_wr32(device, 0x408030, 0xc0000000);
249 +diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
250 +index 0b86c6173e07..c925a690cb32 100644
251 +--- a/drivers/i2c/busses/i2c-at91.c
252 ++++ b/drivers/i2c/busses/i2c-at91.c
253 +@@ -1180,6 +1180,7 @@ static int at91_twi_suspend_noirq(struct device *dev)
254 +
255 + static int at91_twi_resume_noirq(struct device *dev)
256 + {
257 ++ struct at91_twi_dev *twi_dev = dev_get_drvdata(dev);
258 + int ret;
259 +
260 + if (!pm_runtime_status_suspended(dev)) {
261 +@@ -1191,6 +1192,8 @@ static int at91_twi_resume_noirq(struct device *dev)
262 + pm_runtime_mark_last_busy(dev);
263 + pm_request_autosuspend(dev);
264 +
265 ++ at91_init_twi_bus(twi_dev);
266 ++
267 + return 0;
268 + }
269 +
270 +diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
271 +index 0a6beb3d99cb..56cf5907a5f0 100644
272 +--- a/drivers/iio/adc/xilinx-xadc-core.c
273 ++++ b/drivers/iio/adc/xilinx-xadc-core.c
274 +@@ -1208,7 +1208,7 @@ static int xadc_probe(struct platform_device *pdev)
275 +
276 + ret = xadc->ops->setup(pdev, indio_dev, irq);
277 + if (ret)
278 +- goto err_free_samplerate_trigger;
279 ++ goto err_clk_disable_unprepare;
280 +
281 + ret = request_irq(irq, xadc->ops->interrupt_handler, 0,
282 + dev_name(&pdev->dev), indio_dev);
283 +@@ -1268,6 +1268,8 @@ static int xadc_probe(struct platform_device *pdev)
284 +
285 + err_free_irq:
286 + free_irq(irq, indio_dev);
287 ++err_clk_disable_unprepare:
288 ++ clk_disable_unprepare(xadc->clk);
289 + err_free_samplerate_trigger:
290 + if (xadc->ops->flags & XADC_FLAGS_BUFFERED)
291 + iio_trigger_free(xadc->samplerate_trigger);
292 +@@ -1277,8 +1279,6 @@ static int xadc_probe(struct platform_device *pdev)
293 + err_triggered_buffer_cleanup:
294 + if (xadc->ops->flags & XADC_FLAGS_BUFFERED)
295 + iio_triggered_buffer_cleanup(indio_dev);
296 +-err_clk_disable_unprepare:
297 +- clk_disable_unprepare(xadc->clk);
298 + err_device_free:
299 + kfree(indio_dev->channels);
300 +
301 +diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c
302 +index 34cfd341b6d6..a3dd27b1305d 100644
303 +--- a/drivers/infiniband/hw/hfi1/init.c
304 ++++ b/drivers/infiniband/hw/hfi1/init.c
305 +@@ -297,14 +297,15 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt,
306 + * The resulting value will be rounded down to the closest
307 + * multiple of dd->rcv_entries.group_size.
308 + */
309 +- rcd->egrbufs.buffers = kcalloc(rcd->egrbufs.count,
310 +- sizeof(*rcd->egrbufs.buffers),
311 +- GFP_KERNEL);
312 ++ rcd->egrbufs.buffers = kzalloc_node(
313 ++ rcd->egrbufs.count * sizeof(*rcd->egrbufs.buffers),
314 ++ GFP_KERNEL, numa);
315 + if (!rcd->egrbufs.buffers)
316 + goto bail;
317 +- rcd->egrbufs.rcvtids = kcalloc(rcd->egrbufs.count,
318 +- sizeof(*rcd->egrbufs.rcvtids),
319 +- GFP_KERNEL);
320 ++ rcd->egrbufs.rcvtids = kzalloc_node(
321 ++ rcd->egrbufs.count *
322 ++ sizeof(*rcd->egrbufs.rcvtids),
323 ++ GFP_KERNEL, numa);
324 + if (!rcd->egrbufs.rcvtids)
325 + goto bail;
326 + rcd->egrbufs.size = eager_buffer_size;
327 +@@ -322,8 +323,8 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt,
328 + rcd->egrbufs.rcvtid_size = HFI1_MAX_EAGER_BUFFER_SIZE;
329 +
330 + if (ctxt < dd->first_user_ctxt) { /* N/A for PSM contexts */
331 +- rcd->opstats = kzalloc(sizeof(*rcd->opstats),
332 +- GFP_KERNEL);
333 ++ rcd->opstats = kzalloc_node(sizeof(*rcd->opstats),
334 ++ GFP_KERNEL, numa);
335 + if (!rcd->opstats)
336 + goto bail;
337 + }
338 +diff --git a/drivers/infiniband/hw/hfi1/pcie.c b/drivers/infiniband/hw/hfi1/pcie.c
339 +index 4ac8f330c5cb..335613a1a46a 100644
340 +--- a/drivers/infiniband/hw/hfi1/pcie.c
341 ++++ b/drivers/infiniband/hw/hfi1/pcie.c
342 +@@ -673,12 +673,12 @@ MODULE_PARM_DESC(pcie_retry, "Driver will try this many times to reach requested
343 +
344 + #define UNSET_PSET 255
345 + #define DEFAULT_DISCRETE_PSET 2 /* discrete HFI */
346 +-#define DEFAULT_MCP_PSET 4 /* MCP HFI */
347 ++#define DEFAULT_MCP_PSET 6 /* MCP HFI */
348 + static uint pcie_pset = UNSET_PSET;
349 + module_param(pcie_pset, uint, S_IRUGO);
350 + MODULE_PARM_DESC(pcie_pset, "PCIe Eq Pset value to use, range is 0-10");
351 +
352 +-static uint pcie_ctle = 1; /* discrete on, integrated off */
353 ++static uint pcie_ctle = 3; /* discrete on, integrated on */
354 + module_param(pcie_ctle, uint, S_IRUGO);
355 + MODULE_PARM_DESC(pcie_ctle, "PCIe static CTLE mode, bit 0 - discrete on/off, bit 1 - integrated on/off");
356 +
357 +diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
358 +index 1eef56a89b1f..05bbf171df37 100644
359 +--- a/drivers/irqchip/irq-crossbar.c
360 ++++ b/drivers/irqchip/irq-crossbar.c
361 +@@ -198,7 +198,8 @@ static const struct irq_domain_ops crossbar_domain_ops = {
362 +
363 + static int __init crossbar_of_init(struct device_node *node)
364 + {
365 +- int i, size, max = 0, reserved = 0, entry;
366 ++ int i, size, reserved = 0;
367 ++ u32 max = 0, entry;
368 + const __be32 *irqsr;
369 + int ret = -ENOMEM;
370 +
371 +diff --git a/drivers/md/linear.c b/drivers/md/linear.c
372 +index b0c0aef92a37..12abf69d568a 100644
373 +--- a/drivers/md/linear.c
374 ++++ b/drivers/md/linear.c
375 +@@ -223,7 +223,8 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev)
376 + * oldconf until no one uses it anymore.
377 + */
378 + mddev_suspend(mddev);
379 +- oldconf = rcu_dereference(mddev->private);
380 ++ oldconf = rcu_dereference_protected(mddev->private,
381 ++ lockdep_is_held(&mddev->reconfig_mutex));
382 + mddev->raid_disks++;
383 + WARN_ONCE(mddev->raid_disks != newconf->raid_disks,
384 + "copied raid_disks doesn't match mddev->raid_disks");
385 +diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
386 +index 0a4e81a253fb..ed6fae964ec5 100644
387 +--- a/drivers/net/ethernet/marvell/mvpp2.c
388 ++++ b/drivers/net/ethernet/marvell/mvpp2.c
389 +@@ -4413,13 +4413,12 @@ static void mvpp2_txq_bufs_free(struct mvpp2_port *port,
390 + struct mvpp2_txq_pcpu_buf *tx_buf =
391 + txq_pcpu->buffs + txq_pcpu->txq_get_index;
392 +
393 +- mvpp2_txq_inc_get(txq_pcpu);
394 +-
395 + dma_unmap_single(port->dev->dev.parent, tx_buf->phys,
396 + tx_buf->size, DMA_TO_DEVICE);
397 +- if (!tx_buf->skb)
398 +- continue;
399 +- dev_kfree_skb_any(tx_buf->skb);
400 ++ if (tx_buf->skb)
401 ++ dev_kfree_skb_any(tx_buf->skb);
402 ++
403 ++ mvpp2_txq_inc_get(txq_pcpu);
404 + }
405 + }
406 +
407 +diff --git a/drivers/net/ethernet/mellanox/mlx4/en_clock.c b/drivers/net/ethernet/mellanox/mlx4/en_clock.c
408 +index a5fc46bbcbe2..d4d97ca12e83 100644
409 +--- a/drivers/net/ethernet/mellanox/mlx4/en_clock.c
410 ++++ b/drivers/net/ethernet/mellanox/mlx4/en_clock.c
411 +@@ -88,10 +88,17 @@ void mlx4_en_remove_timestamp(struct mlx4_en_dev *mdev)
412 + }
413 + }
414 +
415 ++#define MLX4_EN_WRAP_AROUND_SEC 10UL
416 ++/* By scheduling the overflow check every 5 seconds, we have a reasonably
417 ++ * good chance we wont miss a wrap around.
418 ++ * TOTO: Use a timer instead of a work queue to increase the guarantee.
419 ++ */
420 ++#define MLX4_EN_OVERFLOW_PERIOD (MLX4_EN_WRAP_AROUND_SEC * HZ / 2)
421 ++
422 + void mlx4_en_ptp_overflow_check(struct mlx4_en_dev *mdev)
423 + {
424 + bool timeout = time_is_before_jiffies(mdev->last_overflow_check +
425 +- mdev->overflow_period);
426 ++ MLX4_EN_OVERFLOW_PERIOD);
427 + unsigned long flags;
428 +
429 + if (timeout) {
430 +@@ -236,7 +243,6 @@ static const struct ptp_clock_info mlx4_en_ptp_clock_info = {
431 + .enable = mlx4_en_phc_enable,
432 + };
433 +
434 +-#define MLX4_EN_WRAP_AROUND_SEC 10ULL
435 +
436 + /* This function calculates the max shift that enables the user range
437 + * of MLX4_EN_WRAP_AROUND_SEC values in the cycles register.
438 +@@ -261,7 +267,6 @@ void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev)
439 + {
440 + struct mlx4_dev *dev = mdev->dev;
441 + unsigned long flags;
442 +- u64 ns, zero = 0;
443 +
444 + /* mlx4_en_init_timestamp is called for each netdev.
445 + * mdev->ptp_clock is common for all ports, skip initialization if
446 +@@ -285,13 +290,6 @@ void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev)
447 + ktime_to_ns(ktime_get_real()));
448 + write_unlock_irqrestore(&mdev->clock_lock, flags);
449 +
450 +- /* Calculate period in seconds to call the overflow watchdog - to make
451 +- * sure counter is checked at least once every wrap around.
452 +- */
453 +- ns = cyclecounter_cyc2ns(&mdev->cycles, mdev->cycles.mask, zero, &zero);
454 +- do_div(ns, NSEC_PER_SEC / 2 / HZ);
455 +- mdev->overflow_period = ns;
456 +-
457 + /* Configure the PHC */
458 + mdev->ptp_clock_info = mlx4_en_ptp_clock_info;
459 + snprintf(mdev->ptp_clock_info.name, 16, "mlx4 ptp");
460 +diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
461 +index ba652d8a2b93..727122de7df0 100644
462 +--- a/drivers/net/ethernet/mellanox/mlx4/main.c
463 ++++ b/drivers/net/ethernet/mellanox/mlx4/main.c
464 +@@ -841,8 +841,6 @@ static int mlx4_slave_cap(struct mlx4_dev *dev)
465 + return -ENOSYS;
466 + }
467 +
468 +- mlx4_log_num_mgm_entry_size = hca_param.log_mc_entry_sz;
469 +-
470 + dev->caps.hca_core_clock = hca_param.hca_core_clock;
471 +
472 + memset(&dev_cap, 0, sizeof(dev_cap));
473 +diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
474 +index a3528dd1e72e..df0f39611c5e 100644
475 +--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
476 ++++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
477 +@@ -419,7 +419,6 @@ struct mlx4_en_dev {
478 + struct cyclecounter cycles;
479 + struct timecounter clock;
480 + unsigned long last_overflow_check;
481 +- unsigned long overflow_period;
482 + struct ptp_clock *ptp_clock;
483 + struct ptp_clock_info ptp_clock_info;
484 + struct notifier_block nb;
485 +diff --git a/drivers/net/ethernet/qlogic/qed/qed.h b/drivers/net/ethernet/qlogic/qed/qed.h
486 +index 653bb5735f0c..433f8be57847 100644
487 +--- a/drivers/net/ethernet/qlogic/qed/qed.h
488 ++++ b/drivers/net/ethernet/qlogic/qed/qed.h
489 +@@ -642,7 +642,9 @@ static inline u8 qed_concrete_to_sw_fid(struct qed_dev *cdev,
490 + #define OOO_LB_TC 9
491 +
492 + int qed_configure_vport_wfq(struct qed_dev *cdev, u16 vp_id, u32 rate);
493 +-void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev, u32 min_pf_rate);
494 ++void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev,
495 ++ struct qed_ptt *p_ptt,
496 ++ u32 min_pf_rate);
497 +
498 + void qed_clean_wfq_db(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
499 + #define QED_LEADING_HWFN(dev) (&dev->hwfns[0])
500 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c
501 +index edae5fc5fccd..afe5e57d9acb 100644
502 +--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c
503 ++++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c
504 +@@ -877,7 +877,7 @@ qed_hw_init_pf_doorbell_bar(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
505 + /* Either EDPM is mandatory, or we are attempting to allocate a
506 + * WID per CPU.
507 + */
508 +- n_cpus = num_active_cpus();
509 ++ n_cpus = num_present_cpus();
510 + rc = qed_hw_init_dpi_size(p_hwfn, p_ptt, pwm_regsize, n_cpus);
511 + }
512 +
513 +@@ -2732,7 +2732,8 @@ int qed_configure_vport_wfq(struct qed_dev *cdev, u16 vp_id, u32 rate)
514 + }
515 +
516 + /* API to configure WFQ from mcp link change */
517 +-void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev, u32 min_pf_rate)
518 ++void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev,
519 ++ struct qed_ptt *p_ptt, u32 min_pf_rate)
520 + {
521 + int i;
522 +
523 +@@ -2746,8 +2747,7 @@ void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev, u32 min_pf_rate)
524 + for_each_hwfn(cdev, i) {
525 + struct qed_hwfn *p_hwfn = &cdev->hwfns[i];
526 +
527 +- __qed_configure_vp_wfq_on_link_change(p_hwfn,
528 +- p_hwfn->p_dpc_ptt,
529 ++ __qed_configure_vp_wfq_on_link_change(p_hwfn, p_ptt,
530 + min_pf_rate);
531 + }
532 + }
533 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net/ethernet/qlogic/qed/qed_mcp.c
534 +index bdc9ba92f6d4..8b7d2f963ee1 100644
535 +--- a/drivers/net/ethernet/qlogic/qed/qed_mcp.c
536 ++++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.c
537 +@@ -628,7 +628,8 @@ static void qed_mcp_handle_link_change(struct qed_hwfn *p_hwfn,
538 +
539 + /* Min bandwidth configuration */
540 + __qed_configure_pf_min_bandwidth(p_hwfn, p_ptt, p_link, min_bw);
541 +- qed_configure_vp_wfq_on_link_change(p_hwfn->cdev, p_link->min_pf_rate);
542 ++ qed_configure_vp_wfq_on_link_change(p_hwfn->cdev, p_ptt,
543 ++ p_link->min_pf_rate);
544 +
545 + p_link->an = !!(status & LINK_STATUS_AUTO_NEGOTIATE_ENABLED);
546 + p_link->an_complete = !!(status &
547 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_roce.c b/drivers/net/ethernet/qlogic/qed/qed_roce.c
548 +index f3a825a8f8d5..d9dcb0d1714c 100644
549 +--- a/drivers/net/ethernet/qlogic/qed/qed_roce.c
550 ++++ b/drivers/net/ethernet/qlogic/qed/qed_roce.c
551 +@@ -1766,13 +1766,13 @@ static int qed_roce_query_qp(struct qed_hwfn *p_hwfn,
552 + if (rc)
553 + goto err_resp;
554 +
555 +- dma_free_coherent(&p_hwfn->cdev->pdev->dev, sizeof(*p_resp_ramrod_res),
556 +- p_resp_ramrod_res, resp_ramrod_res_phys);
557 +-
558 + out_params->rq_psn = le32_to_cpu(p_resp_ramrod_res->psn);
559 + rq_err_state = GET_FIELD(le32_to_cpu(p_resp_ramrod_res->err_flag),
560 + ROCE_QUERY_QP_RESP_OUTPUT_PARAMS_ERROR_FLG);
561 +
562 ++ dma_free_coherent(&p_hwfn->cdev->pdev->dev, sizeof(*p_resp_ramrod_res),
563 ++ p_resp_ramrod_res, resp_ramrod_res_phys);
564 ++
565 + if (!(qp->req_offloaded)) {
566 + /* Don't send query qp for the requester */
567 + out_params->sq_psn = qp->sq_psn;
568 +@@ -1813,9 +1813,6 @@ static int qed_roce_query_qp(struct qed_hwfn *p_hwfn,
569 + if (rc)
570 + goto err_req;
571 +
572 +- dma_free_coherent(&p_hwfn->cdev->pdev->dev, sizeof(*p_req_ramrod_res),
573 +- p_req_ramrod_res, req_ramrod_res_phys);
574 +-
575 + out_params->sq_psn = le32_to_cpu(p_req_ramrod_res->psn);
576 + sq_err_state = GET_FIELD(le32_to_cpu(p_req_ramrod_res->flags),
577 + ROCE_QUERY_QP_REQ_OUTPUT_PARAMS_ERR_FLG);
578 +@@ -1823,6 +1820,9 @@ static int qed_roce_query_qp(struct qed_hwfn *p_hwfn,
579 + GET_FIELD(le32_to_cpu(p_req_ramrod_res->flags),
580 + ROCE_QUERY_QP_REQ_OUTPUT_PARAMS_SQ_DRAINING_FLG);
581 +
582 ++ dma_free_coherent(&p_hwfn->cdev->pdev->dev, sizeof(*p_req_ramrod_res),
583 ++ p_req_ramrod_res, req_ramrod_res_phys);
584 ++
585 + out_params->draining = false;
586 +
587 + if (rq_err_state)
588 +diff --git a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
589 +index 7567cc464b88..634e4149af22 100644
590 +--- a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
591 ++++ b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
592 +@@ -1221,7 +1221,7 @@ static int qede_selftest_receive_traffic(struct qede_dev *edev)
593 + struct qede_rx_queue *rxq = NULL;
594 + struct sw_rx_data *sw_rx_data;
595 + union eth_rx_cqe *cqe;
596 +- int i, rc = 0;
597 ++ int i, iter, rc = 0;
598 + u8 *data_ptr;
599 +
600 + for_each_queue(i) {
601 +@@ -1240,7 +1240,7 @@ static int qede_selftest_receive_traffic(struct qede_dev *edev)
602 + * enabled. This is because the queue 0 is configured as the default
603 + * queue and that the loopback traffic is not IP.
604 + */
605 +- for (i = 0; i < QEDE_SELFTEST_POLL_COUNT; i++) {
606 ++ for (iter = 0; iter < QEDE_SELFTEST_POLL_COUNT; iter++) {
607 + if (!qede_has_rx_work(rxq)) {
608 + usleep_range(100, 200);
609 + continue;
610 +@@ -1287,7 +1287,7 @@ static int qede_selftest_receive_traffic(struct qede_dev *edev)
611 + qed_chain_recycle_consumed(&rxq->rx_comp_ring);
612 + }
613 +
614 +- if (i == QEDE_SELFTEST_POLL_COUNT) {
615 ++ if (iter == QEDE_SELFTEST_POLL_COUNT) {
616 + DP_NOTICE(edev, "Failed to receive the traffic\n");
617 + return -1;
618 + }
619 +diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
620 +index c06932c5ecdb..d2a28a9d3209 100644
621 +--- a/drivers/net/wireless/mac80211_hwsim.c
622 ++++ b/drivers/net/wireless/mac80211_hwsim.c
623 +@@ -3046,6 +3046,7 @@ static int hwsim_register_received_nl(struct sk_buff *skb_2,
624 + static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
625 + {
626 + struct hwsim_new_radio_params param = { 0 };
627 ++ const char *hwname = NULL;
628 +
629 + param.reg_strict = info->attrs[HWSIM_ATTR_REG_STRICT_REG];
630 + param.p2p_device = info->attrs[HWSIM_ATTR_SUPPORT_P2P_DEVICE];
631 +@@ -3059,8 +3060,14 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
632 + if (info->attrs[HWSIM_ATTR_NO_VIF])
633 + param.no_vif = true;
634 +
635 +- if (info->attrs[HWSIM_ATTR_RADIO_NAME])
636 +- param.hwname = nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME]);
637 ++ if (info->attrs[HWSIM_ATTR_RADIO_NAME]) {
638 ++ hwname = kasprintf(GFP_KERNEL, "%.*s",
639 ++ nla_len(info->attrs[HWSIM_ATTR_RADIO_NAME]),
640 ++ (char *)nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME]));
641 ++ if (!hwname)
642 ++ return -ENOMEM;
643 ++ param.hwname = hwname;
644 ++ }
645 +
646 + if (info->attrs[HWSIM_ATTR_USE_CHANCTX])
647 + param.use_chanctx = true;
648 +@@ -3088,11 +3095,15 @@ static int hwsim_del_radio_nl(struct sk_buff *msg, struct genl_info *info)
649 + s64 idx = -1;
650 + const char *hwname = NULL;
651 +
652 +- if (info->attrs[HWSIM_ATTR_RADIO_ID])
653 ++ if (info->attrs[HWSIM_ATTR_RADIO_ID]) {
654 + idx = nla_get_u32(info->attrs[HWSIM_ATTR_RADIO_ID]);
655 +- else if (info->attrs[HWSIM_ATTR_RADIO_NAME])
656 +- hwname = (void *)nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME]);
657 +- else
658 ++ } else if (info->attrs[HWSIM_ATTR_RADIO_NAME]) {
659 ++ hwname = kasprintf(GFP_KERNEL, "%.*s",
660 ++ nla_len(info->attrs[HWSIM_ATTR_RADIO_NAME]),
661 ++ (char *)nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME]));
662 ++ if (!hwname)
663 ++ return -ENOMEM;
664 ++ } else
665 + return -EINVAL;
666 +
667 + spin_lock_bh(&hwsim_radio_lock);
668 +@@ -3101,7 +3112,8 @@ static int hwsim_del_radio_nl(struct sk_buff *msg, struct genl_info *info)
669 + if (data->idx != idx)
670 + continue;
671 + } else {
672 +- if (strcmp(hwname, wiphy_name(data->hw->wiphy)))
673 ++ if (!hwname ||
674 ++ strcmp(hwname, wiphy_name(data->hw->wiphy)))
675 + continue;
676 + }
677 +
678 +@@ -3112,10 +3124,12 @@ static int hwsim_del_radio_nl(struct sk_buff *msg, struct genl_info *info)
679 + spin_unlock_bh(&hwsim_radio_lock);
680 + mac80211_hwsim_del_radio(data, wiphy_name(data->hw->wiphy),
681 + info);
682 ++ kfree(hwname);
683 + return 0;
684 + }
685 + spin_unlock_bh(&hwsim_radio_lock);
686 +
687 ++ kfree(hwname);
688 + return -ENODEV;
689 + }
690 +
691 +diff --git a/drivers/net/xen-netback/hash.c b/drivers/net/xen-netback/hash.c
692 +index e8c5dddc54ba..3c4c58b9fe76 100644
693 +--- a/drivers/net/xen-netback/hash.c
694 ++++ b/drivers/net/xen-netback/hash.c
695 +@@ -39,7 +39,7 @@ static void xenvif_add_hash(struct xenvif *vif, const u8 *tag,
696 + unsigned long flags;
697 + bool found;
698 +
699 +- new = kmalloc(sizeof(*entry), GFP_KERNEL);
700 ++ new = kmalloc(sizeof(*entry), GFP_ATOMIC);
701 + if (!new)
702 + return;
703 +
704 +diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
705 +index 9faccfceb53c..9403245503de 100644
706 +--- a/drivers/regulator/core.c
707 ++++ b/drivers/regulator/core.c
708 +@@ -4507,6 +4507,16 @@ static int __init regulator_init_complete(void)
709 + if (of_have_populated_dt())
710 + has_full_constraints = true;
711 +
712 ++ /*
713 ++ * Regulators may had failed to resolve their input supplies
714 ++ * when were registered, either because the input supply was
715 ++ * not registered yet or because its parent device was not
716 ++ * bound yet. So attempt to resolve the input supplies for
717 ++ * pending regulators before trying to disable unused ones.
718 ++ */
719 ++ class_for_each_device(&regulator_class, NULL, NULL,
720 ++ regulator_register_resolve_supply);
721 ++
722 + /* If we have a full configuration then disable any regulators
723 + * we have permission to change the status for and which are
724 + * not in use or always_on. This is effectively the default
725 +diff --git a/drivers/scsi/device_handler/scsi_dh_emc.c b/drivers/scsi/device_handler/scsi_dh_emc.c
726 +index 375d81850f15..d5f6fbfa17bf 100644
727 +--- a/drivers/scsi/device_handler/scsi_dh_emc.c
728 ++++ b/drivers/scsi/device_handler/scsi_dh_emc.c
729 +@@ -461,7 +461,7 @@ static int clariion_prep_fn(struct scsi_device *sdev, struct request *req)
730 + static int clariion_std_inquiry(struct scsi_device *sdev,
731 + struct clariion_dh_data *csdev)
732 + {
733 +- int err;
734 ++ int err = SCSI_DH_OK;
735 + char *sp_model;
736 +
737 + err = send_inquiry_cmd(sdev, 0, csdev);
738 +diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
739 +index 6d459ef8c121..f72eebc71dd8 100644
740 +--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
741 ++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
742 +@@ -106,8 +106,14 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state)
743 +
744 + g_virt_to_bus_offset = virt_to_dma(dev, (void *)0);
745 +
746 +- (void)of_property_read_u32(dev->of_node, "cache-line-size",
747 ++ err = of_property_read_u32(dev->of_node, "cache-line-size",
748 + &g_cache_line_size);
749 ++
750 ++ if (err) {
751 ++ dev_err(dev, "Missing cache-line-size property\n");
752 ++ return -ENODEV;
753 ++ }
754 ++
755 + g_fragments_size = 2 * g_cache_line_size;
756 +
757 + /* Allocate space for the channels in coherent memory */
758 +diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c
759 +index efc453ef6831..ab92a1bc9666 100644
760 +--- a/drivers/target/iscsi/iscsi_target_erl0.c
761 ++++ b/drivers/target/iscsi/iscsi_target_erl0.c
762 +@@ -44,10 +44,8 @@ void iscsit_set_dataout_sequence_values(
763 + */
764 + if (cmd->unsolicited_data) {
765 + cmd->seq_start_offset = cmd->write_data_done;
766 +- cmd->seq_end_offset = (cmd->write_data_done +
767 +- ((cmd->se_cmd.data_length >
768 +- conn->sess->sess_ops->FirstBurstLength) ?
769 +- conn->sess->sess_ops->FirstBurstLength : cmd->se_cmd.data_length));
770 ++ cmd->seq_end_offset = min(cmd->se_cmd.data_length,
771 ++ conn->sess->sess_ops->FirstBurstLength);
772 + return;
773 + }
774 +
775 +diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c
776 +index 4e603d060e80..59828d819145 100644
777 +--- a/drivers/tty/serial/sunhv.c
778 ++++ b/drivers/tty/serial/sunhv.c
779 +@@ -398,6 +398,12 @@ static struct uart_driver sunhv_reg = {
780 +
781 + static struct uart_port *sunhv_port;
782 +
783 ++void sunhv_migrate_hvcons_irq(int cpu)
784 ++{
785 ++ /* Migrate hvcons irq to param cpu */
786 ++ irq_force_affinity(sunhv_port->irq, cpumask_of(cpu));
787 ++}
788 ++
789 + /* Copy 's' into the con_write_page, decoding "\n" into
790 + * "\r\n" along the way. We have to return two lengths
791 + * because the caller needs to know how much to advance
792 +diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
793 +index f92c680e3937..c61ddbf94bc7 100644
794 +--- a/drivers/usb/dwc3/gadget.c
795 ++++ b/drivers/usb/dwc3/gadget.c
796 +@@ -817,9 +817,42 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
797 + if (!node) {
798 + trb->ctrl = DWC3_TRBCTL_ISOCHRONOUS_FIRST;
799 +
800 ++ /*
801 ++ * USB Specification 2.0 Section 5.9.2 states that: "If
802 ++ * there is only a single transaction in the microframe,
803 ++ * only a DATA0 data packet PID is used. If there are
804 ++ * two transactions per microframe, DATA1 is used for
805 ++ * the first transaction data packet and DATA0 is used
806 ++ * for the second transaction data packet. If there are
807 ++ * three transactions per microframe, DATA2 is used for
808 ++ * the first transaction data packet, DATA1 is used for
809 ++ * the second, and DATA0 is used for the third."
810 ++ *
811 ++ * IOW, we should satisfy the following cases:
812 ++ *
813 ++ * 1) length <= maxpacket
814 ++ * - DATA0
815 ++ *
816 ++ * 2) maxpacket < length <= (2 * maxpacket)
817 ++ * - DATA1, DATA0
818 ++ *
819 ++ * 3) (2 * maxpacket) < length <= (3 * maxpacket)
820 ++ * - DATA2, DATA1, DATA0
821 ++ */
822 + if (speed == USB_SPEED_HIGH) {
823 + struct usb_ep *ep = &dep->endpoint;
824 +- trb->size |= DWC3_TRB_SIZE_PCM1(ep->mult - 1);
825 ++ unsigned int mult = ep->mult - 1;
826 ++ unsigned int maxp;
827 ++
828 ++ maxp = usb_endpoint_maxp(ep->desc) & 0x07ff;
829 ++
830 ++ if (length <= (2 * maxp))
831 ++ mult--;
832 ++
833 ++ if (length <= maxp)
834 ++ mult--;
835 ++
836 ++ trb->size |= DWC3_TRB_SIZE_PCM1(mult);
837 + }
838 + } else {
839 + trb->ctrl = DWC3_TRBCTL_ISOCHRONOUS;
840 +diff --git a/drivers/watchdog/kempld_wdt.c b/drivers/watchdog/kempld_wdt.c
841 +index 8e302d0e346c..3efa295ac627 100644
842 +--- a/drivers/watchdog/kempld_wdt.c
843 ++++ b/drivers/watchdog/kempld_wdt.c
844 +@@ -140,12 +140,19 @@ static int kempld_wdt_set_stage_timeout(struct kempld_wdt_data *wdt_data,
845 + unsigned int timeout)
846 + {
847 + struct kempld_device_data *pld = wdt_data->pld;
848 +- u32 prescaler = kempld_prescaler[PRESCALER_21];
849 ++ u32 prescaler;
850 + u64 stage_timeout64;
851 + u32 stage_timeout;
852 + u32 remainder;
853 + u8 stage_cfg;
854 +
855 ++#if GCC_VERSION < 40400
856 ++ /* work around a bug compiling do_div() */
857 ++ prescaler = READ_ONCE(kempld_prescaler[PRESCALER_21]);
858 ++#else
859 ++ prescaler = kempld_prescaler[PRESCALER_21];
860 ++#endif
861 ++
862 + if (!stage)
863 + return -EINVAL;
864 +
865 +diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
866 +index 71261b459863..77f9efc1f7aa 100644
867 +--- a/fs/btrfs/send.c
868 ++++ b/fs/btrfs/send.c
869 +@@ -1680,6 +1680,9 @@ static int is_inode_existent(struct send_ctx *sctx, u64 ino, u64 gen)
870 + {
871 + int ret;
872 +
873 ++ if (ino == BTRFS_FIRST_FREE_OBJECTID)
874 ++ return 1;
875 ++
876 + ret = get_cur_inode_state(sctx, ino, gen);
877 + if (ret < 0)
878 + goto out;
879 +@@ -1865,7 +1868,7 @@ static int will_overwrite_ref(struct send_ctx *sctx, u64 dir, u64 dir_gen,
880 + * not deleted and then re-created, if it was then we have no overwrite
881 + * and we can just unlink this entry.
882 + */
883 +- if (sctx->parent_root) {
884 ++ if (sctx->parent_root && dir != BTRFS_FIRST_FREE_OBJECTID) {
885 + ret = get_inode_info(sctx->parent_root, dir, NULL, &gen, NULL,
886 + NULL, NULL, NULL);
887 + if (ret < 0 && ret != -ENOENT)
888 +diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
889 +index 953275b651bc..4a6df2ce0f76 100644
890 +--- a/fs/ceph/inode.c
891 ++++ b/fs/ceph/inode.c
892 +@@ -1323,8 +1323,8 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,
893 + ceph_dir_clear_ordered(dir);
894 + dout("d_delete %p\n", dn);
895 + d_delete(dn);
896 +- } else {
897 +- if (have_lease && d_unhashed(dn))
898 ++ } else if (have_lease) {
899 ++ if (d_unhashed(dn))
900 + d_add(dn, NULL);
901 + update_dentry_lease(dn, rinfo->dlease,
902 + session,
903 +diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c
904 +index 7d752d53353a..4c9c72f26eb9 100644
905 +--- a/fs/ceph/ioctl.c
906 ++++ b/fs/ceph/ioctl.c
907 +@@ -25,7 +25,7 @@ static long ceph_ioctl_get_layout(struct file *file, void __user *arg)
908 + l.stripe_count = ci->i_layout.stripe_count;
909 + l.object_size = ci->i_layout.object_size;
910 + l.data_pool = ci->i_layout.pool_id;
911 +- l.preferred_osd = (s32)-1;
912 ++ l.preferred_osd = -1;
913 + if (copy_to_user(arg, &l, sizeof(l)))
914 + return -EFAULT;
915 + }
916 +@@ -97,7 +97,7 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
917 + nl.data_pool = ci->i_layout.pool_id;
918 +
919 + /* this is obsolete, and always -1 */
920 +- nl.preferred_osd = le64_to_cpu(-1);
921 ++ nl.preferred_osd = -1;
922 +
923 + err = __validate_layout(mdsc, &nl);
924 + if (err)
925 +diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
926 +index e3e1a80b351e..c0f52c443c34 100644
927 +--- a/fs/ceph/mds_client.c
928 ++++ b/fs/ceph/mds_client.c
929 +@@ -1782,13 +1782,18 @@ static int build_dentry_path(struct dentry *dentry,
930 + int *pfreepath)
931 + {
932 + char *path;
933 ++ struct inode *dir;
934 +
935 +- if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_NOSNAP) {
936 +- *pino = ceph_ino(d_inode(dentry->d_parent));
937 ++ rcu_read_lock();
938 ++ dir = d_inode_rcu(dentry->d_parent);
939 ++ if (dir && ceph_snap(dir) == CEPH_NOSNAP) {
940 ++ *pino = ceph_ino(dir);
941 ++ rcu_read_unlock();
942 + *ppath = dentry->d_name.name;
943 + *ppathlen = dentry->d_name.len;
944 + return 0;
945 + }
946 ++ rcu_read_unlock();
947 + path = ceph_mdsc_build_path(dentry, ppathlen, pino, 1);
948 + if (IS_ERR(path))
949 + return PTR_ERR(path);
950 +diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
951 +index 14db4b712021..99432b59c5cb 100644
952 +--- a/fs/f2fs/data.c
953 ++++ b/fs/f2fs/data.c
954 +@@ -1619,7 +1619,12 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
955 + goto fail;
956 + }
957 + repeat:
958 +- page = grab_cache_page_write_begin(mapping, index, flags);
959 ++ /*
960 ++ * Do not use grab_cache_page_write_begin() to avoid deadlock due to
961 ++ * wait_for_stable_page. Will wait that below with our IO control.
962 ++ */
963 ++ page = pagecache_get_page(mapping, index,
964 ++ FGP_LOCK | FGP_WRITE | FGP_CREAT, GFP_NOFS);
965 + if (!page) {
966 + err = -ENOMEM;
967 + goto fail;
968 +diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
969 +index 74a2b444406d..e10f61684ea4 100644
970 +--- a/fs/f2fs/segment.c
971 ++++ b/fs/f2fs/segment.c
972 +@@ -1263,7 +1263,7 @@ static int get_ssr_segment(struct f2fs_sb_info *sbi, int type)
973 + struct curseg_info *curseg = CURSEG_I(sbi, type);
974 + const struct victim_selection *v_ops = DIRTY_I(sbi)->v_ops;
975 +
976 +- if (IS_NODESEG(type) || !has_not_enough_free_secs(sbi, 0, 0))
977 ++ if (IS_NODESEG(type))
978 + return v_ops->get_victim(sbi,
979 + &(curseg)->next_segno, BG_GC, type, SSR);
980 +
981 +diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
982 +index 211dc2aed8e1..3069cd46ea66 100644
983 +--- a/fs/nfsd/nfs4callback.c
984 ++++ b/fs/nfsd/nfs4callback.c
985 +@@ -753,6 +753,14 @@ int set_callback_cred(void)
986 + return 0;
987 + }
988 +
989 ++void cleanup_callback_cred(void)
990 ++{
991 ++ if (callback_cred) {
992 ++ put_rpccred(callback_cred);
993 ++ callback_cred = NULL;
994 ++ }
995 ++}
996 ++
997 + static struct rpc_cred *get_backchannel_cred(struct nfs4_client *clp, struct rpc_clnt *client, struct nfsd4_session *ses)
998 + {
999 + if (clp->cl_minorversion == 0) {
1000 +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
1001 +index a0dee8ae9f97..d35eb077330f 100644
1002 +--- a/fs/nfsd/nfs4state.c
1003 ++++ b/fs/nfsd/nfs4state.c
1004 +@@ -7012,23 +7012,24 @@ nfs4_state_start(void)
1005 +
1006 + ret = set_callback_cred();
1007 + if (ret)
1008 +- return -ENOMEM;
1009 ++ return ret;
1010 ++
1011 + laundry_wq = alloc_workqueue("%s", WQ_UNBOUND, 0, "nfsd4");
1012 + if (laundry_wq == NULL) {
1013 + ret = -ENOMEM;
1014 +- goto out_recovery;
1015 ++ goto out_cleanup_cred;
1016 + }
1017 + ret = nfsd4_create_callback_queue();
1018 + if (ret)
1019 + goto out_free_laundry;
1020 +
1021 + set_max_delegations();
1022 +-
1023 + return 0;
1024 +
1025 + out_free_laundry:
1026 + destroy_workqueue(laundry_wq);
1027 +-out_recovery:
1028 ++out_cleanup_cred:
1029 ++ cleanup_callback_cred();
1030 + return ret;
1031 + }
1032 +
1033 +@@ -7086,6 +7087,7 @@ nfs4_state_shutdown(void)
1034 + {
1035 + destroy_workqueue(laundry_wq);
1036 + nfsd4_destroy_callback_queue();
1037 ++ cleanup_callback_cred();
1038 + }
1039 +
1040 + static void
1041 +diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
1042 +index 4516e8b7d776..005c911b34ac 100644
1043 +--- a/fs/nfsd/state.h
1044 ++++ b/fs/nfsd/state.h
1045 +@@ -615,6 +615,7 @@ extern struct nfs4_client_reclaim *nfsd4_find_reclaim_client(const char *recdir,
1046 + extern __be32 nfs4_check_open_reclaim(clientid_t *clid,
1047 + struct nfsd4_compound_state *cstate, struct nfsd_net *nn);
1048 + extern int set_callback_cred(void);
1049 ++extern void cleanup_callback_cred(void);
1050 + extern void nfsd4_probe_callback(struct nfs4_client *clp);
1051 + extern void nfsd4_probe_callback_sync(struct nfs4_client *clp);
1052 + extern void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *);
1053 +diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
1054 +index 77d1632e905d..8dce4099a6ca 100644
1055 +--- a/fs/ocfs2/dlmglue.c
1056 ++++ b/fs/ocfs2/dlmglue.c
1057 +@@ -532,6 +532,7 @@ void ocfs2_lock_res_init_once(struct ocfs2_lock_res *res)
1058 + init_waitqueue_head(&res->l_event);
1059 + INIT_LIST_HEAD(&res->l_blocked_list);
1060 + INIT_LIST_HEAD(&res->l_mask_waiters);
1061 ++ INIT_LIST_HEAD(&res->l_holders);
1062 + }
1063 +
1064 + void ocfs2_inode_lock_res_init(struct ocfs2_lock_res *res,
1065 +@@ -749,6 +750,50 @@ void ocfs2_lock_res_free(struct ocfs2_lock_res *res)
1066 + res->l_flags = 0UL;
1067 + }
1068 +
1069 ++/*
1070 ++ * Keep a list of processes who have interest in a lockres.
1071 ++ * Note: this is now only uesed for check recursive cluster locking.
1072 ++ */
1073 ++static inline void ocfs2_add_holder(struct ocfs2_lock_res *lockres,
1074 ++ struct ocfs2_lock_holder *oh)
1075 ++{
1076 ++ INIT_LIST_HEAD(&oh->oh_list);
1077 ++ oh->oh_owner_pid = get_pid(task_pid(current));
1078 ++
1079 ++ spin_lock(&lockres->l_lock);
1080 ++ list_add_tail(&oh->oh_list, &lockres->l_holders);
1081 ++ spin_unlock(&lockres->l_lock);
1082 ++}
1083 ++
1084 ++static inline void ocfs2_remove_holder(struct ocfs2_lock_res *lockres,
1085 ++ struct ocfs2_lock_holder *oh)
1086 ++{
1087 ++ spin_lock(&lockres->l_lock);
1088 ++ list_del(&oh->oh_list);
1089 ++ spin_unlock(&lockres->l_lock);
1090 ++
1091 ++ put_pid(oh->oh_owner_pid);
1092 ++}
1093 ++
1094 ++static inline int ocfs2_is_locked_by_me(struct ocfs2_lock_res *lockres)
1095 ++{
1096 ++ struct ocfs2_lock_holder *oh;
1097 ++ struct pid *pid;
1098 ++
1099 ++ /* look in the list of holders for one with the current task as owner */
1100 ++ spin_lock(&lockres->l_lock);
1101 ++ pid = task_pid(current);
1102 ++ list_for_each_entry(oh, &lockres->l_holders, oh_list) {
1103 ++ if (oh->oh_owner_pid == pid) {
1104 ++ spin_unlock(&lockres->l_lock);
1105 ++ return 1;
1106 ++ }
1107 ++ }
1108 ++ spin_unlock(&lockres->l_lock);
1109 ++
1110 ++ return 0;
1111 ++}
1112 ++
1113 + static inline void ocfs2_inc_holders(struct ocfs2_lock_res *lockres,
1114 + int level)
1115 + {
1116 +@@ -2333,8 +2378,9 @@ int ocfs2_inode_lock_full_nested(struct inode *inode,
1117 + goto getbh;
1118 + }
1119 +
1120 +- if (ocfs2_mount_local(osb))
1121 +- goto local;
1122 ++ if ((arg_flags & OCFS2_META_LOCK_GETBH) ||
1123 ++ ocfs2_mount_local(osb))
1124 ++ goto update;
1125 +
1126 + if (!(arg_flags & OCFS2_META_LOCK_RECOVERY))
1127 + ocfs2_wait_for_recovery(osb);
1128 +@@ -2363,7 +2409,7 @@ int ocfs2_inode_lock_full_nested(struct inode *inode,
1129 + if (!(arg_flags & OCFS2_META_LOCK_RECOVERY))
1130 + ocfs2_wait_for_recovery(osb);
1131 +
1132 +-local:
1133 ++update:
1134 + /*
1135 + * We only see this flag if we're being called from
1136 + * ocfs2_read_locked_inode(). It means we're locking an inode
1137 +@@ -2497,6 +2543,59 @@ void ocfs2_inode_unlock(struct inode *inode,
1138 + ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level);
1139 + }
1140 +
1141 ++/*
1142 ++ * This _tracker variantes are introduced to deal with the recursive cluster
1143 ++ * locking issue. The idea is to keep track of a lock holder on the stack of
1144 ++ * the current process. If there's a lock holder on the stack, we know the
1145 ++ * task context is already protected by cluster locking. Currently, they're
1146 ++ * used in some VFS entry routines.
1147 ++ *
1148 ++ * return < 0 on error, return == 0 if there's no lock holder on the stack
1149 ++ * before this call, return == 1 if this call would be a recursive locking.
1150 ++ */
1151 ++int ocfs2_inode_lock_tracker(struct inode *inode,
1152 ++ struct buffer_head **ret_bh,
1153 ++ int ex,
1154 ++ struct ocfs2_lock_holder *oh)
1155 ++{
1156 ++ int status;
1157 ++ int arg_flags = 0, has_locked;
1158 ++ struct ocfs2_lock_res *lockres;
1159 ++
1160 ++ lockres = &OCFS2_I(inode)->ip_inode_lockres;
1161 ++ has_locked = ocfs2_is_locked_by_me(lockres);
1162 ++ /* Just get buffer head if the cluster lock has been taken */
1163 ++ if (has_locked)
1164 ++ arg_flags = OCFS2_META_LOCK_GETBH;
1165 ++
1166 ++ if (likely(!has_locked || ret_bh)) {
1167 ++ status = ocfs2_inode_lock_full(inode, ret_bh, ex, arg_flags);
1168 ++ if (status < 0) {
1169 ++ if (status != -ENOENT)
1170 ++ mlog_errno(status);
1171 ++ return status;
1172 ++ }
1173 ++ }
1174 ++ if (!has_locked)
1175 ++ ocfs2_add_holder(lockres, oh);
1176 ++
1177 ++ return has_locked;
1178 ++}
1179 ++
1180 ++void ocfs2_inode_unlock_tracker(struct inode *inode,
1181 ++ int ex,
1182 ++ struct ocfs2_lock_holder *oh,
1183 ++ int had_lock)
1184 ++{
1185 ++ struct ocfs2_lock_res *lockres;
1186 ++
1187 ++ lockres = &OCFS2_I(inode)->ip_inode_lockres;
1188 ++ if (!had_lock) {
1189 ++ ocfs2_remove_holder(lockres, oh);
1190 ++ ocfs2_inode_unlock(inode, ex);
1191 ++ }
1192 ++}
1193 ++
1194 + int ocfs2_orphan_scan_lock(struct ocfs2_super *osb, u32 *seqno)
1195 + {
1196 + struct ocfs2_lock_res *lockres;
1197 +diff --git a/fs/ocfs2/dlmglue.h b/fs/ocfs2/dlmglue.h
1198 +index d293a22c32c5..a7fc18ba0dc1 100644
1199 +--- a/fs/ocfs2/dlmglue.h
1200 ++++ b/fs/ocfs2/dlmglue.h
1201 +@@ -70,6 +70,11 @@ struct ocfs2_orphan_scan_lvb {
1202 + __be32 lvb_os_seqno;
1203 + };
1204 +
1205 ++struct ocfs2_lock_holder {
1206 ++ struct list_head oh_list;
1207 ++ struct pid *oh_owner_pid;
1208 ++};
1209 ++
1210 + /* ocfs2_inode_lock_full() 'arg_flags' flags */
1211 + /* don't wait on recovery. */
1212 + #define OCFS2_META_LOCK_RECOVERY (0x01)
1213 +@@ -77,6 +82,8 @@ struct ocfs2_orphan_scan_lvb {
1214 + #define OCFS2_META_LOCK_NOQUEUE (0x02)
1215 + /* don't block waiting for the downconvert thread, instead return -EAGAIN */
1216 + #define OCFS2_LOCK_NONBLOCK (0x04)
1217 ++/* just get back disk inode bh if we've got cluster lock. */
1218 ++#define OCFS2_META_LOCK_GETBH (0x08)
1219 +
1220 + /* Locking subclasses of inode cluster lock */
1221 + enum {
1222 +@@ -170,4 +177,15 @@ void ocfs2_put_dlm_debug(struct ocfs2_dlm_debug *dlm_debug);
1223 +
1224 + /* To set the locking protocol on module initialization */
1225 + void ocfs2_set_locking_protocol(void);
1226 ++
1227 ++/* The _tracker pair is used to avoid cluster recursive locking */
1228 ++int ocfs2_inode_lock_tracker(struct inode *inode,
1229 ++ struct buffer_head **ret_bh,
1230 ++ int ex,
1231 ++ struct ocfs2_lock_holder *oh);
1232 ++void ocfs2_inode_unlock_tracker(struct inode *inode,
1233 ++ int ex,
1234 ++ struct ocfs2_lock_holder *oh,
1235 ++ int had_lock);
1236 ++
1237 + #endif /* DLMGLUE_H */
1238 +diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
1239 +index e63af7ddfe68..594575e380e8 100644
1240 +--- a/fs/ocfs2/ocfs2.h
1241 ++++ b/fs/ocfs2/ocfs2.h
1242 +@@ -172,6 +172,7 @@ struct ocfs2_lock_res {
1243 +
1244 + struct list_head l_blocked_list;
1245 + struct list_head l_mask_waiters;
1246 ++ struct list_head l_holders;
1247 +
1248 + unsigned long l_flags;
1249 + char l_name[OCFS2_LOCK_ID_MAX_LEN];
1250 +diff --git a/include/uapi/linux/mroute6.h b/include/uapi/linux/mroute6.h
1251 +index 5062fb5751e1..ed5721148768 100644
1252 +--- a/include/uapi/linux/mroute6.h
1253 ++++ b/include/uapi/linux/mroute6.h
1254 +@@ -4,6 +4,7 @@
1255 + #include <linux/kernel.h>
1256 + #include <linux/types.h>
1257 + #include <linux/sockios.h>
1258 ++#include <linux/in6.h> /* For struct sockaddr_in6. */
1259 +
1260 + /*
1261 + * Based on the MROUTING 3.5 defines primarily to keep
1262 +diff --git a/include/uapi/linux/rds.h b/include/uapi/linux/rds.h
1263 +index 0f9265cb2a96..7af20a136429 100644
1264 +--- a/include/uapi/linux/rds.h
1265 ++++ b/include/uapi/linux/rds.h
1266 +@@ -35,6 +35,7 @@
1267 + #define _LINUX_RDS_H
1268 +
1269 + #include <linux/types.h>
1270 ++#include <linux/socket.h> /* For __kernel_sockaddr_storage. */
1271 +
1272 + #define RDS_IB_ABI_VERSION 0x301
1273 +
1274 +@@ -223,7 +224,7 @@ struct rds_get_mr_args {
1275 + };
1276 +
1277 + struct rds_get_mr_for_dest_args {
1278 +- struct sockaddr_storage dest_addr;
1279 ++ struct __kernel_sockaddr_storage dest_addr;
1280 + struct rds_iovec vec;
1281 + uint64_t cookie_addr;
1282 + uint64_t flags;
1283 +diff --git a/init/initramfs.c b/init/initramfs.c
1284 +index b32ad7d97ac9..981f286c1d16 100644
1285 +--- a/init/initramfs.c
1286 ++++ b/init/initramfs.c
1287 +@@ -18,6 +18,7 @@
1288 + #include <linux/dirent.h>
1289 + #include <linux/syscalls.h>
1290 + #include <linux/utime.h>
1291 ++#include <linux/file.h>
1292 +
1293 + static ssize_t __init xwrite(int fd, const char *p, size_t count)
1294 + {
1295 +@@ -647,6 +648,7 @@ static int __init populate_rootfs(void)
1296 + printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err);
1297 + free_initrd();
1298 + #endif
1299 ++ flush_delayed_fput();
1300 + /*
1301 + * Try loading default modules from initramfs. This gives
1302 + * us a chance to load before device_initcalls.
1303 +diff --git a/init/main.c b/init/main.c
1304 +index ae3996ae9bac..25bac88bc66e 100644
1305 +--- a/init/main.c
1306 ++++ b/init/main.c
1307 +@@ -70,7 +70,6 @@
1308 + #include <linux/shmem_fs.h>
1309 + #include <linux/slab.h>
1310 + #include <linux/perf_event.h>
1311 +-#include <linux/file.h>
1312 + #include <linux/ptrace.h>
1313 + #include <linux/blkdev.h>
1314 + #include <linux/elevator.h>
1315 +@@ -947,8 +946,6 @@ static int __ref kernel_init(void *unused)
1316 + system_state = SYSTEM_RUNNING;
1317 + numa_default_policy();
1318 +
1319 +- flush_delayed_fput();
1320 +-
1321 + rcu_end_inkernel_boot();
1322 +
1323 + if (ramdisk_execute_command) {
1324 +diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
1325 +index 4d7ffc0a0d00..6599c7f3071d 100644
1326 +--- a/kernel/locking/lockdep.c
1327 ++++ b/kernel/locking/lockdep.c
1328 +@@ -3260,10 +3260,17 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
1329 + if (depth) {
1330 + hlock = curr->held_locks + depth - 1;
1331 + if (hlock->class_idx == class_idx && nest_lock) {
1332 +- if (hlock->references)
1333 ++ if (hlock->references) {
1334 ++ /*
1335 ++ * Check: unsigned int references:12, overflow.
1336 ++ */
1337 ++ if (DEBUG_LOCKS_WARN_ON(hlock->references == (1 << 12)-1))
1338 ++ return 0;
1339 ++
1340 + hlock->references++;
1341 +- else
1342 ++ } else {
1343 + hlock->references = 2;
1344 ++ }
1345 +
1346 + return 1;
1347 + }
1348 +diff --git a/kernel/sched/core.c b/kernel/sched/core.c
1349 +index d7dda36fbc7b..02e7ad860b52 100644
1350 +--- a/kernel/sched/core.c
1351 ++++ b/kernel/sched/core.c
1352 +@@ -1141,6 +1141,7 @@ static int __set_cpus_allowed_ptr(struct task_struct *p,
1353 + int ret = 0;
1354 +
1355 + rq = task_rq_lock(p, &rf);
1356 ++ update_rq_clock(rq);
1357 +
1358 + if (p->flags & PF_KTHREAD) {
1359 + /*
1360 +diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
1361 +index bb5ec425dfe0..eeb7f2f5698d 100644
1362 +--- a/kernel/time/hrtimer.c
1363 ++++ b/kernel/time/hrtimer.c
1364 +@@ -94,17 +94,15 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) =
1365 + };
1366 +
1367 + static const int hrtimer_clock_to_base_table[MAX_CLOCKS] = {
1368 ++ /* Make sure we catch unsupported clockids */
1369 ++ [0 ... MAX_CLOCKS - 1] = HRTIMER_MAX_CLOCK_BASES,
1370 ++
1371 + [CLOCK_REALTIME] = HRTIMER_BASE_REALTIME,
1372 + [CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC,
1373 + [CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME,
1374 + [CLOCK_TAI] = HRTIMER_BASE_TAI,
1375 + };
1376 +
1377 +-static inline int hrtimer_clockid_to_base(clockid_t clock_id)
1378 +-{
1379 +- return hrtimer_clock_to_base_table[clock_id];
1380 +-}
1381 +-
1382 + /*
1383 + * Functions and macros which are different for UP/SMP systems are kept in a
1384 + * single place
1385 +@@ -1112,6 +1110,18 @@ u64 hrtimer_get_next_event(void)
1386 + }
1387 + #endif
1388 +
1389 ++static inline int hrtimer_clockid_to_base(clockid_t clock_id)
1390 ++{
1391 ++ if (likely(clock_id < MAX_CLOCKS)) {
1392 ++ int base = hrtimer_clock_to_base_table[clock_id];
1393 ++
1394 ++ if (likely(base != HRTIMER_MAX_CLOCK_BASES))
1395 ++ return base;
1396 ++ }
1397 ++ WARN(1, "Invalid clockid %d. Using MONOTONIC\n", clock_id);
1398 ++ return HRTIMER_BASE_MONOTONIC;
1399 ++}
1400 ++
1401 + static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
1402 + enum hrtimer_mode mode)
1403 + {
1404 +diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
1405 +index ede137345a99..c9f715b2917f 100644
1406 +--- a/mm/memory_hotplug.c
1407 ++++ b/mm/memory_hotplug.c
1408 +@@ -179,7 +179,7 @@ static void release_memory_resource(struct resource *res)
1409 + void get_page_bootmem(unsigned long info, struct page *page,
1410 + unsigned long type)
1411 + {
1412 +- page->lru.next = (struct list_head *) type;
1413 ++ page->freelist = (void *)type;
1414 + SetPagePrivate(page);
1415 + set_page_private(page, info);
1416 + page_ref_inc(page);
1417 +@@ -189,11 +189,12 @@ void put_page_bootmem(struct page *page)
1418 + {
1419 + unsigned long type;
1420 +
1421 +- type = (unsigned long) page->lru.next;
1422 ++ type = (unsigned long) page->freelist;
1423 + BUG_ON(type < MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE ||
1424 + type > MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE);
1425 +
1426 + if (page_ref_dec_return(page) == 1) {
1427 ++ page->freelist = NULL;
1428 + ClearPagePrivate(page);
1429 + set_page_private(page, 0);
1430 + INIT_LIST_HEAD(&page->lru);
1431 +diff --git a/mm/slab_common.c b/mm/slab_common.c
1432 +index 5d2f24fbafc5..622f6b6ae844 100644
1433 +--- a/mm/slab_common.c
1434 ++++ b/mm/slab_common.c
1435 +@@ -255,7 +255,7 @@ struct kmem_cache *find_mergeable(size_t size, size_t align,
1436 + {
1437 + struct kmem_cache *s;
1438 +
1439 +- if (slab_nomerge || (flags & SLAB_NEVER_MERGE))
1440 ++ if (slab_nomerge)
1441 + return NULL;
1442 +
1443 + if (ctor)
1444 +@@ -266,6 +266,9 @@ struct kmem_cache *find_mergeable(size_t size, size_t align,
1445 + size = ALIGN(size, align);
1446 + flags = kmem_cache_flags(size, flags, name, NULL);
1447 +
1448 ++ if (flags & SLAB_NEVER_MERGE)
1449 ++ return NULL;
1450 ++
1451 + list_for_each_entry_reverse(s, &slab_caches, list) {
1452 + if (slab_unmergeable(s))
1453 + continue;
1454 +diff --git a/mm/sparse.c b/mm/sparse.c
1455 +index 1e168bf2779a..8c4c82e358e6 100644
1456 +--- a/mm/sparse.c
1457 ++++ b/mm/sparse.c
1458 +@@ -662,7 +662,7 @@ static void free_map_bootmem(struct page *memmap)
1459 + >> PAGE_SHIFT;
1460 +
1461 + for (i = 0; i < nr_pages; i++, page++) {
1462 +- magic = (unsigned long) page->lru.next;
1463 ++ magic = (unsigned long) page->freelist;
1464 +
1465 + BUG_ON(magic == NODE_INFO);
1466 +
1467 +diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
1468 +index b2c823ffad74..348700b424ea 100644
1469 +--- a/net/mac80211/sta_info.c
1470 ++++ b/net/mac80211/sta_info.c
1471 +@@ -688,7 +688,7 @@ static void __sta_info_recalc_tim(struct sta_info *sta, bool ignore_pending)
1472 + }
1473 +
1474 + /* No need to do anything if the driver does all */
1475 +- if (ieee80211_hw_check(&local->hw, AP_LINK_PS))
1476 ++ if (ieee80211_hw_check(&local->hw, AP_LINK_PS) && !local->ops->set_tim)
1477 + return;
1478 +
1479 + if (sta->dead)
1480 +diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
1481 +index f8dbacf66795..0d6c72d6b9ba 100644
1482 +--- a/net/netfilter/nf_conntrack_expect.c
1483 ++++ b/net/netfilter/nf_conntrack_expect.c
1484 +@@ -411,7 +411,7 @@ static inline int __nf_ct_expect_check(struct nf_conntrack_expect *expect)
1485 + struct net *net = nf_ct_exp_net(expect);
1486 + struct hlist_node *next;
1487 + unsigned int h;
1488 +- int ret = 1;
1489 ++ int ret = 0;
1490 +
1491 + if (!master_help) {
1492 + ret = -ESHUTDOWN;
1493 +@@ -461,7 +461,7 @@ int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,
1494 +
1495 + spin_lock_bh(&nf_conntrack_expect_lock);
1496 + ret = __nf_ct_expect_check(expect);
1497 +- if (ret <= 0)
1498 ++ if (ret < 0)
1499 + goto out;
1500 +
1501 + ret = nf_ct_expect_insert(expect);
1502 +diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
1503 +index 775c67818bf1..bd650222e711 100644
1504 +--- a/sound/pci/hda/patch_hdmi.c
1505 ++++ b/sound/pci/hda/patch_hdmi.c
1506 +@@ -3685,6 +3685,7 @@ HDA_CODEC_ENTRY(0x80862808, "Broadwell HDMI", patch_i915_hsw_hdmi),
1507 + HDA_CODEC_ENTRY(0x80862809, "Skylake HDMI", patch_i915_hsw_hdmi),
1508 + HDA_CODEC_ENTRY(0x8086280a, "Broxton HDMI", patch_i915_hsw_hdmi),
1509 + HDA_CODEC_ENTRY(0x8086280b, "Kabylake HDMI", patch_i915_hsw_hdmi),
1510 ++HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_hsw_hdmi),
1511 + HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi),
1512 + HDA_CODEC_ENTRY(0x80862882, "Valleyview2 HDMI", patch_i915_byt_hdmi),
1513 + HDA_CODEC_ENTRY(0x80862883, "Braswell HDMI", patch_i915_byt_hdmi),
1514 +diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig
1515 +index 05cf809cf9e1..d7013bde6f45 100644
1516 +--- a/sound/soc/mediatek/Kconfig
1517 ++++ b/sound/soc/mediatek/Kconfig
1518 +@@ -13,7 +13,7 @@ config SND_SOC_MT2701
1519 +
1520 + config SND_SOC_MT2701_CS42448
1521 + tristate "ASoc Audio driver for MT2701 with CS42448 codec"
1522 +- depends on SND_SOC_MT2701
1523 ++ depends on SND_SOC_MT2701 && I2C
1524 + select SND_SOC_CS42XX8_I2C
1525 + select SND_SOC_BT_SCO
1526 + help