Skip to content

x86/intel_rdt: Fix cache pseudo-locking error path cleanup

Reinette Chatre lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2x86/intel_rdt: Move pseudo_lock_region_cleararch/x86/kernel/cpu/intel_rdt_pseudo_lock.c+23 -230 replies
2/2x86/intel_rdt: Fix cleanup of plr structure on errorarch/x86/kernel/cpu/intel_rdt_pseudo_lock.c+17 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] x86/intel_rdt: Fix cache pseudo-locking error path cleanup

Dear Maintainers,

A bug exists in the error handling code during pseudo-lock region creation. When an error occurs early during pseudo-lock region creation the pseudo_lock_region struct is not cleaned up properly but remains associated with the resource group (since it remains in pseudo-locksetup mode). This partially initialized struct causes problems when other areas need to obtain resource group data - when partially initialized the resource group is treated as a pseudo-locked region.

Following is an example of the error being encountered. First a pseudo-locked region of larger than 4MB is attempted. This fails early because of lack for support. Since this is not cleaned up properly, a subsequent attempt fails because it is (incorrectly) believed that a pseudo-locked region already exists, also the bit_usage file reports incorrect data.

# mount -t resctrl resctrl /sys/fs/resctrl
# cd /sys/fs/resctrl/
# mkdir p1
# echo 'L3:1=0xffff0' > schemata
# echo pseudo-locksetup > p1/mode
# echo 'L3:1=0xf' > p1/schemata
-bash: echo: write error: Argument list too long
# cat info/last_cmd_status
requested region exceeds maximum size
# echo 'L3:1=0x1' > p1/schemata
-bash: echo: write error: Invalid argument
# cat info/last_cmd_status
pseudo-locked region in hierarchy
# cat info/L3/bit_usage
0=XXSSSSSSSSSSSSSSSSSS;1=XXSSSSSSSSSSSSSSPPPP

After the fixes in this series have been applied:

# mount -t resctrl resctrl /sys/fs/resctrl/
# cd /sys/fs/resctrl/
# mkdir p1
# echo pseudo-locksetup > p1/mode
# echo 'L3:1=0xffff0' > schemata
# echo 'L3:1=0xf' > p1/schemata
-bash: echo: write error: Argument list too long
# cat info/last_cmd_status
requested region exceeds maximum size
# cat info/L3/bit_usage
0=XXSSSSSSSSSSSSSSSSSS;1=XXSSSSSSSSSSSSSS0000
# echo 'L3:1=0x1' > p1/schemata
# cat info/L3/bit_usage
0=XXSSSSSSSSSSSSSSSSSS;1=XXSSSSSSSSSSSSSS000P

Reinette Chatre (2):
x86/intel_rdt: Move pseudo_lock_region_clear x86/intel_rdt: Fix cleanup of plr structure on error

 arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c | 68 ++++++++++++---------
 1 file changed, 40 insertions(+), 28 deletions(-)
Signature · 1 line
2.17.0