1
0
Fork 0
alistair23-linux/arch/x86/kernel/cpu
Ying-Tsun Huang a9d49da7ed x86/mtrr: Correct the range check before performing MTRR type lookups
commit cb7f4a8b1f upstream.

In mtrr_type_lookup(), if the input memory address region is not in the
MTRR, over 4GB, and not over the top of memory, a write-back attribute
is returned. These condition checks are for ensuring the input memory
address region is actually mapped to the physical memory.

However, if the end address is just aligned with the top of memory,
the condition check treats the address is over the top of memory, and
write-back attribute is not returned.

And this hits in a real use case with NVDIMM: the nd_pmem module tries
to map NVDIMMs as cacheable memories when NVDIMMs are connected. If a
NVDIMM is the last of the DIMMs, the performance of this NVDIMM becomes
very low since it is aligned with the top of memory and its memory type
is uncached-minus.

Move the input end address change to inclusive up into
mtrr_type_lookup(), before checking for the top of memory in either
mtrr_type_lookup_{variable,fixed}() helpers.

 [ bp: Massage commit message. ]

Fixes: 0cc705f56e ("x86/mm/mtrr: Clean up mtrr_type_lookup()")
Signed-off-by: Ying-Tsun Huang <ying-tsun.huang@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20201215070721.4349-1-ying-tsun.huang@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-12 20:16:24 +01:00
..
mce x86/mce: Do not overwrite no_way_out if mce_end() fails 2020-12-02 08:49:55 +01:00
microcode x86/microcode/intel: Check patch signature before saving microcode for early loading 2020-11-24 13:29:24 +01:00
mtrr x86/mtrr: Correct the range check before performing MTRR type lookups 2021-01-12 20:16:24 +01:00
resctrl x86/resctrl: Fix incorrect local bandwidth when mba_sc is enabled 2020-12-21 13:27:07 +01:00
.gitignore
Makefile x86/cpu: Add a "tsx=" cmdline option with TSX disabled by default 2019-10-28 08:36:58 +01:00
acrn.c x86/acrn: Use HYPERVISOR_CALLBACK_VECTOR for ACRN guest upcall vector 2019-06-11 21:31:31 +02:00
amd.c x86/CPU/AMD: Save AMD NodeId as cpu_die_id 2020-12-30 11:51:47 +01:00
aperfmperf.c x86/cpu: Disable frequency requests via aperfmperf IPI for nohz_full CPUs 2019-06-22 17:23:48 +02:00
bugs.c x86/speculation: Fix prctl() when spectre_v2_user={seccomp,prctl},ibpb 2020-12-02 08:49:55 +01:00
cacheinfo.c x86/CPU/AMD: Save AMD NodeId as cpu_die_id 2020-12-30 11:51:47 +01:00
centaur.c x86/CPU: Move x86_cpuinfo::x86_max_cores assignment to detect_num_cpu_cores() 2018-05-13 16:14:24 +02:00
common.c x86/asm: Replace __force_order with a memory clobber 2020-10-29 09:58:01 +01:00
cpu.h x86/speculation: Add Special Register Buffer Data Sampling (SRBDS) mitigation 2020-06-10 20:24:57 +02:00
cpuid-deps.c x86/cpufeatures: Enable a new AVX512 CPU feature 2019-07-22 10:38:25 +02:00
cyrix.c x86/cpu/cyrix: Use correct macros for Cyrix calls on Geode processors 2019-03-21 12:28:50 +01:00
hygon.c x86/CPU/AMD: Save AMD NodeId as cpu_die_id 2020-12-30 11:51:47 +01:00
hypervisor.c x86/paravirt: Remove const mark from x86_hyper_xen_hvm variable 2019-07-17 08:09:59 +02:00
intel.c x86/cpu: Add a "tsx=" cmdline option with TSX disabled by default 2019-10-28 08:36:58 +01:00
intel_epb.c x86: intel_epb: Do not build when CONFIG_PM is unset 2019-05-30 10:58:36 +02:00
intel_pconfig.c x86/pconfig: Detect PCONFIG targets 2018-03-12 12:10:54 +01:00
match.c x86/cpu: Add a steppings field to struct x86_cpu_id 2020-06-10 20:24:57 +02:00
mkcapflags.sh x86/build: Add 'set -e' to mkcapflags.sh to delete broken capflags.c 2019-06-25 09:52:05 +02:00
mshyperv.c x86: hyperv: report value of misc_features 2020-05-02 08:48:55 +02:00
perfctr-watchdog.c x86/events: Add Hygon Dhyana support to PMU infrastructure 2018-09-27 18:28:57 +02:00
powerflags.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
proc.c x86: Convert some slow-path static_cpu_has() callers to boot_cpu_has() 2019-04-08 12:13:34 +02:00
rdrand.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 335 2019-06-05 17:37:06 +02:00
scattered.c x86/cpufeatures: Combine word 11 and 12 into a new scattered features word 2019-06-20 12:38:44 +02:00
topology.c x86/topology: Create topology_max_die_per_package() 2019-05-23 10:08:30 +02:00
transmeta.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
tsx.c x86/cpu: Update cached HLE state on write to TSX_CTRL_CPUID_CLEAR 2020-02-11 04:35:15 -08:00
umc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
umwait.c KVM: VMX: Stop context switching MSR_IA32_UMWAIT_CONTROL 2020-06-30 15:37:07 -04:00
vmware.c x86/cpu/vmware: Use the full form of INL in VMWARE_PORT 2019-10-08 13:26:42 +02:00
zhaoxin.c x86/cpu: Create Zhaoxin processors architecture support file 2019-06-22 11:45:57 +02:00