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(-) -- 2.17.0