linux/arch
Xiaochen Shen c85c550eff x86/resctrl: Fix memory bandwidth counter width for Hygon
commit 7517e899e1 upstream.

The memory bandwidth calculation relies on reading the hardware counter
and measuring the delta between samples. To ensure accurate measurement,
the software reads the counter frequently enough to prevent it from
rolling over twice between reads.

The default Memory Bandwidth Monitoring (MBM) counter width is 24 bits.
Hygon CPUs provide a 32-bit width counter, but they do not support the
MBM capability CPUID leaf (0xF.[ECX=1]:EAX) to report the width offset
(from 24 bits).

Consequently, the kernel falls back to the 24-bit default counter width,
which causes incorrect overflow handling on Hygon CPUs.

Fix this by explicitly setting the counter width offset to 8 bits (resulting
in a 32-bit total counter width) for Hygon CPUs.

Fixes: d8df126349 ("x86/cpu/hygon: Add missing resctrl_cpu_detect() in bsp_init helper")
Signed-off-by: Xiaochen Shen <shenxiaochen@open-hieco.net>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20251209062650.1536952-3-shenxiaochen@open-hieco.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-02-06 16:41:49 +01:00
..
alpha alpha: don't reference obsolete termio struct for TC* constants 2026-01-19 13:10:15 +01:00
arc arc: Fix __fls() const-foldability via __builtin_clzl() 2025-12-07 06:09:16 +09:00
arm ARM: dts: imx6q-ba16: fix RTC interrupt level 2026-01-19 13:10:15 +01:00
arm64 arm64: dts: add off-on-delay-us for usdhc2 regulator 2026-01-19 13:10:15 +01:00
csky csky: fix csky_cmpxchg_fixup not working 2026-01-19 13:10:15 +01:00
h8300 sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
hexagon sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
ia64 sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
m68k m68k: bitops: Fix find_*_bit() signatures 2025-10-29 14:03:10 +01:00
microblaze sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
mips MIPS: mm: Prevent a TLB shutdown on initial uniquification 2025-12-07 06:09:34 +09:00
nds32 sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
nios2 nios2: ensure that memblock.current_limit is set when setting pfn limits 2025-10-29 14:03:10 +01:00
openrisc sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
parisc parisc: entry: set W bit for !compat tasks in syscall_restore_rfi() 2026-01-19 13:10:01 +01:00
powerpc powerpc/pseries/cmm: adjust BALLOON_MIGRATE when migrating pages 2026-01-19 13:10:10 +01:00
riscv RISC-V: clear hot-unplugged cores from all task mm_cpumasks to avoid rfence errors 2025-12-07 06:09:27 +09:00
s390 s390/smp: Fix fallback CPU detection 2026-01-19 13:09:24 +01:00
sh sh: Do not use hyphen in exported variable name 2025-08-28 16:24:11 +02:00
sparc sparc/module: Add R_SPARC_UA64 relocation handling 2025-12-07 06:09:23 +09:00
um um: Fix help message for ssl-non-raw 2025-12-07 06:09:24 +09:00
x86 x86/resctrl: Fix memory bandwidth counter width for Hygon 2026-02-06 16:41:49 +01:00
xtensa sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
.gitignore .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
Kconfig cpu: Re-enable CPU mitigations by default for !X86 architectures 2024-05-02 16:24:48 +02:00