Skip to content

Commit 536a0d8

Browse files
xiaochenshensuryasaimadhu
authored andcommitted
x86/resctrl: Check monitoring static key in the MBM overflow handler
Currently, there are three static keys in the resctrl file system: rdt_mon_enable_key and rdt_alloc_enable_key indicate if the monitoring feature and the allocation feature are enabled, respectively. The rdt_enable_key is enabled when either the monitoring feature or the allocation feature is enabled. If no monitoring feature is present (either hardware doesn't support a monitoring feature or the feature is disabled by the kernel command line option "rdt="), rdt_enable_key is still enabled but rdt_mon_enable_key is disabled. MBM is a monitoring feature. The MBM overflow handler intends to check if the monitoring feature is not enabled for fast return. So check the rdt_mon_enable_key in it instead of the rdt_enable_key as former is the more accurate check. [ bp: Massage commit message. ] Fixes: e330268 ("x86/intel_rdt/mbm: Handle counter overflow") Signed-off-by: Xiaochen Shen <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent dc43379 commit 536a0d8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

arch/x86/kernel/cpu/resctrl/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc)
5757
}
5858

5959
DECLARE_STATIC_KEY_FALSE(rdt_enable_key);
60+
DECLARE_STATIC_KEY_FALSE(rdt_mon_enable_key);
6061

6162
/**
6263
* struct mon_evt - Entry in the event list of a resource

arch/x86/kernel/cpu/resctrl/monitor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ void mbm_handle_overflow(struct work_struct *work)
514514

515515
mutex_lock(&rdtgroup_mutex);
516516

517-
if (!static_branch_likely(&rdt_enable_key))
517+
if (!static_branch_likely(&rdt_mon_enable_key))
518518
goto out_unlock;
519519

520520
d = get_domain_from_cpu(cpu, &rdt_resources_all[RDT_RESOURCE_L3]);
@@ -543,7 +543,7 @@ void mbm_setup_overflow_handler(struct rdt_domain *dom, unsigned long delay_ms)
543543
unsigned long delay = msecs_to_jiffies(delay_ms);
544544
int cpu;
545545

546-
if (!static_branch_likely(&rdt_enable_key))
546+
if (!static_branch_likely(&rdt_mon_enable_key))
547547
return;
548548
cpu = cpumask_any(&dom->cpu_mask);
549549
dom->mbm_work_cpu = cpu;

0 commit comments

Comments
 (0)