Commit 8a2c07b5 authored by Wang ShaoBo's avatar Wang ShaoBo Committed by Zheng Zengkai
Browse files

arm64/mpam: rmid: refine allocation and release process

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4LL14


CVE: NA

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

Different from Intel-RDT, MPAM need handle more cases when monitoring,
there are two label PARTID and PMG embedded into one single data stream,
they may work at the same time, or only PMG works, if only PMG works,
the number of PMG determines the number of resources can be monitored
at the same time.

for instance(NR_PARTID equals to 2, NR_PMG equals to 2):

(1) PARTID and PMG works together
    RMID  =    PARTID   +   PMG*NR_PARTID
     0           0           0
     1           1           0
     2           0           1
     3           1           1

                             (2) only PMG works
                                RMID   =   PARTID   +   PMG*NR_PARTID
                                 0           0           0
   PARTID=1 makes no sense       0           1           0
                                 1           0           1
   PARTID=1 makes no sense       1           1           1

Given those reasons, we should take care the usage of rmid remap matrix,
two fields (
    @step_size: Step size from traversing the point of matrix once
    @step_cnt:  Indicates how many times to traverse(.e.g if cdp;step_cnt=2)
)
are added to struct rmid_transform for measuring allocation and realease
of monitor resource(RMIDs).

step_size is default set to 1, if only PMG(NR_PMG=4) works, makes it
equals to number of columns, step_cnt means how many times are allocated
and released each time, at this time rmid remap matrix looks like:

     ^
     |
      ------column------>

    RMID  0   1   2   3   (step_size=1)
          `---'
             `--> (step_cnt=2 if cdp enabled)

    RMID  0   1   2   3   (step_size=1)
          `--
             `--> (step_cnt=1 if cdp disabled)

if PARTID(NR_PARTID=4) and PMG(NR_PMG=4) works together, at this time
rmid remap matrix looks like:

     ------------row------------>
    |
    |  RMID  0   1   2   3   (step_size=1)
    |        `---'
    |           `--> (step_cnt=2 if cdp enabled)
    |        4   5   6   7
    |        8   9   10  11
    v	     12  13  14  15

In addition, it also supports step_size not equal to 1, cross-line
traversal, but this scenario did not happen.

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