linux-stable/arch
Babu Moger e5572e66d2 x86/resctrl: Fix min_cbm_bits for AMD
commit 67bf649344 upstream.

AMD systems support zero CBM (capacity bit mask) for cache allocation.
That is reflected in rdt_init_res_defs_amd() by:

  r->cache.arch_has_empty_bitmaps = true;

However given the unified code in cbm_validate(), checking for:

  val == 0 && !arch_has_empty_bitmaps

is not enough because of another check in cbm_validate():

  if ((zero_bit - first_bit) < r->cache.min_cbm_bits)

The default value of r->cache.min_cbm_bits = 1.

Leading to:

  $ cd /sys/fs/resctrl
  $ mkdir foo
  $ cd foo
  $ echo L3:0=0 > schemata
    -bash: echo: write error: Invalid argument
  $ cat /sys/fs/resctrl/info/last_cmd_status
    Need at least 1 bits in the mask

Initialize the min_cbm_bits to 0 for AMD. Also, remove the default
setting of min_cbm_bits and initialize it separately.

After the fix:

  $ cd /sys/fs/resctrl
  $ mkdir foo
  $ cd foo
  $ echo L3:0=0 > schemata
  $ cat /sys/fs/resctrl/info/last_cmd_status
    ok

Fixes: 316e7f901f ("x86/resctrl: Add struct rdt_cache::arch_has_{sparse, empty}_bitmaps")
Co-developed-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Babu Moger <babu.moger@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: James Morse <james.morse@arm.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/lkml/20220517001234.3137157-1-eranian@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-29 10:08:30 +02:00
..
alpha provide arch_test_bit_acquire for architectures that define test_bit 2022-08-27 09:49:54 -07:00
arc Kbuild updates for v5.20 2022-08-10 10:40:41 -07:00
arm ARM: 9242/1: kasan: Only map modules if CONFIG_KASAN_VMALLOC=n 2022-10-21 12:39:20 +02:00
arm64 arm64: dts: qcom: sc8280xp-pmics: Remove reg entry & use correct node name for pmc8280c_lpg node 2022-10-21 12:39:29 +02:00
csky Merge 'irq/loongarch', 'pci/ctrl/loongson' and 'pci/header-cleanup-immutable' 2022-08-11 21:06:14 +08:00
hexagon provide arch_test_bit_acquire for architectures that define test_bit 2022-08-27 09:49:54 -07:00
ia64 ia64: export memory_add_physaddr_to_nid to fix cxl build error 2022-10-21 12:38:34 +02:00
loongarch LoongArch: Clean up loongson3_smp_ops declaration 2022-09-29 10:15:00 +08:00
m68k m68k: Process bootinfo records before saving them 2022-10-21 12:38:01 +02:00
microblaze - The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe 2022-08-05 16:32:45 -07:00
mips MIPS: BCM47XX: Cast memcmp() of function to (void *) 2022-10-21 12:39:04 +02:00
nios2 nios2: add force_successful_syscall_return() 2022-08-15 11:25:32 -05:00
openrisc Updates to various subsystems which I help look after. lib, ocfs2, 2022-08-07 10:03:24 -07:00
parisc parisc: Fix userspace graphics card breakage due to pgtable special bit 2022-10-21 12:37:39 +02:00
powerpc powerpc/64s/interrupt: Fix lost interrupts when returning to soft-masked context 2022-10-21 12:39:28 +02:00
riscv riscv: Pass -mno-relax only on lld < 15.0.0 2022-10-21 12:37:40 +02:00
s390 KVM: s390: pci: register pci hooks without interpretation 2022-09-21 16:18:38 +02:00
sh sh: machvec: Use char[] for section boundaries 2022-10-21 12:37:59 +02:00
sparc sparc: Unbreak the build 2022-10-12 09:39:04 +02:00
um UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK 2022-10-21 12:37:40 +02:00
x86 x86/resctrl: Fix min_cbm_bits for AMD 2022-10-29 10:08:30 +02:00
xtensa Merge 'irq/loongarch', 'pci/ctrl/loongson' and 'pci/header-cleanup-immutable' 2022-08-11 21:06:14 +08:00
.gitignore
Kconfig asm-generic: Conditionally enable do_softirq_own_stack() via Kconfig. 2022-09-05 17:20:55 +02:00