cpu/hotplug: Convert get_online_cpus() to a percpu_rwsem
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest32 patches 17 repliesIn review
- v224 patches 18 repliesSuperseded
- v120 patches 12 repliesSuperseded
Changes in v3 from the cover letter
- Reworked the approach vs. perf/ftrace/kprobes, which simplified the lot
- Renamed get_online_cpus() to cpus_read_lock() to reflect the nature of the interface
- Link the lockchains between hotplug control task and per cpu hotplug threads and fixed the fallout of that.
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/32 | cpu/hotplug: Provide cpus_read|write_[un]lock()include/ kernel/ | +36 | 1 reply | |
| 2/32 | cpu/hotplug: Provide lockdep_assert_cpus_held()include/ | +2 | 1 reply | |
| 3/32 | cpu/hotplug: Provide cpuhp_setup/remove_state[_nocalls]_cpuslocked()include/ kernel/ | +65 | 0 replies | |
| 4/32 | cpu/hotplug: Add __cpuhp_state_add_instance_cpuslocked()include/ kernel/ | +24 | 0 replies | |
| 5/32 | stop_machine: Provide stop_machine_cpuslocked()include/ kernel/ | +30 | 1 reply | |
| 6/32 | padata: Make padata_alloc() staticinclude/ kernel/ | +16 | 0 replies | |
| 7/32 | padata: Avoid nested calls to cpus_read_lock() in pcrypt_init_padata()kernel/ | +6 | 0 replies | |
| 8/32 | x86/mtrr: Remove get_online_cpus() from mtrr_save_state()arch/ | +0 | 0 replies | |
| 9/32 | cpufreq: Use cpuhp_setup_state_nocalls_cpuslocked()drivers/ | +11 | 0 replies | |
| 10/32 | KVM/PPC/Book3S HV: Use cpuhp_setup_state_nocalls_cpuslocked()arch/ | +7 | 0 replies | |
| 11/32 | hwtracing/coresight-etm3x: Use cpuhp_setup_state_nocalls_cpuslocked()drivers/ | +10 | 1 reply | |
| 12/32 | hwtracing/coresight-etm4x: Use cpuhp_setup_state_nocalls_cpuslocked()drivers/ | +10 | 1 reply | |
| 13/32 | perf/x86/intel/cqm: Use cpuhp_setup_state_cpuslocked()arch/ | +8 | 0 replies | |
| 14/32 | ARM/hw_breakpoint: Use cpuhp_setup_state_cpuslocked()arch/ | +6 | 0 replies | |
| 15/32 | s390/kernel: Use stop_machine_cpuslocked()arch/ | +3 | 1 reply | |
| 16/32 | powerpc/powernv: Use stop_machine_cpuslocked()arch/ | +4 | 0 replies | |
| 17/32 | cpu/hotplug: Use stop_machine_cpuslocked() in takedown_cpu()kernel/ | +1 | 0 replies | |
| 18/32 | x86/perf: Drop EXPORT of perf_check_microcodearch/ | +0 | 0 replies | |
| 19/32 | perf/x86/intel: Drop get_online_cpus() in intel_snb_check_microcode()arch/ | +5 | 0 replies | |
| 20/32 | PCI: Use cpu_hotplug_disable() instead of get_online_cpus()drivers/ | +2 | 0 replies | |
| 21/32 | PCI: Replace the racy recursion preventiondrivers/ include/ | +26 | 0 replies | |
| 22/32 | ACPI/processor: Use cpu_hotplug_disable() instead of get_online_cpus()drivers/ | +2 | 0 replies | |
| 23/32 | perf/tracing/cpuhotplug: Fix locking orderinclude/ kernel/ | +78 | 5 replies | |
| 24/32 | jump_label: Reorder hotplug lock and jump_label_lockarch/ arch/ arch/ +2 more | +14 | 1 reply | |
| 25/32 | kprobes: Cure hotplug lock ordering issueskernel/ | +32 | 2 replies | |
| 26/32 | arm64: Prevent cpu hotplug rwsem recursionarch/ arch/ | +3 | 0 replies | |
| 27/32 | arm: Prevent hotplug rwsem recursionarch/ arch/ | +3 | 0 replies | |
| 28/32 | s390: Prevent hotplug rwsem recursionarch/ arch/ | +3 | 1 reply | |
| 29/32 | cpu/hotplug: Convert hotplug locking to percpu rwseminclude/ kernel/ | +14 | 0 replies | |
| 30/32 | sched: Provide is_percpu_thread() helperinclude/ | +10 | 0 replies | |
| 31/32 | acpi/processor: Prevent cpu hotplug deadlockdrivers/ | +8 | 0 replies | |
| 32/32 | cpuhotplug: Link lock stacks for hotplug callbackskernel/ | +13 | 0 replies |
Reviews trailers per patch
17 of 32 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Rafael J. Wysocki | Viresh Kumar | Mark Rutland | Bjorn Helgaas | Borislav Petkov | Heiko Carstens | David S. Miller | Masami Hiramatsu | Paul E. McKenney | Mathieu Poirier | Ingo Molnar |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Series | T-b | A-b | |||||||||
| 1/32 | A-b | ||||||||||
| 2/32 | A-b | ||||||||||
| 3/32 | |||||||||||
| 4/32 | |||||||||||
| 5/32 | A-b | ||||||||||
| 6/32 | |||||||||||
| 7/32 | |||||||||||
| 8/32 | |||||||||||
| 9/32 | A-b | A-b | |||||||||
| 10/32 | |||||||||||
| 11/32 | A-b | ||||||||||
| 12/32 | A-b | ||||||||||
| 13/32 | |||||||||||
| 14/32 | A-b | ||||||||||
| 15/32 | A-b | ||||||||||
| 16/32 | |||||||||||
| 17/32 | |||||||||||
| 18/32 | A-b | ||||||||||
| 19/32 | A-b | ||||||||||
| 20/32 | A-b | ||||||||||
| 21/32 | A-b | ||||||||||
| 22/32 | A-b | ||||||||||
| 23/32 | A-b | ||||||||||
| 24/32 | A-b | ||||||||||
| 25/32 | A-b | ||||||||||
| 26/32 | |||||||||||
| 27/32 | |||||||||||
| 28/32 | A-b | ||||||||||
| 29/32 | |||||||||||
| 30/32 | |||||||||||
| 31/32 | |||||||||||
| 32/32 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 11 reviewers.
Cover letter [patch V3 00/32] cpu/hotplug: Convert get_online_cpus() to a percpu_rwsem
get_online_cpus() is used in hot pathes in mainline and even more so in RT. That can show up badly under certain conditions because every locker contends on a global mutex. RT has it's own homebrewn mitigation which is a (badly done) open coded implementation of percpu_rwsems with recursion support.
The proper replacement for that are percpu_rwsems, but that requires to remove recursion support.
The conversion unearthed real locking issues which were previously not visible because the get_online_cpus() lockdep annotation was implemented with recursion support which prevents lockdep from tracking full dependency chains. These potential deadlocks are not related to recursive calls, they trigger on the first invocation because lockdep now has the full dependency chains available.
The following patch series addresses this by
- Cleaning up places which call get_online_cpus() nested
- Replacing a few instances with cpu_hotplug_disable() to prevent circular locking dependencies.
The series is on top of 4.12-rc2. It's available in git from
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.hotplug
Changes since V2:
- Reworked the approach vs. perf/ftrace/kprobes, which simplified the lot
- Renamed get_online_cpus() to cpus_read_lock() to reflect the nature of the interface
- Link the lockchains between hotplug control task and per cpu hotplug threads and fixed the fallout of that.
Thanks,
tglx
--- arch/arm/kernel/hw_breakpoint.c | 11 - arch/arm/kernel/patch.c | 2 arch/arm/probes/kprobes/core.c | 3 arch/arm64/include/asm/insn.h | 1 arch/arm64/kernel/insn.c | 5 arch/mips/kernel/jump_label.c | 2 arch/powerpc/kvm/book3s_hv.c | 14 - arch/powerpc/platforms/powernv/subcore.c | 7 arch/s390/kernel/jump_label.c | 2 arch/s390/kernel/kprobes.c | 4 arch/s390/kernel/time.c | 6 arch/x86/events/core.c | 1 arch/x86/events/intel/cqm.c | 16 - arch/x86/kernel/cpu/mtrr/main.c | 2 b/arch/sparc/kernel/jump_label.c | 2 b/arch/tile/kernel/jump_label.c | 2 b/arch/x86/events/intel/core.c | 11 - b/arch/x86/kernel/jump_label.c | 2 b/kernel/jump_label.c | 20 +- drivers/acpi/processor_driver.c | 4 drivers/acpi/processor_throttling.c | 16 - drivers/cpufreq/cpufreq.c | 21 +- drivers/hwtracing/coresight/coresight-etm3x.c | 20 +- drivers/hwtracing/coresight/coresight-etm4x.c | 20 +- drivers/pci/pci-driver.c | 47 +++-- include/linux/cpu.h | 34 ++-- include/linux/cpuhotplug.h | 38 ++++ include/linux/padata.h | 3 include/linux/pci.h | 1 include/linux/perf_event.h | 2 include/linux/sched.h | 10 + include/linux/stop_machine.h | 26 ++- kernel/cpu.c | 213 +++++++++++--------------- kernel/events/core.c | 106 +++++++++--- kernel/kprobes.c | 59 +++---- kernel/padata.c | 43 ++--- kernel/stop_machine.c | 11 - 37 files changed, 444 insertions(+), 343 deletions(-)