Commit 88520d23 authored by Wang ShaoBo's avatar Wang ShaoBo Committed by Zheng Zengkai
Browse files

arm64/mpam: Fix unreset resources when mkdir ctrl group or umount resctrl



hulk inclusion
category: bugfix
bugzilla: 48265
CVE: NA

--------------------------------

There are two problems related to schemata:

1) When rmdir a group and then mkdir a new group under resctrl
   root directory, the new group still inherits the schemata
   configuration from old.
   e.g.
       > mount -t resctrl resctrl /sys/fs/resctrl
       > cd /sys/fs/resctrl
       > mkdir p1 && cd p1
       > echo 'L3:0=7f' > schemata
       > cd .. && rmdir p1 && mkdir p1 && cd p1
       > cat schemata
         L3:0=7f;1=7fff;2=7fff;3=7fff
         MB:0=100;1=100;2=100;3=100

2) It still exists when umount /sys/fs/resctrl and remount.
   e.g.
       > mount -t resctrl resctrl /sys/fs/resctrl
       > cd /sys/fs/resctrl
       > echo 'L3:0=7f' > schemata
       > umount /sys/fs/resctrl
       > mount -t resctrl resctrl /sys/fs/resctrl
       > cat schemata
         L3:0=7f;1=7fff;2=7fff;3=7fff
         MB:0=100;1=100;2=100;3=100

Firstly we make each resctrl resource obtains their corresponding
default configuration. NOTE we use zero to initialize L3 default
value instead of max cpbm bits, as zero configurarion equals to
maximum configuration for L3 MSCs. And we use max-percentage masks
of max bandwidth to generate maximum configuration for MB.

Then we reset resources' configuration settings to default value
and back MSCs to default state, when mkdir or umount happended.

Fixes: caf75b6b2540 ("resctrlfs: mpam: init struct for mpam")
Fixes: 916dd9321e3c ("resctrlfs: init support resctrlfs")
Signed-off-by: default avatarWang ShaoBo <bobo.shaobowang@huawei.com>
Reviewed-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: default avatarCheng Jian <cj.chengjian@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent d43a6c0c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment