]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
x86/bus_lock: Set rate limit for bus lock
authorFenghua Yu <fenghua.yu@intel.com>
Mon, 19 Apr 2021 21:49:56 +0000 (21:49 +0000)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 18 May 2021 14:39:31 +0000 (16:39 +0200)
commitef4ae6e4413159d2329a172c12e9274e2cb0a3a8
tree7eeba564873b0338f69841ffba9810a98f526f9d
parent1897907cca5aa22cdfcdb7fb8f0644a6add0877d
x86/bus_lock: Set rate limit for bus lock

A bus lock can be thousands of cycles slower than atomic operation within
one cache line. It also disrupts performance on other cores. Malicious
users can generate multiple bus locks to degrade the whole system
performance.

The current mitigation is to kill the offending process, but for certain
scenarios it's desired to identify and throttle the offending application.

Add a system wide rate limit for bus locks. When the system detects bus
locks at a rate higher than N/sec (where N can be set by the kernel boot
argument in the range [1..1000]) any task triggering a bus lock will be
forced to sleep for at least 20ms until the overall system rate of bus
locks drops below the threshold.

Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Link: https://lore.kernel.org/r/20210419214958.4035512-3-fenghua.yu@intel.com
arch/x86/kernel/cpu/intel.c