Commit 0b814883 authored by Fenghua Yu's avatar Fenghua Yu Committed by Ethan Zhao
Browse files

x86/bus_lock: Set rate limit for bus lock

mainline inclusion
from mainline-v5.12-rc4
commit ef4ae6e4
category: feature
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I5G10C
CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/


commit/?id=ef4ae6e4

Intel-SIG: commit ef4ae6e4 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: default avatarFenghua Yu <fenghua.yu@intel.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarTony Luck <tony.luck@intel.com>
Link: https://lore.kernel.org/r/20210419214958.4035512-3-fenghua.yu@intel.com



(cherry picked from commit ef4ae6e4)
Signed-off-by: default avatarEthan Zhao <haifeng.zhao@linux.intel.com>
parent 5c81ee4a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment