Commit efe951d
perf/x86: Fix perf,x86,cpuhp deadlock
More lockdep gifts, a 5-way lockup race:
perf_event_create_kernel_counter()
perf_event_alloc()
perf_try_init_event()
x86_pmu_event_init()
__x86_pmu_event_init()
x86_reserve_hardware()
#0 mutex_lock(&pmc_reserve_mutex);
reserve_ds_buffer()
#1 get_online_cpus()
perf_event_release_kernel()
_free_event()
hw_perf_event_destroy()
x86_release_hardware()
#0 mutex_lock(&pmc_reserve_mutex)
release_ds_buffer()
#1 get_online_cpus()
#1 do_cpu_up()
perf_event_init_cpu()
#2 mutex_lock(&pmus_lock)
#3 mutex_lock(&ctx->mutex)
sys_perf_event_open()
mutex_lock_double()
#3 mutex_lock(ctx->mutex)
#4 mutex_lock_nested(ctx->mutex, 1);
perf_try_init_event()
#4 mutex_lock_nested(ctx->mutex, 1)
x86_pmu_event_init()
intel_pmu_hw_config()
x86_add_exclusive()
#0 mutex_lock(&pmc_reserve_mutex)
Fix it by using ordering constructs instead of locking.
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Vince Weaver <[email protected]>
Cc: [email protected]
Signed-off-by: Ingo Molnar <[email protected]>1 parent 0c7296c commit efe951d
1 file changed
+18
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
375 | | - | |
376 | 375 | | |
377 | 376 | | |
378 | | - | |
| 377 | + | |
379 | 378 | | |
380 | 379 | | |
381 | 380 | | |
| |||
384 | 383 | | |
385 | 384 | | |
386 | 385 | | |
387 | | - | |
388 | 386 | | |
389 | 387 | | |
390 | 388 | | |
| |||
419 | 417 | | |
420 | 418 | | |
421 | 419 | | |
422 | | - | |
423 | 420 | | |
424 | 421 | | |
425 | | - | |
| 422 | + | |
426 | 423 | | |
427 | 424 | | |
428 | 425 | | |
429 | 426 | | |
430 | 427 | | |
431 | | - | |
432 | 428 | | |
433 | 429 | | |
434 | 430 | | |
| |||
454 | 450 | | |
455 | 451 | | |
456 | 452 | | |
457 | | - | |
458 | | - | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
459 | 462 | | |
| 463 | + | |
460 | 464 | | |
461 | 465 | | |
462 | 466 | | |
463 | 467 | | |
464 | | - | |
465 | 468 | | |
466 | | - | |
467 | 469 | | |
468 | 470 | | |
469 | 471 | | |
| |||
483 | 485 | | |
484 | 486 | | |
485 | 487 | | |
486 | | - | |
487 | | - | |
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
| |||
521 | 521 | | |
522 | 522 | | |
523 | 523 | | |
524 | | - | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
525 | 529 | | |
| 530 | + | |
526 | 531 | | |
527 | | - | |
528 | | - | |
529 | 532 | | |
530 | 533 | | |
531 | 534 | | |
| |||
0 commit comments