[PATCH openEuler-testcase 0/3] arm64/mpam: Update mpam_limit.py for closid expansion

Zeng Heng (3): arm64/mpam: Fix L3MAX test case arm64/mpam: Adapt L3 cpbm test case for new chipset arm64/mpam: Update mpam_limit.py for closid expansion .../smoke-test/smoke-kernel/mpam/mpam_feat.py | 2 +- .../smoke-test/smoke-kernel/mpam/mpam_lib.py | 50 ++++++++++--------- .../smoke-kernel/mpam/mpam_limit.py | 29 ++++++----- .../smoke-test/smoke-kernel/mpam/mpam_main.py | 6 +-- .../smoke-kernel/mpam/mpam_precision.py | 2 +- .../smoke-test/smoke-kernel/mpam/mpam_smmu.py | 1 + 6 files changed, 49 insertions(+), 41 deletions(-) -- 2.25.1

Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- testcases/smoke-test/smoke-kernel/mpam/mpam_lib.py | 3 ++- testcases/smoke-test/smoke-kernel/mpam/mpam_precision.py | 2 +- testcases/smoke-test/smoke-kernel/mpam/mpam_smmu.py | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/testcases/smoke-test/smoke-kernel/mpam/mpam_lib.py b/testcases/smoke-test/smoke-kernel/mpam/mpam_lib.py index 1ee7ee6eb50b..a8b9d7fcc95b 100644 --- a/testcases/smoke-test/smoke-kernel/mpam/mpam_lib.py +++ b/testcases/smoke-test/smoke-kernel/mpam/mpam_lib.py @@ -194,6 +194,7 @@ def end_benchmark(proc, name): print(res.replace("\n", "")) elif name == "stress-ng": + proc.wait() if proc.returncode != 0: print(proc.stderr.decode()) @@ -238,7 +239,7 @@ def write_schmata(ctrl_grp, resource, cpuno, cnt, dom_id=-1): if "MB" in resource: cnt = ("%s:%d=%d" % (resource, dom_id, cnt)) - elif "PRIO" in resource or "MIN" in resource: + elif "PRIO" in resource or "MIN" in resource or "MAX" in resource: level = int(resource[1]) dom_id = find_cpu_to_cacheid(cpuno, level) cnt = ("%s:%d=%d" % (resource, dom_id, cnt)) diff --git a/testcases/smoke-test/smoke-kernel/mpam/mpam_precision.py b/testcases/smoke-test/smoke-kernel/mpam/mpam_precision.py index 566d67d9ebcd..943058e8044c 100644 --- a/testcases/smoke-test/smoke-kernel/mpam/mpam_precision.py +++ b/testcases/smoke-test/smoke-kernel/mpam/mpam_precision.py @@ -41,7 +41,7 @@ def run_l3_precision_test(): print("run_precision_test L3MAX begin:") mkdir_ctrl_group("p1", "") - for i in range(0, 101): + for i in range(1, 101): print("echo L3MAX:1=%d" % i) ret = os.system("echo L3MAX:1=%d > /sys/fs/resctrl/p1/schemata" % i) if ret: diff --git a/testcases/smoke-test/smoke-kernel/mpam/mpam_smmu.py b/testcases/smoke-test/smoke-kernel/mpam/mpam_smmu.py index b02f393a18c9..e7916be7bd91 100644 --- a/testcases/smoke-test/smoke-kernel/mpam/mpam_smmu.py +++ b/testcases/smoke-test/smoke-kernel/mpam/mpam_smmu.py @@ -122,6 +122,7 @@ def start_benchmark(ip_addr, dev_ip_addr, remote_ip_addr): return proc def end_benchmark(proc): + proc.wait() if proc.returncode != 0: print(proc.stderr.decode()) return -1 -- 2.25.1

Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- .../smoke-test/smoke-kernel/mpam/mpam_feat.py | 2 +- .../smoke-test/smoke-kernel/mpam/mpam_lib.py | 47 ++++++++++--------- .../smoke-test/smoke-kernel/mpam/mpam_main.py | 6 +-- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/testcases/smoke-test/smoke-kernel/mpam/mpam_feat.py b/testcases/smoke-test/smoke-kernel/mpam/mpam_feat.py index 3b957eb0640c..31028172dea0 100644 --- a/testcases/smoke-test/smoke-kernel/mpam/mpam_feat.py +++ b/testcases/smoke-test/smoke-kernel/mpam/mpam_feat.py @@ -160,5 +160,5 @@ def run_max_test(resource): else: benchmark = "stress-ng" - cnt = [0, 100] + cnt = [1, 100] return run_feat_test(feat, resource, cnt[0], cnt[1], benchmark) diff --git a/testcases/smoke-test/smoke-kernel/mpam/mpam_lib.py b/testcases/smoke-test/smoke-kernel/mpam/mpam_lib.py index a8b9d7fcc95b..5d5f82396510 100644 --- a/testcases/smoke-test/smoke-kernel/mpam/mpam_lib.py +++ b/testcases/smoke-test/smoke-kernel/mpam/mpam_lib.py @@ -121,18 +121,6 @@ def get_cpu_id(): return output.split()[4] def start_benchmark(cpuno, numa_id, name, resource): - if os.system("which numactl") == 1: - return -1 - - if os.system("which taskset") == 1: - return -1 - - if os.system("which bw_mem") == 1: - return -1 - - if os.system("which stress-ng") == 1: - return -1 - if name == "bw_mem": if resource == "L2": size = "4096M" @@ -154,12 +142,14 @@ def start_benchmark(cpuno, numa_id, name, resource): elif name == "stress-ng": size_KB = get_cache_size(cpuno, resource) + cpu_list = find_cpu_to_cache_sharelist(cpuno, resource) + print("%s size: %s" % (resource, size_KB)) if resource == "L2": command = "taskset -c %d stress-ng --cache 1 --aggressive -t 20s" % cpuno else: - command = "numactl -N %d stress-ng --cache 6 --aggressive -t 20s" % numa_id + command = "numactl -C %s stress-ng --cache 6 --aggressive -t 20s" % cpu_list print(command) try: @@ -200,9 +190,12 @@ def end_benchmark(proc, name): return -def find_cpu_to_cacheid(cpuno, cache_level): - cacheid_p = ("%s%d/cache/index%d/id" % - (cache_topology, cpuno, cache_level)) +def find_cpu_to_cacheid(cpuno, resource): + if resource[0] != 'L': + return -1 + + cacheid_p = ("%s%d/cache/index%c/id" % + (cache_topology, cpuno, resource[1])) fp = open(cacheid_p) cache_id = fp.read() @@ -210,6 +203,19 @@ def find_cpu_to_cacheid(cpuno, cache_level): return int(cache_id) +def find_cpu_to_cache_sharelist(cpuno, resource): + if resource[0] != 'L': + return -1 + + cacheid_p = ("%s%d/cache/index%c/shared_cpu_list" % + (cache_topology, cpuno, resource[1])) + + fp = open(cacheid_p) + cpu_list = fp.read() + fp.close() + + return cpu_list + def read_resource_monitor_val(ctrl_group, resource, id, monitor): monitor_p = ("%s/%s/mon_data/mon_%s_%02d/%s" % (resctrl_path, ctrl_group, resource, id, monitor)) @@ -222,8 +228,7 @@ def read_resource_monitor_val(ctrl_group, resource, id, monitor): def read_monitor_val(cpuno, resource, ctrl_group, monitor, dom_id=-1): if resource[0] == 'L': - level = int(resource[1]) - dom_id = find_cpu_to_cacheid(cpuno, level) + dom_id = find_cpu_to_cacheid(cpuno, resource) val = read_resource_monitor_val(ctrl_group, resource, dom_id, monitor) if not val: @@ -240,13 +245,11 @@ def write_schmata(ctrl_grp, resource, cpuno, cnt, dom_id=-1): cnt = ("%s:%d=%d" % (resource, dom_id, cnt)) elif "PRIO" in resource or "MIN" in resource or "MAX" in resource: - level = int(resource[1]) - dom_id = find_cpu_to_cacheid(cpuno, level) + dom_id = find_cpu_to_cacheid(cpuno, resource) cnt = ("%s:%d=%d" % (resource, dom_id, cnt)) else: - level = int(resource[1]) - dom_id = find_cpu_to_cacheid(cpuno, level) + dom_id = find_cpu_to_cacheid(cpuno, resource) cnt = ("%s:%d=%x" % (resource, dom_id, cnt)) print(path, cnt) diff --git a/testcases/smoke-test/smoke-kernel/mpam/mpam_main.py b/testcases/smoke-test/smoke-kernel/mpam/mpam_main.py index 7f1038bf6ce1..e7d22752ec28 100644 --- a/testcases/smoke-test/smoke-kernel/mpam/mpam_main.py +++ b/testcases/smoke-test/smoke-kernel/mpam/mpam_main.py @@ -115,7 +115,7 @@ def mpam_test_main(argv): if "max" in argv: if "L3" in argv: - if "920G" == mpam_lib.get_cpu_id(): + if mpam_lib.get_cpu_id() in ["950", "920G"]: if run_max_test("L3"): return -1 @@ -124,7 +124,7 @@ def mpam_test_main(argv): if run_min_test("MB"): return -1 if "L3" in argv: - if "920G" == mpam_lib.get_cpu_id(): + if mpam_lib.get_cpu_id() in ["950", "920G"]: if run_min_test("L3"): return -1 @@ -148,7 +148,7 @@ def mpam_test_main(argv): if run_precision_test(): return -1 if "L3" in argv: - if "920G" == mpam_lib.get_cpu_id(): + if mpam_lib.get_cpu_id() in ["950", "920G"]: if run_l3_precision_test(): return -1 -- 2.25.1

Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- .../smoke-kernel/mpam/mpam_limit.py | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/testcases/smoke-test/smoke-kernel/mpam/mpam_limit.py b/testcases/smoke-test/smoke-kernel/mpam/mpam_limit.py index 0765316e6762..2312a24fbd6a 100644 --- a/testcases/smoke-test/smoke-kernel/mpam/mpam_limit.py +++ b/testcases/smoke-test/smoke-kernel/mpam/mpam_limit.py @@ -45,11 +45,15 @@ def get_rmid_group(ctrl_grp, mon_group): return int(rmid) def read_threshold(res): - path = ("%s/info/%s_MON/max_threshold_occupancy" % (resctrl_path, res)) + try: + path = ("%s/info/%s_MON/max_threshold_occupancy" % (resctrl_path, res)) - fp = open(path) - size = fp.read() - fp.close() + fp = open(path) + size = fp.read() + fp.close() + + except FileNotFoundError: + return -1 return int(size) @@ -73,12 +77,10 @@ def run_limit_test(): pmg = get_pmg_number() size = read_threshold("L3") - if size < 0: - return -1 - - ret = disable_threshold("L3") - if ret: - return -1 + if size > 0: + ret = disable_threshold("L3") + if ret: + return -1 # create mon_group under root ctrl group print("ctrl_grp root rmid: %d" % get_rmid_group("", "")) @@ -121,9 +123,10 @@ def run_limit_test(): if mpam_lib.rmdir_ctrl_group(ctrl_grp, ""): return -1 - ret = write_threshold("L3", size) - if ret: - return -1 + if size > 0: + ret = write_threshold("L3", size) + if ret: + return -1 print("Pass: Check run_limit_test") return 0 -- 2.25.1
participants (1)
-
Zeng Heng