]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
x86/resctrl: Check monitoring static key in the MBM overflow handler
authorXiaochen Shen <xiaochen.shen@intel.com>
Wed, 11 Dec 2019 20:05:05 +0000 (04:05 +0800)
committerBorislav Petkov <bp@suse.de>
Fri, 17 Jan 2020 18:32:32 +0000 (19:32 +0100)
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: e33026831bdb ("x86/intel_rdt/mbm: Handle counter overflow")
Signed-off-by: Xiaochen Shen <xiaochen.shen@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/1576094705-13660-1-git-send-email-xiaochen.shen@intel.com
arch/x86/kernel/cpu/resctrl/internal.h
arch/x86/kernel/cpu/resctrl/monitor.c

index e49b77283924a9b8b0d5f3a865483dc3baa4d321..181c992f448c068b4cabf8880eb9cf20716475d6 100644 (file)
@@ -57,6 +57,7 @@ static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc)
 }
 
 DECLARE_STATIC_KEY_FALSE(rdt_enable_key);
+DECLARE_STATIC_KEY_FALSE(rdt_mon_enable_key);
 
 /**
  * struct mon_evt - Entry in the event list of a resource
index 397206f23d14f9aeadf860747fa42662d42baadf..773124b0e18ac0b1b6c48aedb6eed41dccde88cb 100644 (file)
@@ -514,7 +514,7 @@ void mbm_handle_overflow(struct work_struct *work)
 
        mutex_lock(&rdtgroup_mutex);
 
-       if (!static_branch_likely(&rdt_enable_key))
+       if (!static_branch_likely(&rdt_mon_enable_key))
                goto out_unlock;
 
        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)
        unsigned long delay = msecs_to_jiffies(delay_ms);
        int cpu;
 
-       if (!static_branch_likely(&rdt_enable_key))
+       if (!static_branch_likely(&rdt_mon_enable_key))
                return;
        cpu = cpumask_any(&dom->cpu_mask);
        dom->mbm_work_cpu = cpu;