linux/arch/x86/kernel/cpu/resctrl
Peter Newman 07ac5db2d8 x86/resctrl: Fix event counts regression in reused RMIDs
commit 2a81160d29 upstream.

When creating a new monitoring group, the RMID allocated for it may have
been used by a group which was previously removed. In this case, the
hardware counters will have non-zero values which should be deducted
from what is reported in the new group's counts.

resctrl_arch_reset_rmid() initializes the prev_msr value for counters to
0, causing the initial count to be charged to the new group. Resurrect
__rmid_read() and use it to initialize prev_msr correctly.

Unlike before, __rmid_read() checks for error bits in the MSR read so
that callers don't need to.

Fixes: 1d81d15db3 ("x86/resctrl: Move mbm_overflow_count() into resctrl_arch_rmid_read()")
Signed-off-by: Peter Newman <peternewman@google.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Tested-by: Babu Moger <babu.moger@amd.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20221220164132.443083-1-peternewman@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-18 11:58:22 +01:00
..
core.c x86/resctrl: Fix min_cbm_bits for AMD 2022-10-18 20:25:16 +02:00
ctrlmondata.c x86/resctrl: Make resctrl_arch_rmid_read() return values in bytes 2022-09-23 14:25:05 +02:00
internal.h x86/resctrl: Make resctrl_arch_rmid_read() return values in bytes 2022-09-23 14:25:05 +02:00
Makefile x86/resctrl: Avoid confusion over the new X86_RESCTRL config 2019-02-02 10:34:52 +01:00
monitor.c x86/resctrl: Fix event counts regression in reused RMIDs 2023-01-18 11:58:22 +01:00
pseudo_lock_event.h
pseudo_lock.c x86/resctrl: Kill off alloc_enabled 2022-09-22 14:34:33 +02:00
rdtgroup.c x86/resctrl: Fix task CLOSID/RMID update race 2023-01-18 11:58:22 +01:00