Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

arm_mpam: resctrl: Fix MBA CDP alloc_capable handling on unmount

The code to set MBA's alloc_capable to true appears to be trying to
restore alloc_capable on unmount. This can never work because
resctrl_arch_set_cdp_enabled() is never invoked with RDT_RESOURCE_MBA
as the rid parameter. Consequently,
mpam_resctrl_controls[RDT_RESOURCE_MBA].cdp_enabled always remains false.

The alloc_capable setting in resctrl_arch_set_cdp_enabled() is to
re-enable MBA if the caller opts in to separate control values using
CDP for this resource. This doesn't happen today.

Add a comment to describe this.

However a bug remains where MBA allocation is permanently disabled after
the mount with CDP option. Remounting without CDP cannot restore the MBA
partition capability.

Add a check to re-enable MBA when CDP is disabled, which happens on
unmount.

Fixes: 6789fb99282c ("arm_mpam: resctrl: Add CDP emulation")
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
[ morse: Added comment for existing code, added hunk to fix this bug from
Ben H ]
Reviewed-by: James Morse <james.morse@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>

authored by

Zeng Heng and committed by
James Morse
f758340d 4ce0a2cc

+8
+8
drivers/resctrl/mpam_resctrl.c
··· 220 220 if (cdp_enabled && !mpam_resctrl_controls[RDT_RESOURCE_MBA].cdp_enabled) 221 221 mpam_resctrl_controls[RDT_RESOURCE_MBA].resctrl_res.alloc_capable = false; 222 222 223 + /* 224 + * If resctrl has attempted to enable CDP on MBA, re-enable MBA as two 225 + * configurations will be provided so there is no aliasing problem. 226 + */ 223 227 if (mpam_resctrl_controls[RDT_RESOURCE_MBA].cdp_enabled && 224 228 mpam_resctrl_controls[RDT_RESOURCE_MBA].class) 229 + mpam_resctrl_controls[RDT_RESOURCE_MBA].resctrl_res.alloc_capable = true; 230 + 231 + /* On unmount when CDP is disabled, re-enable MBA */ 232 + if (!cdp_enabled && mpam_resctrl_controls[RDT_RESOURCE_MBA].class) 225 233 mpam_resctrl_controls[RDT_RESOURCE_MBA].resctrl_res.alloc_capable = true; 226 234 227 235 if (enable) {