contents
eas_one_small_task
eas_one_big_task
eas_small_to_big
eas_big_to_small
eas_small_big_toggle
eas_two_big_three_small
sched_cfs_prio
sched_dl_runtime
sched_latency_dl
sched_latency_rt
sched_prio_3_fifo
sched_prio_3_rr
sugov_latency
sugov_wakeups
sched_boost
setupstage:
- configure and enable tracing(/sys/kernel/tracing):
- Analysis of trace parsed
- Loading trace, press-defined structure struct trace_record {} format parsing
- echo 0 > tracing_on //disable tracing
- Creating a while (1) task eas_one_small_t, each sleep 1ms up and running about, after the end of 5s.
- echo 0 > tracing_on //disable tracing
echo 16384 > buffer_size_kb //setup buffer size
echo sched_switch > set_event //setup trace event
echo > trace //clear trace log buffer
echo 1 > tracing_on //enable tracing
verifystage:
- Trace event in the trace log is sched_switch by t-> next_pid == small_task_tid acquisition starting time of running of the task eas_one_small_t;
- Trace event in the trace log is sched_switch by t-> prev_pid = small_task_tid obtained task eas_one_small_t end running time!;
- Statistics all running period of time and
- Acquired by the capacity of the small core cpuset, when a trace occurs at the small core, the small core to the accumulated running time correct_us; cumulative running all the time to total_us;
- correct_us/total_us ≥ 90% ? pass : fail
That is, when the small core task total accumulated running time of the running time of more than 90%, case by test
sh-4.4# ./eas_one_small_task
/home/apuser/sprdebian_trunk/platform/test/ltp/lib/tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/eas_one_small_task.c:94: INFO: Minimum correct cluster time percentage: 90%
Small task executing for 5s...
Total time task scheduled: 108208 usec
Time scheduled on a little CPU: 108208 usec (100%)
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/eas_one_small_task.c:113: PASS: Small task ran appropriately on small CPUs.
Summary:
passed 1
failed 0
skipped 0
warnings 0
sh-4.4#
setupstage:
- configure and enable tracing(/sys/kernel/tracing):
- Analysis of trace parsed
- Loading trace, press-defined structure struct trace_record {} format parsing
- echo 0 > tracing_on //disable tracing
- Creating a while (1) task eas_one_big_tas, after the end of continuous operation 3s.
- echo 0 > tracing_on //disable tracing
echo 16384 > buffer_size_kb //setup buffer size
echo sched_switch > set_event //setup trace event
echo > trace //clear trace log buffer
echo 1 > tracing_on //enable tracing
verifystage:
- Trace event in the trace log is sched_switch by t-> next_pid == big_task_tid acquisition starting time of running of the task eas_one_big_tas;
- Trace event in the trace log is sched_switch by t-> prev_pid = big_task_tid obtained task eas_one_big_tas end running time!;
- 1/2 timestamp recorded by calculating a running time period
- Acquired by the capacity of the large core cpuset, when a trace occurs at a large core, the accumulated running time to the large core correct_us; cumulative running all the time to total_us;
- Record time task eas_one_big_tas started execution: start_ts_usec
Record task eas_one_big_tas start time in large nuclear executed: upmigration_ts_usec
Computing task eas_one_big_tas begin to migrate from the nucleus to the large delay: upmigration_latency_usec = upmigration_ts_usec - start_ts_usec
- correct_us/total_us ≥ 90% ? pass : fail
That is, when the small core task total accumulated running time of the running time of more than 90%, case by test
sh-4.4# ./eas_one_big_task
/home/apuser/sprdebian_trunk/platform/test/ltp/lib/tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/eas_one_big_task.c:109: INFO: Minimum correct cluster time percentage: 90%
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/eas_one_big_task.c:111: INFO: Maximum upmigration latency: 100000 usec
Big task executing for 3s...
Total time task scheduled: 3000382 usec
Time scheduled on a big CPU: 2977518 usec (99%)
Upmigration latency: 22965 usec
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/eas_one_big_task.c:132: PASS: Task placement/migration latency met requirements.
Summary:
passed 1
failed 0
skipped 0
warnings 0
setupstage:
- configure and enable tracing(/sys/kernel/tracing):
echo 0 > tracing_on //disable tracing
echo 16384 > buffer_size_kb //setup buffer size
echo sched_switch > set_event //setup trace event
echo > trace //clear trace log buffer
echo 1 > tracing_on //enable tracing
- a) Create a task eas_small_to_bi, as a small task to run at every sleep 1ms up for 3s;
b) Print "CPU HOG" trace in the trace of the marker;
c) After a big task as the continuous operation 3s end.
- echo 0 > tracing_on //disable tracing
- Loading trace, press-defined structure struct trace_record {} format parsing
- Analysis of trace parsed
verifystage:
- Trace event in the trace log is sched_switch by t-> next_pid == task_tid acquisition starting time of running of the task eas_small_to_bi;
- Trace event in the trace log is sched_switch by t-> prev_pid == task_tid obtaining an end time of running of the task eas_small_to_bi;
- 1/2 timestamp recorded by calculating a running time period
- Record "CPU HOG" Trace marker timestamp: cpuhog_ts_usec;
Migrating to a timestamp recording task started running a large nucleus: upmigrate_ts_usec (after cpuhog_ts_usec first <t-> next_pid == task_tid> and not on a small core
timestamp corresponding trace log)
- After recording big task upmigration, at run-time small nuclear wrong: too_small_cpu_us (after cpuhog_ts_usec and upmigrate_ts_usec time, this time task is already a big task, task at run time small nuclear);
- Small task in record time run large-core: too_big_cpu_us (before cpuhog_ts_usec, task is the small task)
- running time of recording big task: big_task_us (on a small core and large core big task running all the time)
- Record the running time of Small Task: Small_Task_us (all time for Small Task Running on the small core and big nucleus)
- Calculate DELAY Time of Big Task Upmigration: Upmigration_TS_USEC
- (too_big_cpu_us/small_task_us > 10% || too_small_cpu_us/big_task_us > 10% || upmigration_ts_usec > 100ms) ? fail : pass
That is, the small Task is 10% below the total TASK run time, and the big task runs at the small core running time in the small nucleation time of 10% of the total Task run time after Upmigration, and the large TASK Upmigration delay is less than 100 ms. , CASE test
sh-4.4# ./eas_small_to_big
/home/apuser/sprdebian_trunk/platform/test/ltp/lib/tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/eas_small_to_big.c:144: INFO: Maximum incorrect cluster time percentage: 10%
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/eas_small_to_big.c:146: INFO: Maximum upmigration latency: 100000 usec
Small task executing for 3s...
Changing to big task...
Time incorrectly scheduled on big when task was small: 0 usec (0% of small task CPU time)
Time incorrectly scheduled on small when task was big, after upmigration: 0 usec (0% of big task CPU time)
Upmigration latency: 29516 usec
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/eas_small_to_big.c:167: PASS: Task placement and migration latency goals were met.
Summary:
passed 1
failed 0
skipped 0
warnings 0
SETUP phase:
- configure and enable tracing(/sys/kernel/tracing):
echo 0 > tracing_on //disable tracing
echo 16384 > buffer_size_kb //setup buffer size
echo sched_switch > set_event //setup trace event
echo > trace //clear trace log buffer
echo 1 > tracing_on //enable tracing
- a) Create a Task EAS_BIG_TO_SMAL as a large TASK continuously runs 3s;
b) Print "Small Task" TRACE MARKER in Trace;
c) When the small TASK is running every Sleep 1 ms, the end of the 3s lasts.
- echo 0 > tracing_on //disable tracing
- Load TRACE and analyze the defined structural struct track_record {} format
- Analysis analysis after TRACE
verifystage:
- In Trace Event is the TRACE_SWITCH TRACE LOG, get the start Running time of Task EAS_BIG_TO_SMAL by t-> next_pid == TASK_TID;
- In Trace Event is the TRACE log of SCHED_SWITCH, the end running time of Task EAS_BIG_TO_SMAL is obtained by t-> prev_pid == task_tid;
- Calculate the time of a running time period by a timestamp recorded in 1/2
- Record "Small Task" TRACE MARKER Timestamp: SmallTask_TM_USEC;
Record a small Task start Running timestamp: SmallTask_ts_usec (the first <t-> next_pid == TASK_TID> TRACE LOG after smaltask_tm_usec)
Record a small Task to start a timestamp of the small core ruuning: Downmigrate_ts_usec (the first timestamp corresponding to the <t-> next_pid == task_tid> TRACE LOG in the small core) after SmallTask_TS_USEC
- Record big task running time in the small core: TOO_SMALL_CPU_US (Before SmallTask_TS_USEC, it is big Task as the time of large TASK running in small core);
- Record small Task's running time in the big core: TOO_BIG_CPU_US (after smalltask_ts_usec is small Task, and after DOWNMIGRATE_TS_USEC, it is the time after the small Task Down Migrate to the small core, the error is running in the queue.
- Record BIG TASK Running Time: BIG_TASK_US (all time for Big Task Running on the small core and big core)
- Record the running time of Small Task: Small_Task_us (all time for Small Task Running on the small core and big nucleus)
- DELAY Time of Down Migration after the Small Task: DOWNMIGRATE_LATENCY_USEC = DOWNMIGRATE_TS_USEC - SmallTask_ts_usec
- (too_big_cpu_us/small_task_us > 10% || too_small_cpu_us/big_task_us > 10% || downmigrate_latency_usec > 100ms) ? fail : pass
That is, the small Task is 10% below the total run time of the small TASK, and the big task runs at the small core running time in the US Task running time in the US Task, and the small Task's Downmigration Delay is less than 100 ms. , CASE test
sh-4.4# ./eas_big_to_small
/home/apuser/sprdebian_trunk/platform/test/ltp/lib/tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/eas_big_to_small.c:144: INFO: Maximum incorrect cluster time percentage: 10%
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/eas_big_to_small.c:146: INFO: Maximum downmigration latency: 100000 usec
Big task executing for 3s...
Changing to small task...
Time incorrectly scheduled on small when task was big: 22493 usec (0% of big task CPU time)
Time incorrectly scheduled on big when task was small, after downmigration: 0 usec (0% of small task CPU time)
Downmigration latency: 98975 usec
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/eas_big_to_small.c:167: PASS: Task placement/migration latency goals met.
Summary:
passed 1
failed 0
skipped 0
warnings 0
setupstage:
- configure and enable tracing(/sys/kernel/debugging/tracing):
echo 0 > tracing_on //disable tracing
echo 16384 > buffer_size_kb //setup buffer size
echo sched_switch > set_event //setup trace event
echo > trace //clear trace log buffer
echo 1 > tracing_on //enable tracing
- a) Create a task EAS_SMALL_BIG_T;
b) Print "Small Task" TRACE MARKER in Trace;
c) As a small Task (running every Sleep 1 ms), lasting 1s;
d) Print "CPU HOG" TRACE MARKER in Trace;
e) Run 1s as a large TASK (continuous);
f) Repeat C / D 10 times
- echo 0 > tracing_on //disable tracing
- Load TRACE and analyze the defined structural struct track_record {} format
- Analysis analysis after TRACE
verifystage:
- In Trace Event is the TRACE LOG of SCHED_SWITCH, the start Running time of Task EAS_SMALL_BIG_T by t-> next_pid == task_tid;
- In Trace Event is the TRACE LOG of Sched_Switch, the end running time of Task EAS_SMALL_BIG_T by t-> prev_pid == TASK_TID;
- Calculate the time of a running time period by a timestamp recorded in 1/2
- a) Record the timestamp of the large TASK in each Cycle: cpuhog_ts_usec ("CPU HOG" TRACE MARKER Time Stamp);
b) Record the timestamp of each Cycle in the small Task start Running: SmallTask_ts_usec ("Small Task" TRACE MARKER Timestamp)
c) Record the timestamp of each cycle to start in the small core ruuning: Downmigrate_ts_usec (in "Small Task" Tracer Marker, the first timestamp corresponding to the <t-> next_pid == Task_tid> TRACE LOG in the small core after "Small Task" TRACER MARKER
d) Record the timestamp of each Cycle in the large nuclear Running: upmigrate_ts_usec (in "CPU HOG" Tracer Marker, the first timestamp corresponding to the <t-> next_pid == task_tid> trace log )
- a) In the "CPU HOG" TRACE MARKER time point, calculate the current Cycle Small Task Downmigrate Latency = DOWNMIGRATE_TS_USEC - SmallTask_TS_USEC, and the calculation is completed to record DOWNMIGRATE_TS_USEC and SMALLTASK_TS_USEC to zero. Take all the maximum of CYCLE: max_downmigrate_lantency_usec
b) In the "Small Task" TRACE MARKER Time Point, calculate this time point in a cycle, big task upmigrate latency = upmigrate_ts_usec - cpuhog_ts_usec, the calculation is completed to record the current CYCLE UPMIGRATE_TS_USEC and CPUHOG_TS_USEC to zero them. Take all the maximum of CYCLE: max_upmigrate_lantency_usec
- Tired to increase Task Run time in the small core: TOO_SMALL_CPU_US (after "CPU HOG" TRACE MARKER as big Task Run, after Upmigrate_TS_USEC migrates to the big core, the error is running in the small core.
- Recording a small Task running time in the nucleus: TOO_BIG_CPU_US (in Small Task "TRACE MARKER as a small Task Run, and after DOWNMIGRATE_TS_USEC migrates to the small core, the error is running in the nucleus.
- Record BIG TASK Running Time: BIG_TASK_US (all time for Big Task Running on the small core and big core)
- Record the running time of Small Task: Small_Task_us (all time for Small Task Running on the small core and big nucleus)
- (too_big_cpu_us/small_task_us > 10% || too_small_cpu_us/big_task_us > 10% || max_downmigrate_latency_usec > 100ms) || max_upmigrate_lantency_usec > 100ms ? fail : pass
That is, the small Task runs at the quadruption of 10% of the total Task run time. Big Task is running at the small core in the US Task running time below 10% of the total Task running time, and the largest Downmigration delay of small Task is less than 100ms. At the time, the largest Upmigration delay of big task is less than 100ms, and the CASE test passes.
sh-4.4# ./eas_small_big_toggle
/home/apuser/sprdebian_trunk/platform/test/ltp/lib/tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/eas_small_big_toggle.c:197: INFO: Maximum incorrect cluster time percentage: 10%
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/eas_small_big_toggle.c:199: INFO: Maximum downmigration latency: 100000 usec
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/eas_small_big_toggle.c:201: INFO: Maximum upmigration latency: 100000 usec
Task alternating between big and small for 20 sec
Time incorrectly scheduled on big when task was small, after downmigration: 0 usec (0% of small task CPU time)
Time incorrectly scheduled on small when task was big, after upmigration: 0 usec (0% of big task CPU time)
small task time: 840238
big task time: 9357025
Maximum upmigration time: 30498
Maximum downmigration time: 106469
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/eas_small_big_toggle.c:222: FAIL: Task placement and migration latency goals were not met.
Summary:
passed 0
failed 1
skipped 0
warnings 0
setupstage:
- configure and enable tracing(/sys/kernel/debugging/tracing):
echo 0 > tracing_on //disable tracing
echo 16384 > buffer_size_kb //setup buffer size
echo sched_switch > set_event //setup trace event
echo > trace //clear trace log buffer
echo 1 > tracing_on //enable tracing
- Create 5 task EAS_TWO_BIG_THR, two big Task and three small Task run 3s;
- echo 0 > tracing_on //disable tracing
- Load TRACE and analyze the defined structural struct track_record {} format
- Analysis analysis after TRACE
verifyStage (respectivelytask):
- In Trace Event is the TRACE LOG of SCHED_SWITCH, the start Running time of Task EAS_TWO_BIG_THR by t-> next_pid == TASK_TID;
- In the Trace Event is the TRACE LOG of SCHED_SWITCH, the end running time of Task EAS_TWO_BIG_THR is obtained by t-> prev_pid == task_tid;
- Calculate Task a running time period by a timestamp recorded in 1/2: segment_us
- Tired to increase Task Running time in the small core: incorrect_us [j] (4 ≥ j ≥ 3);
Tired of small Task running time in the nucleus: incorrect_us [j] (2 ≥ j ≥ 0)
- Total time for each Task Running: Total_us [J]
- (incorrect_us[j]/total_us[j] > 10%) ? fail : true
The time that each Task is calculated at the error CPU (large TASK runs on the small core, the small TASK is running on the big core) accounts for 10% of the Task's total run time, which is Pass.
4.1.2 Test Results
sh-4.4# ./eas_two_big_three_small
/home/apuser/sprdebian_trunk/platform/test/ltp/lib/tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/eas_two_big_three_small.c:114: INFO: Maximum incorrect cluster time percentage: 10%
Tasks running for 3 sec
Total time little task scheduled: 74833 Time scheduled on big CPU: 0 (0%)
Total time little task scheduled: 74548 Time scheduled on big CPU: 0 (0%)
Total time little task scheduled: 74580 Time scheduled on big CPU: 0 (0%)
Total time big task scheduled: 2999467 Time scheduled on little CPU: 18015 (0%)
Total time big task scheduled: 2999750 Time scheduled on little CPU: 18013 (0%)
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/eas_two_big_three_small.c:137: PASS: Task placement goals were met.
Summary:
passed 1
failed 0
skipped 0
warnings 0
setupstage:
- configure and enable tracing(/sys/kernel/debugging/tracing):
echo 0 > tracing_on //disable tracing
echo 16384 > buffer_size_kb //setup buffer size
echo sched_switch > set_event //setup trace event
echo > trace //clear trace log buffer
echo 1 > tracing_on //enable tracing
- Create 4 CFS Task Sched_CFS_PRIO, the priority is [-15, -5, 5, 15], and set CPU Affinity to exit after CPU0, 5S;
- echo 0 > tracing_on //disable tracing
- Load TRACE and analyze the defined structural struct track_record {} format
- Analysis analysis after TRACE
verifyStage (respectivelytask):
- Trace event in the trace log is sched_switch by t-> next_pid == task_tid acquisition starting time of running of the task eas_cfs_prio;
- Trace event in the trace log is sched_switch by t-> prev_pid == task_tid obtained task eas_cfs_prio end running time;
- Calculate Task a running time period by a timestamp recorded in 1/2: segment_us
- Each of the accumulated run time of each task;
- Total time for each Task Running: Total_us [J]
- The weights in the task corresponding to the user space in a nice value in kernel weight:
-15:29154
-5:3121
5:335
15:36
sum of weights:29154+3121+335+36=32646
Calculated for each task expected running time:
29154/32646 = 89.3%,4465ms
3121/32646 = 9.56%,478ms
335/32646 = 1.02%,51ms
36/32646 = 0.11%, 5.5ms
- Lower_bound definitions and upper_bound, if the task of running time runtime_us: upper_bound ≥ runtime_us ≥ lower_bound, shall pass
lower_bound: max{(lower_bound_us = expected_us - 20000us) (lower_bound_pct = expected_us * 80%)}
upper_bound:max{(upper_bound_us = expected_us + 30000us) (upper_bound_pct = expected_us * 105%)}
sh-4.4# ./sched_cfs_prio
/home/apuser/sprdebian_trunk/platform/test/ltp/lib/tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
Running 4 CFS tasks concurrently for 5 sec
Task runtimes:
Task a (nice -15): 4476 ms (expected 4465 ms)
Task b (nice -5) : 478 ms (expected 478 ms)
Task c (nice 5) : 76 ms (expected 51 ms)
Task d (nice 15) : 12 ms (expected 5 ms)
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/sched_cfs_prio.c:205: PASS: Task runtimes within allowed margins of expected values.
Summary:
passed 1
failed 0
skipped 0
warnings 0
setupstage:
- configure and enable tracing(/sys/kernel/debugging/tracing):
echo 0 > tracing_on //disable tracing
echo 16384 > buffer_size_kb //setup buffer size
echo sched_switch > set_event //setup trace event
echo > trace //clear trace log buffer
echo 1 > tracing_on //enable tracing
- Create a cfs task, modify task properties by sched_setattr performing the function of task for DLtask:
initialization
attr.size = sizeof(attr)
attr.sched_flags = 0
attr.sched_nice = 0
attr.sched_priority = 0
attr.sched_runtime = 5000000
attr.sched_period = 20000000
attr.sched_deadline = 10000000
The creation of a DL task, a period of 20ms, to run at least 5ms within 10ms deadline time. task were running 3s, run every 5ms by sched_yield let the CPU, schedule idle task. So far we did not create a new task (CFS or RT) and DL bound to run on the same CPU, and the idle task only be co-schedule. DL task can not set binding sched_setaffinity CPU, can only be set by CPUSET, details refer to:
https://stackoverflow.com/questions/50165719/sched-setaffinity-for-sched-deadline
https://elixir.bootlin.com/linux/v4.17-rc3/source/Documentation/scheduler/sched-deadline.txt#L634
- echo 0 > tracing_on //disable tracing
- Load TRACE and analyze the defined structural struct track_record {} format
- Analysis analysis after TRACE
verifystage:
- Trace event in the trace log is sched_switch by t-> next_pid == task_tid acquisition starting time start_ts_us task sched_dl_runtim of running;
- Trace event in the trace log is sched_switch by t-> prev_pid == task_tid obtaining an end time of running of the task sched_dl_runtim end_ts_us;
- When the first task starts running, provided sched_period expiration timestamp (next_period_ts_us = start_ts_us + 20000) and sched_deadline expiration timestamp (sched_deadline_ts_us = start_ts_us + 10000)
- At the end of the task running,
a) the accumulated running time of the task in the sched_period period_exec_time_us;
b) If the end time of the task exceeds the task in the current sched_period of sched_deadline time, set the end time for the task sched_deadline time;
c)reset start_ts_us = 0
- If more than one trace timestamp sched_period,
a) If the task period in this period, the total running time period_exec_time_us <5ms, i.e., did not reach the minimum required operating time, test Fail;
b) accumulating statistics sched_peroid count: periods_parsed
Under c) modifying a timestamp expires sched_peroid: next_period_ts_us + = 20000
Modifying a timestamp expires next sched_deadline: next_deadline_ts_us + = 20000
- After all trace log line analysis is complete, the pass log output periods_parsed
sh-4.4# ./sched_dl_runtime
/home/apuser/sprdebian_trunk/platform/test/ltp/lib/tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
150 periods parsed successfully.
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/sched_dl_runtime.c:192: PASS: DL task ran as expected.
Summary:
passed 1
failed 0
skipped 0
warnings 0
setupstage:
- configure and enable tracing(/sys/kernel/debugging/tracing):
echo 0 > tracing_on //disable tracing
echo 16384 > buffer_size_kb //setup buffer size
echo sched_switch > set_event //setup trace event
echo > trace //clear trace log buffer
echo 1 > tracing_on //enable tracing
- a) create a CFS task, after sleep 5ms, print "WAKING" of trace_marker, release semaphore, quit after running 1s.
b) create a RT task, the task of executing the function in sched_setattr modify task properties for DLtask by, waiting for the semaphore, the semaphore wait until exit.
Currently not yet implemented a DL task to bind to a specific cpu, but DL task of the highest priority, even if they are different from wakeup to CFS task is running the CPU, does not affect the test results.
DL task can not set binding sched_setaffinity CPU, can only be set by CPUSET, details refer to:
https://stackoverflow.com/questions/50165719/sched-setaffinity-for-sched-deadline
https://elixir.bootlin.com/linux/v4.17-rc3/source/Documentation/scheduler/sched-deadline.txt#L634
- echo 0 > tracing_on //disable tracing
- Load TRACE and analyze the defined structural struct track_record {} format
- Analysis analysis after TRACE
verifystage:
- Get DL Task's time for DL Task by DL_TASK_TID EVENT
- Gets the time of running Running Running by NEXT_PID = DL_TASK_TID and SCHED_SWITCH EVENT in TRACE
- Calculate DL Task from Wakup to Running DELAY: DL_EXEC_LATENCY_US
- If DL_EXEC_LATENCY_US> 100US, test fail
sh-4.4# ./sched_latency_dl
/home/apuser/sprdebian_trunk/platform/test/ltp/lib/tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
DL exec latency: 202 usec
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/sched_latency_dl.c:155: FAIL: DL task did not execute within expected latency of 100 usec.
Summary:
passed 0
failed 1
skipped 0
warnings 0
setupstage:
- configure and enable tracing(/sys/kernel/debugging/tracing):
echo 0 > tracing_on //disable tracing
echo 16384 > buffer_size_kb //setup buffer size
echo sched_switch > set_event //setup trace event
echo > trace //clear trace log buffer
echo 1 > tracing_on //enable tracing
- a) Create a CFS Task, bind to CPU0, after Sleep 5ms, print "WAKING" TRACE_MARKER, release the semaphore, and exit after running 1s.
b) Create an RT Task, bind to CPU0, wait for the Semaphore, wait until the Semaphore exits.
- echo 0 > tracing_on //disable tracing
- Load TRACE and analyze the defined structural struct track_record {} format
- Analysis analysis after TRACE
verifystage:
- Get Rt Task's time when Rt Task is Wakeup via rt_task_tid and sched_wakup event
- Get Rt Task to start Running time through the next_pid = rt_task_tid and sched_switch event
- Calculate RT Task from Wakup to Start Running DELAY: RT_EXEC_LATENCY_US
- If RT_EXEC_LATENCY_US> 100US, test fail
sh-4.4# ./sched_latency_rt
/home/apuser/sprdebian_trunk/platform/test/ltp/lib/tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
RT exec latency: 10 usec
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/sched_latency_rt.c:140: PASS: RT task executed within required latency of 100 usec..
Summary:
passed 1
failed 0
skipped 0
warnings 0
setupstage:
- configure and enable tracing(/sys/kernel/debugging/tracing):
echo 0 > tracing_on //disable tracing
echo 16384 > buffer_size_kb //setup buffer size
echo sched_switch sched_wakeup sched_process_exit > set_event //setup trace event
echo > trace //clear trace log buffer
echo 1 > tracing_on //enable tracing
- a) Create 6 different priority RT Thread, initialize the function and SEM semantic amount of each Thread, respectively:
thread_name prio function_name semaphore
rt_low_a(la) 70 rt_low_fn_a(lfa) sem_low_a(sla)
rt_low_b(lb) 70 rt_low_fn_b(lfb) sem_low_b(slb)
rt_med_a(ma) 75 rt_med_fn_a(mfa) sem_med_a(sma)
rt_med_b(mb) 75 rt_med_fn_b(mfb) sem_med_b(smb)
rt_high_a(ha) 80 rt_high_fn_a(hfa) sem_high_a(sha)
rt_high_b(hb) 80 rt_high_fn_b(hfb) sem_high_b(shb)
b) Each RT THREAD sets CPU Affinity (CPU0) in Function, and LFA After S (3), print "Test Start" TRACE MARKER, then release the lock, the identification test starts. The logic relationship is as follows:
lfa->s(3)->post(&slb)->r(3)
lfb------->wait(&slb)->post(&sma)àr(1)
mfa---------------------->wait(&sma)>s(3)->post(&smb)->r(3)
mfb------------------------------------------------>wait(&smb)->post(&sha)
hfa------------------------------------------------------------------>wait(&sha)->s(1)->post(shb)->r(3)
hfb-------------------------------------------------------------------------------------------->wait(shb)
PS:
s(3): sleep 3ms
r(1): run 1ms
wait: sem_wait
post: sem_post
- echo 0 > tracing_on //disable tracing
- Load TRACE and analyze the defined structural struct track_record {} format
- Analysis analysis after TRACE
verifystage:
Define the desired Task behavior through array expected_event evnets []:
- RT_LOW_FN_A WAKEUP RT_LOW_FN_B (TASK of the same priority is running in successive enqueue)
(TODO)3ms goes by, rt_low_fn_a exits
- rt_low_fn_b starts running
- RT_LOW_FN_B WAKEUP RT_MED_FN_A (RT_MED_A is highly priority, preemptive RT_LOW_B)
- rt_med_fn_a starts running (sleeps 3ms immediately)
- rt_low_b continue running for 1ms
(TODO)1ms goes by, rt_low_b exits
- rt_med_fn_a wakeup after 3ms sleep
- rt_med_fn_a continue running
- RT_MED_FN_A WAKEUP RT_MED_FN_B (the same priority, RT_MED_FN_A is running until you are prejudice)
(TODO)3ms goes by, rt_med_fn_a exits
- rt_med_fn_b starts running
- RT_MED_FN_B WAKEUP RT_HIGH_FN_A (RT_High_a high priority, preemptive RT_MED_B)
- rt_high_fn_a starts running (sleep 1ms immediately)
- rt_med_fn_b continue running (exit immediately)
(TODO) rt_med_fn_b exit immediately
- rt_high_fn_a wakeup after 1ms sleep
- rt_high_fn_a starts running
- Rt_high_fn_a wakup ign high_fn_b (the same priority, RT_High_fn_a is not preemptive first)
(TODO)3ms goes by, rt_high_fn_a exit
- rt_high_fn_b starts running
sh-4.4# ./sched_latency_rt
/home/apuser/sprdebian_trunk/platform/test/ltp/lib/tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
RT exec latency: 10 usec
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/sched_latency_rt.c:140: PASS: RT task executed within required latency of 100 usec..
Summary:
passed 1
failed 0
skipped 0
warnings 0
setupstage:
- configure and enable tracing(/sys/kernel/debugging/tracing):
echo 0 > tracing_on //disable tracing
echo 16384 > buffer_size_kb //setup buffer size
echo sched_switch sched_wakeup sched_process_exit > set_event //setup trace event
echo > trace //clear trace log buffer
echo 1 > tracing_on //enable tracing
- a) Create 3 RT RR Threads of the same priority, initialize the function corresponding to each Thread, respectively:
thread_name prio function_name
rt_a 70 rt_a_fn
rt_b 70 rt_b_fn
rt_c 70 rt_c_fn
b) Each RT THREAD sets CPU Affinity (CPU0) in function, RT_A_FN After Sleep 3MS, print "Test Start" TRACE MARKER, then release the lock, the identification test starts. The logic relationship is as follows:
rt_a_fn->s(3)---------------->sem_post(&sem)/sem_post(&sem)->r(10000)
rt_b_fn->sem_wait(&sem)-------------------------------------------->r(10000)
rt_c_fn->sem_wait(&sem)-------------------------------------------->r(10000)
PS:
s(3): sleep 3ms
r(10000): running 10000ms
wait: sem_wait
post: sem_post
- echo 0 > tracing_on //disable tracing
- Load TRACE and analyze the defined structural struct track_record {} format
- Analysis analysis after TRACE
verifystage:
Calculate the operation of 3 RT RR Thread, respectively:
- In Trace Event is the TRACE LOG of SCHED_SWITCH, the start Running time of Task Sched_PRIO_3_RR via t-> next_pid == TASK_TID
In Trace Event is the TRACE LOG of SCHED_SWITCH, through t-> prev_pid == TASK_TID to get the end running time of Task Sched_PRIO_3_RR
- Cumulatory time, each running section, calculates the Running Time and the total length of each Thread:
a_exec_us
b_exec_us
c_exec_us
total = a_exec_us + b_exec_us + c_exec_us
- 32% ≤ ({a,b,c}_exec_us / total) ≤ 34%, pass
sh-4.4# ./sched_latency_rt
/home/apuser/sprdebian_trunk/platform/test/ltp/lib/tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
RT exec latency: 10 usec
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/sched_latency_rt.c:140: PASS: RT task executed within required latency of 100 usec..
Summary:
passed 1
failed 0
skipped 0
setupstage:
- configure and enable tracing(/sys/kernel/debugging/tracing):
echo 0 > tracing_on //disable tracing
echo 16384 > buffer_size_kb //setup buffer size
echo sched_process_exit sched_process_fork cpu_frequency > set_event //setup trace event
echo > trace //clear trace log buffer
echo 1 > tracing_on //enable tracing
- a) Create a CFS Task
b) Bind to the maximum CPU X of CPU Number
c) Sleep 200us, waiting for Task to migrate to the binding CPU
d) Cycle Sleep 100ms until Task drops to the lowest frequency
f) Print TRACE Marker "Affined"
g) as a Task Running 500MS
h) Print Trace Marker "Small Task"
i) as a small Task Running 500MS
- echo 0 > tracing_on //disable tracing
- Load TRACE and analyze the defined structural struct track_record {} format
- Analysis analysis after TRACE
verifystage:
- Loop TRACE Marker "Affined", recorded TRACE ID: START_IDX
- Loop TRACE Marker "Small Task", recorded TRACE ID: SLEEP_IDX
- Looking for the first time between START_IDX and SLEEP_IDX, the maximum frequency point, record the highest frequency point value: max_freq_seen, record the id: max_freq_seen_idx
- Looking for TRACEs in Sleep_IDX and the end of TRAC, the minimum frequency point value: min_freq_seen, recorded TRACE ID: min_freq_seen_IDX
- / SYS / DEVICES / SYSTEM / CPU / CPUX / CPUFREQ / Scaling_Max_FReq Gets the highest frequency of CPU X
- / sys / defices / system / cpu / cpux / cpufreq / scaling_min_freq Get the lowest frequency of CPU X
- Calculation rise frequency delay: increasE_Latency_usec = timestamp [MAX_FREQ_SEEN_IDX] - TimeStamp [Start_IDX]
- Calculate reduction rate delay: decreasE_Latency_usec = timestamp [min_freq_seen_idx] - TimeStamp [Sleep_IDX]
- If the boost is delayed (INCREASE_LATENCY_USEC> 70MS) || (Decrease_Latency_usec> 70ms), Test Fail
sh-4.4# ./sugov_latency
/home/apuser/sprdebian_trunk/platform/test/ltp/lib/tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/sugov_latency.c:200: INFO: Max acceptable latency to fmax: 70000 usec
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/sugov_latency.c:202: INFO: Max acceptable latency to fmin: 70000 usec
CPU hog will be bound to CPU 7.
CPU7 reached 2002 MHz during test (scaling_max_freq 2002 MHz).
CPU7 reached 1228 MHz after test (scaling_min_freq 1228 Mhz).
Increase latency: 21309 usec
Decrease latency: 9196 usec
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/sugov_latency.c:224: PASS: Governor met latency targets.
Summary:
passed 1
failed 0
skipped 0
warnings 0
setupstage:
- configure and enable tracing(/sys/kernel/debugging/tracing):
echo 0 > tracing_on //disable tracing
echo 16384 > buffer_size_kb //setup buffer size
echo sched_process_exit sched_process_fork cpu_frequency > set_event //setup trace event
echo > trace //clear trace log buffer
echo 1 > tracing_on //enable tracing
- sleep 10s
- echo 0 > tracing_on //disable tracing
- Load TRACE and analyze the defined structural struct track_record {} format
- Analysis analysis after TRACE
verifystage:
By looking for "next_comm = sugov" in Trace, Schedutil Governor Thread is awakened, statistics: num_sugov_wakeups> 100, test failed
sh-4.4# ./sugov_wakeups
/home/apuser/sprdebian_trunk/platform/test/ltp/lib/tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/sugov_wakeups.c:34: INFO: Observing sugov wakeups over 10 sec, 100 wakeups allowed
24 sugov wakeups occurred.
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/sugov_wakeups.c:62: PASS: Wakeups from schedutil governor were below threshold.
Summary:
passed 1
failed 0
skipped 0
warnings 0
setupstage:
- Initialization semaphore:
Test_sem is used for the synchronization of the test execution between the parent (control thread).
Result_sem is used for synchronization of test results between parent and child threads
- Check node / dev / stune exists (readable)
- Create a test path under / dev / stune
STUNE_TEST_PATH = "/ dev / stune / test", test under this node
- Check if the General Stune parameter configuration node exists and initializes
- Create a sub-thread test_thread, used to specifically perform a test of a STUNE configuration
- configure and enable tracing(/sys/kernel/debugging/tracing):
echo 0 > tracing_on //disable tracing
echo 16384 > buffer_size_kb //setup buffer size
echo sched_boost_cpu sched_switch > set_event //setup trace event
- Loop execute different Boost settings and resolve Trace
| Parent Process SCHED_BOOST |
Sub process Test_thread |
| run_test (test_index=0; test_index<NUM_TESTS); Set Test / SchedTune.boost] = 0 (TEST_BOOST [0]); Echo> TRACE, Empty Trace Buffer; |
Create a child process Test_thread and start performing Test_fn; Bind Test_thread to the maximum Number CPU Test_CPU; Set Task to "/ dev / stune / test / tasks"; sem_wait(&test_sem) {test_done< NUM_TESTS} |
| sem_post(&test_sem); sem_wait(&result_sem); |
|
| |
Do_Work (), waiting for inseparable system load running; Echo 1> Tracing_on, enable Trace; do_work(), set_post(&result_sem) test_done++ |
| echo 0 > tracing_on, disable trace; Analyze the Trace in the buffer, save the data into Test_Utils []; test_index ++ |
|
| Different Boost values are completed, the Remove Test directory; Analyze the results in Test_Utils [] and whether it is expected to match |
|
PS: Do_Work Create a Signal, every run 1000us, Sleep 19000US. A total of 500ms, that is, 250 RUN / SLEP cycles, this Pattern load is a small load, about 0.
verifystage:
a) When analyzing the trace in the buffer, all Test_CPUs on the Loop Test_CPU Event, get the maximum boost_cpu_util after Boost, saved to the Test_Utils [Test_index] array;
b) Calculate Test_util, compare Test_UTIL in the following range:
(test_boost[i]*10 – 50)≤test_util[i]≤(test_boost[i]*10+50)
ssh-4.4# ./sched_boost
/home/apuser/sprdebian_trunk/platform/test/ltp/lib/tst_test.c:1217: INFO: Timeout per run is 0h 05m 00s
Running 5 tests for 1 sec
CPU hog will be bound to CPU 7.
Max util seen for boost 0: 42
Max util seen for boost 25: 287
Max util seen for boost 50: 536
Max util seen for boost 75: 785
Max util seen for boost 100: 1024
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/sched_boost.c:142: PASS: Test 0 (boost 0) passed with util 42 (allowed -50 - 50).
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/sched_boost.c:142: PASS: Test 1 (boost 25) passed with util 287 (allowed 200 - 300).
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/sched_boost.c:142: PASS: Test 2 (boost 50) passed with util 536 (allowed 450 - 550).
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/sched_boost.c:142: PASS: Test 3 (boost 75) passed with util 785 (allowed 700 - 800).
/home/apuser/sprdebian_trunk/platform/test/ltp/testcases/unisoc/sched/eas/sched_boost.c:142: PASS: Test 4 (boost 100) passed with util 1024 (allowed 950 - 1050).
Summary:
passed 5
failed 0
skipped 0
warnings 0