Commit 0b16164d authored by Wang ShaoBo's avatar Wang ShaoBo Committed by Zheng Zengkai
Browse files

arm64/mpam: Remap reqpartid,pmg to rmid and intpartid to closid



hulk inclusion
category: feature
feature: ARM MPAM support
bugzilla: 48265
CVE: NA

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

So far we use sd_closid, including {reqpartid, intpartid}, to label each
resctrl group including ctrlgroup and mongroup, This can perfectly handle
this case where number of reqpartid exceeds intpartid, this always happen
when intpartid narrowing supported, otherwise their two are of same number.
So we use excessive reqpartid to indicate (1)- how configurations can be
synchronized from the configuration indexed by intpartid, not only that,
(2)- take part of monitor role.

But reqpartid in (2) with pmg still be scattered, So far we have not yet
a right way to explain how can we use their two properly. In order to
ensure their resources can be fully utilized, and given this idea from
Intel-RDT's design which uses rmid for monitoring, a rmid remap matrix is
delivered for transforming partid and pmg to rmid, this matrix is organized
like this:

                 [bitmap entry indexed by partid]
                       [col pos is partid]

                     [0]  [1]  [2]  [3]  [4]  [5]
   occ->bitmap[:0]    1    0    0    1    1    1
        bitmap[:1]    1    0    0    1    1    1
        bitmap[:2]    1    1    1    1    1    1
        bitmap[:3]    1    1    1    1    1    1
[row pos-1 is pmg]

Calculate rmid = partid + NR_partid * pmg

occ represents if this bitmap has been used by a partid, it is because
a certain partid should not be accompany with a duplicated pmg for
monitoring, this design easily saves a lot of space, and can also decrease
time complexity of allocating and free rmid process from O(NR_partid)*
O(NR_pmg) to O(NR_partid) + O(log(NR_pmg)) compared with using list.

By this way, we get a continuous rmid set with upper bound(NR_pmg *
NR_partid - 1), given an rmid we can assume that if it's a valid rmid
by judging whether it falls within this range or not.

rmid implicts the reqpartid info, so we can use relevant helpers to get
this reqpartid for sd_closid@reqpartid and perfectly accomplish this
configuration sync mission, this also makes closid simpler which can be
consists of intpartid index only, also each resctrl group is happy to own
consecutive rmid.

This also has some profound influences, for instance for MPAM there
also support SMMU io using partid and pmg, we can use a single helper
mpam_rmid_to_partid_pmg() in SMMU driver to complete this remap process
for rmid input from outside user space.

Signed-off-by: default avatarWang ShaoBo <bobo.shaobowang@huawei.com>
Reviewed-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: default avatarCheng Jian <cj.chengjian@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 28e3f99f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment