Commit 35159b5
powerpc/64s: make HPTE lock and native_tlbie_lock irq-safe
With kfence enabled, there are several cases where HPTE and TLBIE locks
are called from softirq context, for example:
WARNING: inconsistent lock state
6.0.0-11845-g0cbbc95b12ac #1 Tainted: G N
--------------------------------
inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage.
swapper/0/1 [HC0[0]:SC0[0]:HE1:SE1] takes:
c000000002734de8 (native_tlbie_lock){+.?.}-{2:2}, at: .native_hpte_updateboltedpp+0x1a4/0x600
{IN-SOFTIRQ-W} state was registered at:
.lock_acquire+0x20c/0x520
._raw_spin_lock+0x4c/0x70
.native_hpte_invalidate+0x62c/0x840
.hash__kernel_map_pages+0x450/0x640
.kfence_protect+0x58/0xc0
.kfence_guarded_free+0x374/0x5a0
.__slab_free+0x3d0/0x630
.put_cred_rcu+0xcc/0x120
.rcu_core+0x3c4/0x14e0
.__do_softirq+0x1dc/0x7dc
.do_softirq_own_stack+0x40/0x60
Fix this by consistently disabling irqs while taking either of these
locks. Don't just disable bh because several of the more common cases
already disable irqs, so this just makes the locks always irq-safe.
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20221013230710.1987253-2-npiggin@gmail.com1 parent be83d54 commit 35159b5
1 file changed
+25
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| 271 | + | |
271 | 272 | | |
272 | 273 | | |
| 274 | + | |
| 275 | + | |
273 | 276 | | |
274 | 277 | | |
275 | 278 | | |
| |||
288 | 291 | | |
289 | 292 | | |
290 | 293 | | |
291 | | - | |
| 294 | + | |
| 295 | + | |
292 | 296 | | |
| 297 | + | |
293 | 298 | | |
294 | 299 | | |
295 | 300 | | |
| |||
304 | 309 | | |
305 | 310 | | |
306 | 311 | | |
307 | | - | |
308 | 312 | | |
309 | 313 | | |
310 | 314 | | |
311 | 315 | | |
312 | 316 | | |
313 | 317 | | |
314 | 318 | | |
| 319 | + | |
315 | 320 | | |
316 | 321 | | |
317 | 322 | | |
318 | 323 | | |
| 324 | + | |
| 325 | + | |
319 | 326 | | |
320 | 327 | | |
321 | 328 | | |
| |||
366 | 373 | | |
367 | 374 | | |
368 | 375 | | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
369 | 379 | | |
370 | 380 | | |
371 | 381 | | |
| |||
409 | 419 | | |
410 | 420 | | |
411 | 421 | | |
| 422 | + | |
| 423 | + | |
412 | 424 | | |
413 | 425 | | |
414 | 426 | | |
| |||
472 | 484 | | |
473 | 485 | | |
474 | 486 | | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
475 | 490 | | |
476 | 491 | | |
477 | 492 | | |
| |||
490 | 505 | | |
491 | 506 | | |
492 | 507 | | |
| 508 | + | |
| 509 | + | |
493 | 510 | | |
494 | 511 | | |
495 | 512 | | |
| |||
503 | 520 | | |
504 | 521 | | |
505 | 522 | | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
506 | 526 | | |
507 | 527 | | |
508 | 528 | | |
| |||
520 | 540 | | |
521 | 541 | | |
522 | 542 | | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
523 | 546 | | |
524 | 547 | | |
525 | 548 | | |
| |||
0 commit comments