Skip to content

Commit 923f3a2

Browse files
rchatresuryasaimadhu
authored andcommitted
x86/resctrl: Query LLC monitoring properties once during boot
Cache and memory bandwidth monitoring are features that are part of x86 CPU resource control that is supported by the resctrl subsystem. The monitoring properties are obtained via CPUID from every CPU and only used within the resctrl subsystem where the properties are only read from boot_cpu_data. Obtain the monitoring properties once, placed in boot_cpu_data, via the ->c_bsp_init() helpers of the vendors that support X86_FEATURE_CQM_LLC. Suggested-by: Borislav Petkov <[email protected]> Signed-off-by: Reinette Chatre <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lkml.kernel.org/r/6d74a6ac3e69f4b7a8b4115835f9455faf0f468d.1588715690.git.reinette.chatre@intel.com
1 parent f0d339d commit 923f3a2

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

arch/x86/kernel/cpu/amd.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <asm/pci-direct.h>
1919
#include <asm/delay.h>
2020
#include <asm/debugreg.h>
21+
#include <asm/resctrl.h>
2122

2223
#ifdef CONFIG_X86_64
2324
# include <asm/mmconfig.h>
@@ -597,6 +598,8 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)
597598
x86_amd_ls_cfg_ssbd_mask = 1ULL << bit;
598599
}
599600
}
601+
602+
resctrl_cpu_detect(c);
600603
}
601604

602605
static void early_detect_mem_encrypt(struct cpuinfo_x86 *c)

arch/x86/kernel/cpu/common.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
#include <asm/intel-family.h>
5757
#include <asm/cpu_device_id.h>
5858
#include <asm/uv/uv.h>
59-
#include <asm/resctrl.h>
6059

6160
#include "cpu.h"
6261

@@ -922,7 +921,6 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
922921

923922
init_scattered_cpuid_features(c);
924923
init_speculation_control(c);
925-
resctrl_cpu_detect(c);
926924

927925
/*
928926
* Clear/Set all flags overridden by options, after probe.

arch/x86/kernel/cpu/intel.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <asm/cpu_device_id.h>
2323
#include <asm/cmdline.h>
2424
#include <asm/traps.h>
25+
#include <asm/resctrl.h>
2526

2627
#ifdef CONFIG_X86_64
2728
#include <linux/topology.h>
@@ -322,6 +323,11 @@ static void early_init_intel(struct cpuinfo_x86 *c)
322323
detect_ht_early(c);
323324
}
324325

326+
static void bsp_init_intel(struct cpuinfo_x86 *c)
327+
{
328+
resctrl_cpu_detect(c);
329+
}
330+
325331
#ifdef CONFIG_X86_32
326332
/*
327333
* Early probe support logic for ppro memory erratum #50
@@ -961,6 +967,7 @@ static const struct cpu_dev intel_cpu_dev = {
961967
#endif
962968
.c_detect_tlb = intel_detect_tlb,
963969
.c_early_init = early_init_intel,
970+
.c_bsp_init = bsp_init_intel,
964971
.c_init = init_intel,
965972
.c_x86_vendor = X86_VENDOR_INTEL,
966973
};

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,7 @@ static __init void rdt_init_res_defs(void)
958958

959959
static enum cpuhp_state rdt_online;
960960

961+
/* Runs once on the BSP during boot. */
961962
void resctrl_cpu_detect(struct cpuinfo_x86 *c)
962963
{
963964
if (!cpu_has(c, X86_FEATURE_CQM_LLC)) {

0 commit comments

Comments
 (0)