scheduler-tools / rt-app

rt-app emulates typical mobile and real-time systems use cases and gives runtime information
GNU General Public License v2.0
125 stars 102 forks source link

Change in uclamp fails if not accompanied by policy #114

Open douglas-raillard-arm opened 3 years ago

douglas-raillard-arm commented 3 years ago

The following JSON currently fails in the sched_setattr() syscall for uclamp:

{
    "tasks" : {
        "task1" : {
            "loop" : 1,
            "phases" : {
                "1" : {
                    "policy": "SCHED_FIFO",
                    "util_min": 256,
                    "run" : 3
                },
                "2" : {
                    "util_min": 512,
                    "run" : 3
                }
            }
        }
    },
    "global" : {
        "default_policy" : "SCHED_OTHER",
        "duration" : 1,
        "gnuplot" : false,
        "logdir" : "./",
        "log_basename" : "testrtapp",
        "lock_pages" : false,
        "frag" : 1,
        "calibration" : 63
    }
}

The reason is that the policy and priority in phase 2 are not set. Therefore, the internal special values THREAD_PRIORITY_UNCHANGED for priority and same for policy will be passed to the sched_setattr() call used for uclamp. Since they are not valid, the kernel rejects them.