
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