perf_event_open02: set process as RT during Setup stage Move the action of set the task RT from the Verify stage to the Setup stage. Avoid potential risks of task migration due to scheduler policy. Test: run vts -m vts_ltp_test_arm_64 Change-Id: I3435c2b29b885cbc0591eaf625e59f3de076fc9f Signed-off-by: kuan-ying.zhu <kuan-ying.zhu@mediatek.com>
diff --git a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c index bf6291d..27cc83c 100644 --- a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c +++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
@@ -198,6 +198,12 @@ { int i; struct perf_event_attr tsk_event, hw_event; + struct sched_param sparam = {.sched_priority = 1}; + + if (sched_setscheduler(0, SCHED_FIFO, &sparam)) { + tst_brk(TBROK | TERRNO, + "sched_setscheduler(0, SCHED_FIFO, ...) failed"); + } for (i = 0; i < MAX_CTRS; i++) { hwfd[i] = -1; @@ -271,12 +277,7 @@ unsigned long long vtsum = 0, vhsum = 0; int i; double ratio; - struct sched_param sparam = {.sched_priority = 1}; - - if (sched_setscheduler(0, SCHED_FIFO, &sparam)) { - tst_brk(TBROK | TERRNO, - "sched_setscheduler(0, SCHED_FIFO, ...) failed"); - } + struct sched_param sparam = {.sched_priority = 0}; all_counters_set(PR_TASK_PERF_EVENTS_ENABLE); do_work(8);