Gentoo Archives: gentoo-commits

From: Alice Ferrazzi <alicef@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.11 commit in: /
Date: Fri, 16 Apr 2021 10:56:15
Message-Id: 1618570538.56e16b0340904f593455f3dd8029e5df96c5c165.alicef@gentoo
1 commit: 56e16b0340904f593455f3dd8029e5df96c5c165
2 Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
3 AuthorDate: Fri Apr 16 10:55:15 2021 +0000
4 Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 16 10:55:38 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=56e16b03
7
8 Linux patch 5.11.15
9
10 Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org>
11
12 0000_README | 4 +
13 1014_linux-5.11.15.patch | 734 +++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 738 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 190fbb1..fa29041 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -99,6 +99,10 @@ Patch: 1013_linux-5.11.14.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.11.14
23
24 +Patch: 1014_linux-5.11.15.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.11.15
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1014_linux-5.11.15.patch b/1014_linux-5.11.15.patch
33 new file mode 100644
34 index 0000000..1760c40
35 --- /dev/null
36 +++ b/1014_linux-5.11.15.patch
37 @@ -0,0 +1,734 @@
38 +diff --git a/Makefile b/Makefile
39 +index 9116941553b86..bcd8764fead98 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 5
45 + PATCHLEVEL = 11
46 +-SUBLEVEL = 14
47 ++SUBLEVEL = 15
48 + EXTRAVERSION =
49 + NAME = 💕 Valentine's Day Edition 💕
50 +
51 +diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h
52 +index 4e90c2debf70a..94d4025acc0b9 100644
53 +--- a/arch/arm64/include/asm/kvm_arm.h
54 ++++ b/arch/arm64/include/asm/kvm_arm.h
55 +@@ -278,6 +278,7 @@
56 + #define CPTR_EL2_DEFAULT CPTR_EL2_RES1
57 +
58 + /* Hyp Debug Configuration Register bits */
59 ++#define MDCR_EL2_TTRF (1 << 19)
60 + #define MDCR_EL2_TPMS (1 << 14)
61 + #define MDCR_EL2_E2PB_MASK (UL(0x3))
62 + #define MDCR_EL2_E2PB_SHIFT (UL(12))
63 +diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
64 +index b1f7bfadab9f7..be6014fe5c3ed 100644
65 +--- a/arch/arm64/kernel/cpufeature.c
66 ++++ b/arch/arm64/kernel/cpufeature.c
67 +@@ -380,7 +380,6 @@ static const struct arm64_ftr_bits ftr_id_aa64dfr0[] = {
68 + * of support.
69 + */
70 + S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_EXACT, ID_AA64DFR0_PMUVER_SHIFT, 4, 0),
71 +- ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_EXACT, ID_AA64DFR0_TRACEVER_SHIFT, 4, 0),
72 + ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_EXACT, ID_AA64DFR0_DEBUGVER_SHIFT, 4, 0x6),
73 + ARM64_FTR_END,
74 + };
75 +diff --git a/arch/arm64/kvm/debug.c b/arch/arm64/kvm/debug.c
76 +index 7a7e425616b54..dbc8905116311 100644
77 +--- a/arch/arm64/kvm/debug.c
78 ++++ b/arch/arm64/kvm/debug.c
79 +@@ -89,6 +89,7 @@ void kvm_arm_reset_debug_ptr(struct kvm_vcpu *vcpu)
80 + * - Debug ROM Address (MDCR_EL2_TDRA)
81 + * - OS related registers (MDCR_EL2_TDOSA)
82 + * - Statistical profiler (MDCR_EL2_TPMS/MDCR_EL2_E2PB)
83 ++ * - Self-hosted Trace Filter controls (MDCR_EL2_TTRF)
84 + *
85 + * Additionally, KVM only traps guest accesses to the debug registers if
86 + * the guest is not actively using them (see the KVM_ARM64_DEBUG_DIRTY
87 +@@ -112,6 +113,7 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
88 + vcpu->arch.mdcr_el2 = __this_cpu_read(mdcr_el2) & MDCR_EL2_HPMN_MASK;
89 + vcpu->arch.mdcr_el2 |= (MDCR_EL2_TPM |
90 + MDCR_EL2_TPMS |
91 ++ MDCR_EL2_TTRF |
92 + MDCR_EL2_TPMCR |
93 + MDCR_EL2_TDRA |
94 + MDCR_EL2_TDOSA);
95 +diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
96 +index 744f3209c48d0..76274a4a1d8e6 100644
97 +--- a/arch/riscv/kernel/entry.S
98 ++++ b/arch/riscv/kernel/entry.S
99 +@@ -447,6 +447,7 @@ ENDPROC(__switch_to)
100 + #endif
101 +
102 + .section ".rodata"
103 ++ .align LGREG
104 + /* Exception vector table */
105 + ENTRY(excp_vect_table)
106 + RISCV_PTR do_trap_insn_misaligned
107 +diff --git a/block/bio.c b/block/bio.c
108 +index 1f2cc1fbe283a..3209d865828a9 100644
109 +--- a/block/bio.c
110 ++++ b/block/bio.c
111 +@@ -313,7 +313,7 @@ static struct bio *__bio_chain_endio(struct bio *bio)
112 + {
113 + struct bio *parent = bio->bi_private;
114 +
115 +- if (!parent->bi_status)
116 ++ if (bio->bi_status && !parent->bi_status)
117 + parent->bi_status = bio->bi_status;
118 + bio_put(bio);
119 + return parent;
120 +diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
121 +index 5357c3a4a36fc..4f6af7a5921e1 100644
122 +--- a/drivers/block/null_blk/main.c
123 ++++ b/drivers/block/null_blk/main.c
124 +@@ -1369,10 +1369,13 @@ static blk_status_t null_handle_cmd(struct nullb_cmd *cmd, sector_t sector,
125 + }
126 +
127 + if (dev->zoned)
128 +- cmd->error = null_process_zoned_cmd(cmd, op,
129 +- sector, nr_sectors);
130 ++ sts = null_process_zoned_cmd(cmd, op, sector, nr_sectors);
131 + else
132 +- cmd->error = null_process_cmd(cmd, op, sector, nr_sectors);
133 ++ sts = null_process_cmd(cmd, op, sector, nr_sectors);
134 ++
135 ++ /* Do not overwrite errors (e.g. timeout errors) */
136 ++ if (cmd->error == BLK_STS_OK)
137 ++ cmd->error = sts;
138 +
139 + out:
140 + nullb_complete_cmd(cmd);
141 +@@ -1451,8 +1454,20 @@ static bool should_requeue_request(struct request *rq)
142 +
143 + static enum blk_eh_timer_return null_timeout_rq(struct request *rq, bool res)
144 + {
145 ++ struct nullb_cmd *cmd = blk_mq_rq_to_pdu(rq);
146 ++
147 + pr_info("rq %p timed out\n", rq);
148 +- blk_mq_complete_request(rq);
149 ++
150 ++ /*
151 ++ * If the device is marked as blocking (i.e. memory backed or zoned
152 ++ * device), the submission path may be blocked waiting for resources
153 ++ * and cause real timeouts. For these real timeouts, the submission
154 ++ * path will complete the request using blk_mq_complete_request().
155 ++ * Only fake timeouts need to execute blk_mq_complete_request() here.
156 ++ */
157 ++ cmd->error = BLK_STS_TIMEOUT;
158 ++ if (cmd->fake_timeout)
159 ++ blk_mq_complete_request(rq);
160 + return BLK_EH_DONE;
161 + }
162 +
163 +@@ -1473,6 +1488,7 @@ static blk_status_t null_queue_rq(struct blk_mq_hw_ctx *hctx,
164 + cmd->rq = bd->rq;
165 + cmd->error = BLK_STS_OK;
166 + cmd->nq = nq;
167 ++ cmd->fake_timeout = should_timeout_request(bd->rq);
168 +
169 + blk_mq_start_request(bd->rq);
170 +
171 +@@ -1489,7 +1505,7 @@ static blk_status_t null_queue_rq(struct blk_mq_hw_ctx *hctx,
172 + return BLK_STS_OK;
173 + }
174 + }
175 +- if (should_timeout_request(bd->rq))
176 ++ if (cmd->fake_timeout)
177 + return BLK_STS_OK;
178 +
179 + return null_handle_cmd(cmd, sector, nr_sectors, req_op(bd->rq));
180 +diff --git a/drivers/block/null_blk/null_blk.h b/drivers/block/null_blk/null_blk.h
181 +index 83504f3cc9d68..4876d5adb12da 100644
182 +--- a/drivers/block/null_blk/null_blk.h
183 ++++ b/drivers/block/null_blk/null_blk.h
184 +@@ -22,6 +22,7 @@ struct nullb_cmd {
185 + blk_status_t error;
186 + struct nullb_queue *nq;
187 + struct hrtimer timer;
188 ++ bool fake_timeout;
189 + };
190 +
191 + struct nullb_queue {
192 +diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
193 +index 41e2978cb1ebf..75036aaa0c639 100644
194 +--- a/drivers/gpu/drm/imx/imx-ldb.c
195 ++++ b/drivers/gpu/drm/imx/imx-ldb.c
196 +@@ -190,6 +190,11 @@ static void imx_ldb_encoder_enable(struct drm_encoder *encoder)
197 + int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN;
198 + int mux = drm_of_encoder_active_port_id(imx_ldb_ch->child, encoder);
199 +
200 ++ if (mux < 0 || mux >= ARRAY_SIZE(ldb->clk_sel)) {
201 ++ dev_warn(ldb->dev, "%s: invalid mux %d\n", __func__, mux);
202 ++ return;
203 ++ }
204 ++
205 + drm_panel_prepare(imx_ldb_ch->panel);
206 +
207 + if (dual) {
208 +@@ -248,6 +253,11 @@ imx_ldb_encoder_atomic_mode_set(struct drm_encoder *encoder,
209 + int mux = drm_of_encoder_active_port_id(imx_ldb_ch->child, encoder);
210 + u32 bus_format = imx_ldb_ch->bus_format;
211 +
212 ++ if (mux < 0 || mux >= ARRAY_SIZE(ldb->clk_sel)) {
213 ++ dev_warn(ldb->dev, "%s: invalid mux %d\n", __func__, mux);
214 ++ return;
215 ++ }
216 ++
217 + if (mode->clock > 170000) {
218 + dev_warn(ldb->dev,
219 + "%s: mode exceeds 170 MHz pixel clock\n", __func__);
220 +diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
221 +index 8eeef5017826e..134986dc2783f 100644
222 +--- a/drivers/gpu/drm/tegra/dc.c
223 ++++ b/drivers/gpu/drm/tegra/dc.c
224 +@@ -1688,6 +1688,11 @@ static void tegra_dc_commit_state(struct tegra_dc *dc,
225 + dev_err(dc->dev,
226 + "failed to set clock rate to %lu Hz\n",
227 + state->pclk);
228 ++
229 ++ err = clk_set_rate(dc->clk, state->pclk);
230 ++ if (err < 0)
231 ++ dev_err(dc->dev, "failed to set clock %pC to %lu Hz: %d\n",
232 ++ dc->clk, state->pclk, err);
233 + }
234 +
235 + DRM_DEBUG_KMS("rate: %lu, div: %u\n", clk_get_rate(dc->clk),
236 +@@ -1698,11 +1703,6 @@ static void tegra_dc_commit_state(struct tegra_dc *dc,
237 + value = SHIFT_CLK_DIVIDER(state->div) | PIXEL_CLK_DIVIDER_PCD1;
238 + tegra_dc_writel(dc, value, DC_DISP_DISP_CLOCK_CONTROL);
239 + }
240 +-
241 +- err = clk_set_rate(dc->clk, state->pclk);
242 +- if (err < 0)
243 +- dev_err(dc->dev, "failed to set clock %pC to %lu Hz: %d\n",
244 +- dc->clk, state->pclk, err);
245 + }
246 +
247 + static void tegra_dc_stop(struct tegra_dc *dc)
248 +diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
249 +index 347fb962b6c93..68a766ff0e9d2 100644
250 +--- a/drivers/gpu/host1x/bus.c
251 ++++ b/drivers/gpu/host1x/bus.c
252 +@@ -705,8 +705,9 @@ void host1x_driver_unregister(struct host1x_driver *driver)
253 + EXPORT_SYMBOL(host1x_driver_unregister);
254 +
255 + /**
256 +- * host1x_client_register() - register a host1x client
257 ++ * __host1x_client_register() - register a host1x client
258 + * @client: host1x client
259 ++ * @key: lock class key for the client-specific mutex
260 + *
261 + * Registers a host1x client with each host1x controller instance. Note that
262 + * each client will only match their parent host1x controller and will only be
263 +@@ -715,13 +716,14 @@ EXPORT_SYMBOL(host1x_driver_unregister);
264 + * device and call host1x_device_init(), which will in turn call each client's
265 + * &host1x_client_ops.init implementation.
266 + */
267 +-int host1x_client_register(struct host1x_client *client)
268 ++int __host1x_client_register(struct host1x_client *client,
269 ++ struct lock_class_key *key)
270 + {
271 + struct host1x *host1x;
272 + int err;
273 +
274 + INIT_LIST_HEAD(&client->list);
275 +- mutex_init(&client->lock);
276 ++ __mutex_init(&client->lock, "host1x client lock", key);
277 + client->usecount = 0;
278 +
279 + mutex_lock(&devices_lock);
280 +@@ -742,7 +744,7 @@ int host1x_client_register(struct host1x_client *client)
281 +
282 + return 0;
283 + }
284 +-EXPORT_SYMBOL(host1x_client_register);
285 ++EXPORT_SYMBOL(__host1x_client_register);
286 +
287 + /**
288 + * host1x_client_unregister() - unregister a host1x client
289 +diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
290 +index 5ad519c9f2396..8a1e70e008764 100644
291 +--- a/drivers/interconnect/core.c
292 ++++ b/drivers/interconnect/core.c
293 +@@ -942,6 +942,8 @@ int icc_link_destroy(struct icc_node *src, struct icc_node *dst)
294 + GFP_KERNEL);
295 + if (new)
296 + src->links = new;
297 ++ else
298 ++ ret = -ENOMEM;
299 +
300 + out:
301 + mutex_unlock(&icc_lock);
302 +diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
303 +index 7a680b5177f5e..2fff62695455d 100644
304 +--- a/drivers/net/phy/sfp.c
305 ++++ b/drivers/net/phy/sfp.c
306 +@@ -1501,15 +1501,19 @@ static void sfp_sm_link_down(struct sfp *sfp)
307 +
308 + static void sfp_sm_link_check_los(struct sfp *sfp)
309 + {
310 +- unsigned int los = sfp->state & SFP_F_LOS;
311 ++ const __be16 los_inverted = cpu_to_be16(SFP_OPTIONS_LOS_INVERTED);
312 ++ const __be16 los_normal = cpu_to_be16(SFP_OPTIONS_LOS_NORMAL);
313 ++ __be16 los_options = sfp->id.ext.options & (los_inverted | los_normal);
314 ++ bool los = false;
315 +
316 + /* If neither SFP_OPTIONS_LOS_INVERTED nor SFP_OPTIONS_LOS_NORMAL
317 +- * are set, we assume that no LOS signal is available.
318 ++ * are set, we assume that no LOS signal is available. If both are
319 ++ * set, we assume LOS is not implemented (and is meaningless.)
320 + */
321 +- if (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_INVERTED))
322 +- los ^= SFP_F_LOS;
323 +- else if (!(sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_NORMAL)))
324 +- los = 0;
325 ++ if (los_options == los_inverted)
326 ++ los = !(sfp->state & SFP_F_LOS);
327 ++ else if (los_options == los_normal)
328 ++ los = !!(sfp->state & SFP_F_LOS);
329 +
330 + if (los)
331 + sfp_sm_next(sfp, SFP_S_WAIT_LOS, 0);
332 +@@ -1519,18 +1523,22 @@ static void sfp_sm_link_check_los(struct sfp *sfp)
333 +
334 + static bool sfp_los_event_active(struct sfp *sfp, unsigned int event)
335 + {
336 +- return (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_INVERTED) &&
337 +- event == SFP_E_LOS_LOW) ||
338 +- (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_NORMAL) &&
339 +- event == SFP_E_LOS_HIGH);
340 ++ const __be16 los_inverted = cpu_to_be16(SFP_OPTIONS_LOS_INVERTED);
341 ++ const __be16 los_normal = cpu_to_be16(SFP_OPTIONS_LOS_NORMAL);
342 ++ __be16 los_options = sfp->id.ext.options & (los_inverted | los_normal);
343 ++
344 ++ return (los_options == los_inverted && event == SFP_E_LOS_LOW) ||
345 ++ (los_options == los_normal && event == SFP_E_LOS_HIGH);
346 + }
347 +
348 + static bool sfp_los_event_inactive(struct sfp *sfp, unsigned int event)
349 + {
350 +- return (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_INVERTED) &&
351 +- event == SFP_E_LOS_HIGH) ||
352 +- (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_NORMAL) &&
353 +- event == SFP_E_LOS_LOW);
354 ++ const __be16 los_inverted = cpu_to_be16(SFP_OPTIONS_LOS_INVERTED);
355 ++ const __be16 los_normal = cpu_to_be16(SFP_OPTIONS_LOS_NORMAL);
356 ++ __be16 los_options = sfp->id.ext.options & (los_inverted | los_normal);
357 ++
358 ++ return (los_options == los_inverted && event == SFP_E_LOS_HIGH) ||
359 ++ (los_options == los_normal && event == SFP_E_LOS_LOW);
360 + }
361 +
362 + static void sfp_sm_fault(struct sfp *sfp, unsigned int next_state, bool warn)
363 +diff --git a/fs/block_dev.c b/fs/block_dev.c
364 +index 85500e2400cf6..b988f78ad4b7c 100644
365 +--- a/fs/block_dev.c
366 ++++ b/fs/block_dev.c
367 +@@ -276,6 +276,8 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
368 + bio.bi_opf = dio_bio_write_op(iocb);
369 + task_io_account_write(ret);
370 + }
371 ++ if (iocb->ki_flags & IOCB_NOWAIT)
372 ++ bio.bi_opf |= REQ_NOWAIT;
373 + if (iocb->ki_flags & IOCB_HIPRI)
374 + bio_set_polled(&bio, iocb);
375 +
376 +@@ -429,6 +431,8 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
377 + bio->bi_opf = dio_bio_write_op(iocb);
378 + task_io_account_write(bio->bi_iter.bi_size);
379 + }
380 ++ if (iocb->ki_flags & IOCB_NOWAIT)
381 ++ bio->bi_opf |= REQ_NOWAIT;
382 +
383 + dio->size += bio->bi_iter.bi_size;
384 + pos += bio->bi_iter.bi_size;
385 +diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
386 +index 754ea2a137b4f..223ebd6b1b8d1 100644
387 +--- a/fs/gfs2/super.c
388 ++++ b/fs/gfs2/super.c
389 +@@ -169,8 +169,10 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
390 + int error;
391 +
392 + error = init_threads(sdp);
393 +- if (error)
394 ++ if (error) {
395 ++ gfs2_withdraw_delayed(sdp);
396 + return error;
397 ++ }
398 +
399 + j_gl->gl_ops->go_inval(j_gl, DIO_METADATA);
400 + if (gfs2_withdrawn(sdp)) {
401 +@@ -765,11 +767,13 @@ void gfs2_freeze_func(struct work_struct *work)
402 + static int gfs2_freeze(struct super_block *sb)
403 + {
404 + struct gfs2_sbd *sdp = sb->s_fs_info;
405 +- int error = 0;
406 ++ int error;
407 +
408 + mutex_lock(&sdp->sd_freeze_mutex);
409 +- if (atomic_read(&sdp->sd_freeze_state) != SFS_UNFROZEN)
410 ++ if (atomic_read(&sdp->sd_freeze_state) != SFS_UNFROZEN) {
411 ++ error = -EBUSY;
412 + goto out;
413 ++ }
414 +
415 + for (;;) {
416 + if (gfs2_withdrawn(sdp)) {
417 +@@ -810,10 +814,10 @@ static int gfs2_unfreeze(struct super_block *sb)
418 + struct gfs2_sbd *sdp = sb->s_fs_info;
419 +
420 + mutex_lock(&sdp->sd_freeze_mutex);
421 +- if (atomic_read(&sdp->sd_freeze_state) != SFS_FROZEN ||
422 ++ if (atomic_read(&sdp->sd_freeze_state) != SFS_FROZEN ||
423 + !gfs2_holder_initialized(&sdp->sd_freeze_gh)) {
424 + mutex_unlock(&sdp->sd_freeze_mutex);
425 +- return 0;
426 ++ return -EINVAL;
427 + }
428 +
429 + gfs2_freeze_unlock(&sdp->sd_freeze_gh);
430 +diff --git a/fs/io_uring.c b/fs/io_uring.c
431 +index b1b3154c8d502..95b4a89dad4e9 100644
432 +--- a/fs/io_uring.c
433 ++++ b/fs/io_uring.c
434 +@@ -1546,7 +1546,7 @@ static void io_prep_async_work(struct io_kiocb *req)
435 + if (req->flags & REQ_F_ISREG) {
436 + if (def->hash_reg_file || (ctx->flags & IORING_SETUP_IOPOLL))
437 + io_wq_hash_work(&req->work, file_inode(req->file));
438 +- } else {
439 ++ } else if (!req->file || !S_ISBLK(file_inode(req->file)->i_mode)) {
440 + if (def->unbound_nonreg_file)
441 + req->work.flags |= IO_WQ_WORK_UNBOUND;
442 + }
443 +diff --git a/include/linux/host1x.h b/include/linux/host1x.h
444 +index ce59a6a6a0087..9eb77c87a83b0 100644
445 +--- a/include/linux/host1x.h
446 ++++ b/include/linux/host1x.h
447 +@@ -320,7 +320,14 @@ static inline struct host1x_device *to_host1x_device(struct device *dev)
448 + int host1x_device_init(struct host1x_device *device);
449 + int host1x_device_exit(struct host1x_device *device);
450 +
451 +-int host1x_client_register(struct host1x_client *client);
452 ++int __host1x_client_register(struct host1x_client *client,
453 ++ struct lock_class_key *key);
454 ++#define host1x_client_register(class) \
455 ++ ({ \
456 ++ static struct lock_class_key __key; \
457 ++ __host1x_client_register(class, &__key); \
458 ++ })
459 ++
460 + int host1x_client_unregister(struct host1x_client *client);
461 +
462 + int host1x_client_suspend(struct host1x_client *client);
463 +diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
464 +index b7e29db127fa2..3ba52d4e13142 100644
465 +--- a/kernel/trace/ftrace.c
466 ++++ b/kernel/trace/ftrace.c
467 +@@ -3231,7 +3231,8 @@ ftrace_allocate_pages(unsigned long num_to_init)
468 + pg = start_pg;
469 + while (pg) {
470 + order = get_count_order(pg->size / ENTRIES_PER_PAGE);
471 +- free_pages((unsigned long)pg->records, order);
472 ++ if (order >= 0)
473 ++ free_pages((unsigned long)pg->records, order);
474 + start_pg = pg->next;
475 + kfree(pg);
476 + pg = start_pg;
477 +@@ -6451,7 +6452,8 @@ void ftrace_release_mod(struct module *mod)
478 + clear_mod_from_hashes(pg);
479 +
480 + order = get_count_order(pg->size / ENTRIES_PER_PAGE);
481 +- free_pages((unsigned long)pg->records, order);
482 ++ if (order >= 0)
483 ++ free_pages((unsigned long)pg->records, order);
484 + tmp_page = pg->next;
485 + kfree(pg);
486 + ftrace_number_of_pages -= 1 << order;
487 +@@ -6811,7 +6813,8 @@ void ftrace_free_mem(struct module *mod, void *start_ptr, void *end_ptr)
488 + if (!pg->index) {
489 + *last_pg = pg->next;
490 + order = get_count_order(pg->size / ENTRIES_PER_PAGE);
491 +- free_pages((unsigned long)pg->records, order);
492 ++ if (order >= 0)
493 ++ free_pages((unsigned long)pg->records, order);
494 + ftrace_number_of_pages -= 1 << order;
495 + ftrace_number_of_groups--;
496 + kfree(pg);
497 +diff --git a/lib/test_xarray.c b/lib/test_xarray.c
498 +index 8294f43f49816..8b1c318189ce8 100644
499 +--- a/lib/test_xarray.c
500 ++++ b/lib/test_xarray.c
501 +@@ -1530,24 +1530,24 @@ static noinline void check_store_range(struct xarray *xa)
502 +
503 + #ifdef CONFIG_XARRAY_MULTI
504 + static void check_split_1(struct xarray *xa, unsigned long index,
505 +- unsigned int order)
506 ++ unsigned int order, unsigned int new_order)
507 + {
508 +- XA_STATE(xas, xa, index);
509 +- void *entry;
510 +- unsigned int i = 0;
511 ++ XA_STATE_ORDER(xas, xa, index, new_order);
512 ++ unsigned int i;
513 +
514 + xa_store_order(xa, index, order, xa, GFP_KERNEL);
515 +
516 + xas_split_alloc(&xas, xa, order, GFP_KERNEL);
517 + xas_lock(&xas);
518 + xas_split(&xas, xa, order);
519 ++ for (i = 0; i < (1 << order); i += (1 << new_order))
520 ++ __xa_store(xa, index + i, xa_mk_index(index + i), 0);
521 + xas_unlock(&xas);
522 +
523 +- xa_for_each(xa, index, entry) {
524 +- XA_BUG_ON(xa, entry != xa);
525 +- i++;
526 ++ for (i = 0; i < (1 << order); i++) {
527 ++ unsigned int val = index + (i & ~((1 << new_order) - 1));
528 ++ XA_BUG_ON(xa, xa_load(xa, index + i) != xa_mk_index(val));
529 + }
530 +- XA_BUG_ON(xa, i != 1 << order);
531 +
532 + xa_set_mark(xa, index, XA_MARK_0);
533 + XA_BUG_ON(xa, !xa_get_mark(xa, index, XA_MARK_0));
534 +@@ -1557,14 +1557,16 @@ static void check_split_1(struct xarray *xa, unsigned long index,
535 +
536 + static noinline void check_split(struct xarray *xa)
537 + {
538 +- unsigned int order;
539 ++ unsigned int order, new_order;
540 +
541 + XA_BUG_ON(xa, !xa_empty(xa));
542 +
543 + for (order = 1; order < 2 * XA_CHUNK_SHIFT; order++) {
544 +- check_split_1(xa, 0, order);
545 +- check_split_1(xa, 1UL << order, order);
546 +- check_split_1(xa, 3UL << order, order);
547 ++ for (new_order = 0; new_order < order; new_order++) {
548 ++ check_split_1(xa, 0, order, new_order);
549 ++ check_split_1(xa, 1UL << order, order, new_order);
550 ++ check_split_1(xa, 3UL << order, order, new_order);
551 ++ }
552 + }
553 + }
554 + #else
555 +diff --git a/lib/xarray.c b/lib/xarray.c
556 +index 5fa51614802ad..ed775dee1074c 100644
557 +--- a/lib/xarray.c
558 ++++ b/lib/xarray.c
559 +@@ -1011,7 +1011,7 @@ void xas_split_alloc(struct xa_state *xas, void *entry, unsigned int order,
560 +
561 + do {
562 + unsigned int i;
563 +- void *sibling;
564 ++ void *sibling = NULL;
565 + struct xa_node *node;
566 +
567 + node = kmem_cache_alloc(radix_tree_node_cachep, gfp);
568 +@@ -1021,7 +1021,7 @@ void xas_split_alloc(struct xa_state *xas, void *entry, unsigned int order,
569 + for (i = 0; i < XA_CHUNK_SIZE; i++) {
570 + if ((i & mask) == 0) {
571 + RCU_INIT_POINTER(node->slots[i], entry);
572 +- sibling = xa_mk_sibling(0);
573 ++ sibling = xa_mk_sibling(i);
574 + } else {
575 + RCU_INIT_POINTER(node->slots[i], sibling);
576 + }
577 +diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
578 +index d1e04d2b5170e..e0093411d85d6 100644
579 +--- a/net/ipv4/netfilter/arp_tables.c
580 ++++ b/net/ipv4/netfilter/arp_tables.c
581 +@@ -1193,6 +1193,8 @@ static int translate_compat_table(struct net *net,
582 + if (!newinfo)
583 + goto out_unlock;
584 +
585 ++ memset(newinfo->entries, 0, size);
586 ++
587 + newinfo->number = compatr->num_entries;
588 + for (i = 0; i < NF_ARP_NUMHOOKS; i++) {
589 + newinfo->hook_entry[i] = compatr->hook_entry[i];
590 +diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
591 +index f15bc21d73016..f77ea0dbe6562 100644
592 +--- a/net/ipv4/netfilter/ip_tables.c
593 ++++ b/net/ipv4/netfilter/ip_tables.c
594 +@@ -1428,6 +1428,8 @@ translate_compat_table(struct net *net,
595 + if (!newinfo)
596 + goto out_unlock;
597 +
598 ++ memset(newinfo->entries, 0, size);
599 ++
600 + newinfo->number = compatr->num_entries;
601 + for (i = 0; i < NF_INET_NUMHOOKS; i++) {
602 + newinfo->hook_entry[i] = compatr->hook_entry[i];
603 +diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
604 +index 2e2119bfcf137..eb2b5404806c6 100644
605 +--- a/net/ipv6/netfilter/ip6_tables.c
606 ++++ b/net/ipv6/netfilter/ip6_tables.c
607 +@@ -1443,6 +1443,8 @@ translate_compat_table(struct net *net,
608 + if (!newinfo)
609 + goto out_unlock;
610 +
611 ++ memset(newinfo->entries, 0, size);
612 ++
613 + newinfo->number = compatr->num_entries;
614 + for (i = 0; i < NF_INET_NUMHOOKS; i++) {
615 + newinfo->hook_entry[i] = compatr->hook_entry[i];
616 +diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
617 +index 6bd31a7a27fc5..92e9d4ebc5e8d 100644
618 +--- a/net/netfilter/x_tables.c
619 ++++ b/net/netfilter/x_tables.c
620 +@@ -733,7 +733,7 @@ void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
621 + {
622 + const struct xt_match *match = m->u.kernel.match;
623 + struct compat_xt_entry_match *cm = (struct compat_xt_entry_match *)m;
624 +- int pad, off = xt_compat_match_offset(match);
625 ++ int off = xt_compat_match_offset(match);
626 + u_int16_t msize = cm->u.user.match_size;
627 + char name[sizeof(m->u.user.name)];
628 +
629 +@@ -743,9 +743,6 @@ void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
630 + match->compat_from_user(m->data, cm->data);
631 + else
632 + memcpy(m->data, cm->data, msize - sizeof(*cm));
633 +- pad = XT_ALIGN(match->matchsize) - match->matchsize;
634 +- if (pad > 0)
635 +- memset(m->data + match->matchsize, 0, pad);
636 +
637 + msize += off;
638 + m->u.user.match_size = msize;
639 +@@ -1116,7 +1113,7 @@ void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr,
640 + {
641 + const struct xt_target *target = t->u.kernel.target;
642 + struct compat_xt_entry_target *ct = (struct compat_xt_entry_target *)t;
643 +- int pad, off = xt_compat_target_offset(target);
644 ++ int off = xt_compat_target_offset(target);
645 + u_int16_t tsize = ct->u.user.target_size;
646 + char name[sizeof(t->u.user.name)];
647 +
648 +@@ -1126,9 +1123,6 @@ void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr,
649 + target->compat_from_user(t->data, ct->data);
650 + else
651 + memcpy(t->data, ct->data, tsize - sizeof(*ct));
652 +- pad = XT_ALIGN(target->targetsize) - target->targetsize;
653 +- if (pad > 0)
654 +- memset(t->data + target->targetsize, 0, pad);
655 +
656 + tsize += off;
657 + t->u.user.target_size = tsize;
658 +diff --git a/tools/kvm/kvm_stat/kvm_stat.service b/tools/kvm/kvm_stat/kvm_stat.service
659 +index 71aabaffe7791..8f13b843d5b4e 100644
660 +--- a/tools/kvm/kvm_stat/kvm_stat.service
661 ++++ b/tools/kvm/kvm_stat/kvm_stat.service
662 +@@ -9,6 +9,7 @@ Type=simple
663 + ExecStart=/usr/bin/kvm_stat -dtcz -s 10 -L /var/log/kvm_stat.csv
664 + ExecReload=/bin/kill -HUP $MAINPID
665 + Restart=always
666 ++RestartSec=60s
667 + SyslogIdentifier=kvm_stat
668 + SyslogLevel=debug
669 +
670 +diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
671 +index f44ede437dc7f..e2537d5acab09 100644
672 +--- a/tools/perf/util/map.c
673 ++++ b/tools/perf/util/map.c
674 +@@ -77,8 +77,7 @@ static inline bool replace_android_lib(const char *filename, char *newfilename)
675 + if (strstarts(filename, "/system/lib/")) {
676 + char *ndk, *app;
677 + const char *arch;
678 +- size_t ndk_length;
679 +- size_t app_length;
680 ++ int ndk_length, app_length;
681 +
682 + ndk = getenv("NDK_ROOT");
683 + app = getenv("APP_PLATFORM");
684 +@@ -106,8 +105,8 @@ static inline bool replace_android_lib(const char *filename, char *newfilename)
685 + if (new_length > PATH_MAX)
686 + return false;
687 + snprintf(newfilename, new_length,
688 +- "%s/platforms/%s/arch-%s/usr/lib/%s",
689 +- ndk, app, arch, libname);
690 ++ "%.*s/platforms/%.*s/arch-%s/usr/lib/%s",
691 ++ ndk_length, ndk, app_length, app, arch, libname);
692 +
693 + return true;
694 + }
695 +diff --git a/tools/testing/radix-tree/idr-test.c b/tools/testing/radix-tree/idr-test.c
696 +index 3b796dd5e5772..6ce7460f3c7a9 100644
697 +--- a/tools/testing/radix-tree/idr-test.c
698 ++++ b/tools/testing/radix-tree/idr-test.c
699 +@@ -301,16 +301,20 @@ void idr_find_test_1(int anchor_id, int throbber_id)
700 + pthread_t throbber;
701 + time_t start = time(NULL);
702 +
703 +- pthread_create(&throbber, NULL, idr_throbber, &throbber_id);
704 +-
705 + BUG_ON(idr_alloc(&find_idr, xa_mk_value(anchor_id), anchor_id,
706 + anchor_id + 1, GFP_KERNEL) != anchor_id);
707 +
708 ++ pthread_create(&throbber, NULL, idr_throbber, &throbber_id);
709 ++
710 ++ rcu_read_lock();
711 + do {
712 + int id = 0;
713 + void *entry = idr_get_next(&find_idr, &id);
714 ++ rcu_read_unlock();
715 + BUG_ON(entry != xa_mk_value(id));
716 ++ rcu_read_lock();
717 + } while (time(NULL) < start + 11);
718 ++ rcu_read_unlock();
719 +
720 + pthread_join(throbber, NULL);
721 +
722 +@@ -577,6 +581,7 @@ void ida_tests(void)
723 +
724 + int __weak main(void)
725 + {
726 ++ rcu_register_thread();
727 + radix_tree_init();
728 + idr_checks();
729 + ida_tests();
730 +@@ -584,5 +589,6 @@ int __weak main(void)
731 + rcu_barrier();
732 + if (nr_allocated)
733 + printf("nr_allocated = %d\n", nr_allocated);
734 ++ rcu_unregister_thread();
735 + return 0;
736 + }
737 +diff --git a/tools/testing/radix-tree/linux/compiler_types.h b/tools/testing/radix-tree/linux/compiler_types.h
738 +deleted file mode 100644
739 +index e69de29bb2d1d..0000000000000
740 +diff --git a/tools/testing/radix-tree/multiorder.c b/tools/testing/radix-tree/multiorder.c
741 +index 9eae0fb5a67d1..e00520cc63498 100644
742 +--- a/tools/testing/radix-tree/multiorder.c
743 ++++ b/tools/testing/radix-tree/multiorder.c
744 +@@ -224,7 +224,9 @@ void multiorder_checks(void)
745 +
746 + int __weak main(void)
747 + {
748 ++ rcu_register_thread();
749 + radix_tree_init();
750 + multiorder_checks();
751 ++ rcu_unregister_thread();
752 + return 0;
753 + }
754 +diff --git a/tools/testing/radix-tree/xarray.c b/tools/testing/radix-tree/xarray.c
755 +index e61e43efe463c..f20e12cbbfd40 100644
756 +--- a/tools/testing/radix-tree/xarray.c
757 ++++ b/tools/testing/radix-tree/xarray.c
758 +@@ -25,11 +25,13 @@ void xarray_tests(void)
759 +
760 + int __weak main(void)
761 + {
762 ++ rcu_register_thread();
763 + radix_tree_init();
764 + xarray_tests();
765 + radix_tree_cpu_dead(1);
766 + rcu_barrier();
767 + if (nr_allocated)
768 + printf("nr_allocated = %d\n", nr_allocated);
769 ++ rcu_unregister_thread();
770 + return 0;
771 + }