[tip: x86/cache] x86/resctrl: Remove unnecessary RMID checks

From: tip-bot2 for Reinette Chatre
Date: Wed May 06 2020 - 14:08:44 EST


The following commit has been merged into the x86/cache branch of tip:

Commit-ID: f0d339db56478e3bcd98d5e985d3d69cacf27549
Gitweb: https://git.kernel.org/tip/f0d339db56478e3bcd98d5e985d3d69cacf27549
Author: Reinette Chatre <reinette.chatre@xxxxxxxxx>
AuthorDate: Tue, 05 May 2020 15:36:14 -07:00
Committer: Borislav Petkov <bp@xxxxxxx>
CommitterDate: Wed, 06 May 2020 17:53:46 +02:00

x86/resctrl: Remove unnecessary RMID checks

The cache and memory bandwidth monitoring properties are read using
CPUID on every CPU. After the information is read from the system a
sanity check is run to

(1) ensure that the RMID data is initialized for the boot CPU in case
the information was not available on the boot CPU and

(2) the boot CPU's RMID is set to the minimum of RMID obtained
from all CPUs.

Every known platform that supports resctrl has the same maximum RMID
on all CPUs. Both sanity checks found in x86_init_cache_qos() can thus
safely be removed.

Suggested-by: Borislav Petkov <bp@xxxxxxx>
Signed-off-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
Signed-off-by: Borislav Petkov <bp@xxxxxxx>
Link: https://lkml.kernel.org/r/c9a3b60d34091840c8b0bd1c6fab15e5ba92cb17.1588715690.git.reinette.chatre@xxxxxxxxx
---
arch/x86/kernel/cpu/common.c | 15 ---------------
1 file changed, 15 deletions(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index a8f0f22..556a96d 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1354,20 +1354,6 @@ static void generic_identify(struct cpuinfo_x86 *c)
#endif
}

-static void x86_init_cache_qos(struct cpuinfo_x86 *c)
-{
- /*
- * The heavy lifting of max_rmid and cache_occ_scale are handled
- * in get_cpu_cap(). Here we just set the max_rmid for the boot_cpu
- * in case CQM bits really aren't there in this CPU.
- */
- if (c != &boot_cpu_data) {
- boot_cpu_data.x86_cache_max_rmid =
- min(boot_cpu_data.x86_cache_max_rmid,
- c->x86_cache_max_rmid);
- }
-}
-
/*
* Validate that ACPI/mptables have the same information about the
* effective APIC id and update the package map.
@@ -1480,7 +1466,6 @@ static void identify_cpu(struct cpuinfo_x86 *c)
#endif

x86_init_rdrand(c);
- x86_init_cache_qos(c);
setup_pku(c);

/*