• W
    arm64/mpam: Fix unreset resources when mkdir ctrl group or umount resctrl · 78e49379
    Wang ShaoBo 提交于
    hulk inclusion
    category: bugfix
    bugzilla: 34588
    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: NWang ShaoBo <bobo.shaobowang@huawei.com>
    Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
    Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
    78e49379
resctrlfs.c 23.4 KB