[Ltp] [eas] test cases resolved

tags: linux  kernel  schedule

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


  • eas_one_small_task

setupstage:

  1. configure and enable tracing(/sys/kernel/tracing):
  2. Analysis of trace parsed
  3. Loading trace, press-defined structure struct trace_record {} format parsing
  4. echo 0 > tracing_on                          //disable tracing
  5. Creating a while (1) task eas_one_small_t, each sleep 1ms up and running about, after the end of 5s.
  6. 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:

  1. 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;
  2. 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!;
  3. Statistics all running period of time and
  4. 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;
  5. 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#
  • eas_one_big_task

setupstage:

  1. configure and enable tracing(/sys/kernel/tracing):
  2. Analysis of trace parsed
  3. Loading trace, press-defined structure struct trace_record {} format parsing
  4. echo 0 > tracing_on                          //disable tracing
  5. Creating a while (1) task eas_one_big_tas, after the end of continuous operation 3s.
  6. 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:

  1. 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;
  2. 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!;
  3. 1/2 timestamp recorded by calculating a running time period
  4. 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;
  5. 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
  6. 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
  • eas_small_to_big

setupstage:

  1. 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
  2. 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.
  3. echo 0 > tracing_on                          //disable tracing
  4. Loading trace, press-defined structure struct trace_record {} format parsing
  5. Analysis of trace parsed

verifystage:

  1. 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;
  2. 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;
  3. 1/2 timestamp recorded by calculating a running time period
  4. 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)
  5. 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);
  6. Small task in record time run large-core: too_big_cpu_us (before cpuhog_ts_usec, task is the small task)
  7. running time of recording big task: big_task_us (on a small core and large core big task running all the time)
  8. Record the running time of Small Task: Small_Task_us (all time for Small Task Running on the small core and big nucleus)
  9. Calculate DELAY Time of Big Task Upmigration: Upmigration_TS_USEC
  10. (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
  • eas_big_to_small

SETUP phase:

  1. 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
  2. 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.
  3. echo 0 > tracing_on                          //disable tracing
  4. Load TRACE and analyze the defined structural struct track_record {} format
  5. Analysis analysis after TRACE

verifystage:

  1. 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;
  2. 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;
  3. Calculate the time of a running time period by a timestamp recorded in 1/2
  4. 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
  5. 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);
  6. 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.
  7. Record BIG TASK Running Time: BIG_TASK_US (all time for Big Task Running on the small core and big core)
  8. Record the running time of Small Task: Small_Task_us (all time for Small Task Running on the small core and big nucleus)
  9. DELAY Time of Down Migration after the Small Task: DOWNMIGRATE_LATENCY_USEC = DOWNMIGRATE_TS_USEC - SmallTask_ts_usec
  10. (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
  • eas_small_big_toggle

setupstage:

  1. 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
  2. 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
  3. echo 0 > tracing_on                          //disable tracing
  4. Load TRACE and analyze the defined structural struct track_record {} format
  5. Analysis analysis after TRACE

verifystage:

  1. 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;
  2. 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;
  3. Calculate the time of a running time period by a timestamp recorded in 1/2
  4. 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 )
  5. 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
     
  6. 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.
  7. 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.
  8. Record BIG TASK Running Time: BIG_TASK_US (all time for Big Task Running on the small core and big core)
  9. Record the running time of Small Task: Small_Task_us (all time for Small Task Running on the small core and big nucleus)
  10.  (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
  • eas_two_big_three_small

setupstage:

  1. 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
  2. Create 5 task EAS_TWO_BIG_THR, two big Task and three small Task run 3s;
  3. echo 0 > tracing_on                          //disable tracing
  4. Load TRACE and analyze the defined structural struct track_record {} format
  5. Analysis analysis after TRACE

verifyStage (respectivelytask):

  1. 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;
  2. 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;
  3. Calculate Task a running time period by a timestamp recorded in 1/2: segment_us
  4. 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)
  5. Total time for each Task Running: Total_us [J]
  6. (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
  • sched_cfs_prio

setupstage:

  1. 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
  2. Create 4 CFS Task Sched_CFS_PRIO, the priority is [-15, -5, 5, 15], and set CPU Affinity to exit after CPU0, 5S;
  3. echo 0 > tracing_on                          //disable tracing
  4. Load TRACE and analyze the defined structural struct track_record {} format
  5. Analysis analysis after TRACE

verifyStage (respectivelytask):

  1. 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;
  2. Trace event in the trace log is sched_switch by t-> prev_pid == task_tid obtained task eas_cfs_prio end running time;
  3. Calculate Task a running time period by a timestamp recorded in 1/2: segment_us
  4. Each of the accumulated run time of each task;
  5. Total time for each Task Running: Total_us [J]
  6. 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
  7. 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
  • sched_dl_runtime

setupstage:

  1. 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
  2. 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
     
  3. echo 0 > tracing_on                          //disable tracing
  4. Load TRACE and analyze the defined structural struct track_record {} format
  5. Analysis analysis after TRACE

verifystage:

  1. 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;
  2. 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;
  3. 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)
  4. 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
  5. 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
  6. 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
  • sched_latency_dl

setupstage:

  1. 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
  2. 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
     
  3. echo 0 > tracing_on                          //disable tracing
  4. Load TRACE and analyze the defined structural struct track_record {} format
  5. Analysis analysis after TRACE

verifystage:

  1. Get DL Task's time for DL ​​Task by DL_TASK_TID EVENT
  2. Gets the time of running Running Running by NEXT_PID = DL_TASK_TID and SCHED_SWITCH EVENT in TRACE
  3. Calculate DL Task from Wakup to Running DELAY: DL_EXEC_LATENCY_US
  4. 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
  • sched_latency_rt

setupstage:

  1. 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
  2. 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.
  3. echo 0 > tracing_on                          //disable tracing
  4. Load TRACE and analyze the defined structural struct track_record {} format
  5. Analysis analysis after TRACE

verifystage:

  1. Get Rt Task's time when Rt Task is Wakeup via rt_task_tid and sched_wakup event
  2. Get Rt Task to start Running time through the next_pid = rt_task_tid and sched_switch event
  3. Calculate RT Task from Wakup to Start Running DELAY: RT_EXEC_LATENCY_US
  4. 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
  • sched_prio_3_fifo

setupstage:

  1. 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
  2. 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
  3. echo 0 > tracing_on                          //disable tracing
  4. Load TRACE and analyze the defined structural struct track_record {} format
  5. Analysis analysis after TRACE

verifystage:

Define the desired Task behavior through array expected_event evnets []:

  1. 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
  2. rt_low_fn_b starts running
  3. RT_LOW_FN_B WAKEUP RT_MED_FN_A (RT_MED_A is highly priority, preemptive RT_LOW_B)
  4. rt_med_fn_a starts running  (sleeps 3ms immediately)
  5. rt_low_b continue running for 1ms
    (TODO)1ms goes by, rt_low_b exits
  6. rt_med_fn_a wakeup after 3ms sleep
  7. rt_med_fn_a continue running
  8. 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
  9. rt_med_fn_b starts running
  10. RT_MED_FN_B WAKEUP RT_HIGH_FN_A (RT_High_a high priority, preemptive RT_MED_B)
  11. rt_high_fn_a starts running (sleep 1ms immediately)
  12. rt_med_fn_b continue running (exit immediately)
    (TODO) rt_med_fn_b exit immediately
  13. rt_high_fn_a wakeup after 1ms sleep
  14. rt_high_fn_a starts running
  15. 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
  16. 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
  • sched_prio_3_rr

setupstage:

  1. 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
  2. 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
  3. echo 0 > tracing_on                          //disable tracing
  4. Load TRACE and analyze the defined structural struct track_record {} format
  5. Analysis analysis after TRACE

verifystage:

Calculate the operation of 3 RT RR Thread, respectively:

  1. 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
  2. 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
  3. 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
  • sugov_latency

setupstage:

  1. 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
  2. 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
  3. echo 0 > tracing_on                          //disable tracing
  4. Load TRACE and analyze the defined structural struct track_record {} format
  5. Analysis analysis after TRACE

verifystage:

  1. Loop TRACE Marker "Affined", recorded TRACE ID: START_IDX
  2. Loop TRACE Marker "Small Task", recorded TRACE ID: SLEEP_IDX
  3. 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
  4. 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
  5. / SYS / DEVICES / SYSTEM / CPU / CPUX / CPUFREQ / Scaling_Max_FReq Gets the highest frequency of CPU X
  6. / sys / defices / system / cpu / cpux / cpufreq / scaling_min_freq Get the lowest frequency of CPU X
  7. Calculation rise frequency delay: increasE_Latency_usec = timestamp [MAX_FREQ_SEEN_IDX] - TimeStamp [Start_IDX]
  8. Calculate reduction rate delay: decreasE_Latency_usec = timestamp [min_freq_seen_idx] - TimeStamp [Sleep_IDX]
  9. 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
  • sugov_wakeups

setupstage:

  1. 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
  2. sleep 10s
  3. echo 0 > tracing_on                          //disable tracing
  4. Load TRACE and analyze the defined structural struct track_record {} format
  5. 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
  • sched_boost

setupstage:

  1. 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
  2. Check node / dev / stune exists (readable)
  3. Create a test path under / dev / stune
    STUNE_TEST_PATH = "/ dev / stune / test", test under this node
  4. Check if the General Stune parameter configuration node exists and initializes
  5. Create a sub-thread test_thread, used to specifically perform a test of a STUNE configuration
  6. 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          
  7. 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

 

Intelligent Recommendation

Ltp test suite - pthread_rwlock_rdlock_2-1 analysis record

The test pthread_rwlock_rdlock_2-1.c use case failed. The log is as follows: [83#yuchen@ubuntu ltp]# gcc 2-1.c -o 21 -pthread [84#yuchen@ubuntu ltp]# ./21 main: has priority: 3 main: attempt read lock...

Shell script example (2)-ltp test

Test sched_latency_dl 100 times  ...

LTP Chapter 4 Development_exit() Test Set

LTP series link: Chapter 1 Introduction to LTP and Internal Mechanism Chapter 2 Develop Shell Test Set Chapter 3 Development System Call Test Set Chapter 4 Development _exit() test set Chapter 5 Devel...

LTP (Linux Test Project) User Guide

Article Directory 1. Introduction to ltp-ddt 1.1、ltp 1.2、ltp-ddt 2. Environmental structure 2.1, cross compilation 2.2, file system 3. Test run 1. Introduction to ltp-ddt 1.1、ltp LTP (Linux Test Proje...

LTP Chapter 2 Develop Shell Test Set

LTP series link: Chapter 1 Introduction to LTP and Internal Mechanism Chapter 2 Develop Shell Test Set Chapter 3 Development System Call Test Set Chapter 4 Development _exit() test set Chapter 5 Devel...

More Recommendation

Compilation of LTP (Linux Test Project) for Android

Linux Test Project (GitHub home page is here) (Hereinafter referred to as LTP) A collection of tools containing the Linux kernel and kernel-related features. The purpose of this tool is to improve the...

UOS LTP compile USSTAT test item error

Environmental information Error information Show repeatedly definition the Struct USTAT structure. analyze There is no definition of Struct USTat in a normal environment. If you want to use this struc...

Kingdee EAS performance test overview

I have been testing the EAS performance for a while. After many years, I suddenly found that the things I have done during this period are a bit fuzzy. I will record it here, and I will help me in the...

Use Postman to test EAS webservice

1. EAS webservice EAS WSDL is as follows: 2. Postman When using Postman to call the webservice interface, you need to set the Post parameters as follows: Headers parameter Body Using raw format, the c...

Postman Test EAS WebService Interface

Postman Test EAS WebService Interface Access login address: Access method: POST Increase headers settings Increase Body Type: Raw Text Type: XML Return value: sessionid Return Value Example: 2. Access...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top