nuttx/sched/sched
yushuailong 4a34293263 sched: Centralize sporadic parameter validation
Sporadic scheduling parameters are processed independently by sched_setparam(), sched_setscheduler(), and pthread_create(). The three paths currently validate different subsets of the parameters.

In particular, pthread_create() does not validate sched_ss_max_repl and only requires the replenishment period to be greater than the budget, while the scheduler interfaces enforce the implementation's 50 percent duty-cycle limit.

Add nxsched_validate_sporadic() to validate the common parameters and convert the replenishment period and budget to ticks. Use it from all paths that directly initialize or update sporadic scheduler state.

Express the duty-cycle check using division to avoid overflow when doubling a clock_t value.

Assisted-by: OpenAI Codex
Signed-off-by: yushuailong <yyyusl@qq.com>
2026-09-13 10:29:49 +08:00
..
CMakeLists.txt sched/wdog: Simplify timer expiration for hrtimer. 2026-02-02 13:26:22 +08:00
Make.defs sched/wdog: Simplify timer expiration for hrtimer. 2026-02-02 13:26:22 +08:00
nxsched_checkstackoverflow.c sched: Improve nxsched stack overflow checking implementation 2025-10-11 18:00:44 +08:00
queue.h sched/queue: fix typo in dq_insert_mid macro 2025-05-08 15:59:50 +08:00
sched.h sched: Centralize sporadic parameter validation 2026-09-13 10:29:49 +08:00
sched_addblocked.c
sched_addreadytorun.c sched: Fix scheduler CPU selection and ready-to-run list management 2026-01-28 13:02:58 -03:00
sched_backtrace.c sched/backtrace: fix cross-CPU buffer access under addrenv 2026-07-20 21:01:28 -03:00
sched_cpuload.c style: Fix "the the" typo across the codebase. 2026-03-23 11:07:49 +01:00
sched_cpuload_oneshot.c sched/cpuload: fix hardcoded 100000 should be USEC_PER_SEC 2026-09-11 03:00:15 +08:00
sched_cpuload_period.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
sched_critmonitor.c sched/critmonitor: Restore the target run start time. 2026-09-07 21:06:53 +08:00
sched_dumponexit.c sched: add dump_stack() for dumponexit 2026-01-17 18:04:28 -03:00
sched_foreach.c
sched_get_stackinfo.c sched/sched/sched_get_stackinfo.c: coverity HIS_metric_violation: RETURN 2026-01-28 01:24:58 +08:00
sched_get_stateinfo.c sched_get_stateinfo.c: misra_c_2012_rule_8_9_violation 2026-01-31 02:39:19 +08:00
sched_get_tls.c sched/tls: fix uninitialized argv pointer in task info 2026-01-15 16:10:11 -03:00
sched_getaffinity.c
sched_getcpu.c sched: export sched_getcpu API in AMP mode 2024-10-09 15:21:25 +08:00
sched_getfiles.c sched_getfiles.c: coverity HIS_metric_violation: RETURN 2026-01-28 22:01:01 +08:00
sched_getparam.c sched/sched: Fix uninitialized sporadic params returned by nxsched_get_param() 2026-08-01 11:19:50 +08:00
sched_getscheduler.c sched_getscheduler.c: coverity HIS_metric_violation: RETURN 2026-01-28 13:07:20 -03:00
sched_gettcb.c
sched_idletask.c Revert "sched_idletask: remove the check for whether tcb is NULL" 2025-11-27 08:26:53 -03:00
sched_lock.c sched/sched: Modify the critical section interface name. 2026-01-26 21:13:05 +08:00
sched_lockcount.c
sched_mergepending.c coverity: Dereferencing after a null check (FORWARD_NULL) 2026-01-27 22:29:17 +08:00
sched_process_delivered.c sched: Fix scheduler CPU selection and ready-to-run list management 2026-01-28 13:02:58 -03:00
sched_processtick.c sched/wdog: Simplify timer expiration for hrtimer. 2026-02-02 13:26:22 +08:00
sched_processtickless.c style: add missing blank line after declarations 2026-09-07 10:17:46 -03:00
sched_profil.c !sys/types.h: change time_t and clock_t to int64_t to align with other OSes 2026-05-19 16:21:28 +08:00
sched_releasetcb.c !sched/arch/libc: Give fork() and vfork() their real, separate semantics. 2026-08-10 08:57:30 -03:00
sched_removeblocked.c
sched_removereadytorun.c sched: Fix scheduler CPU selection and ready-to-run list management 2026-01-28 13:02:58 -03:00
sched_reprioritize.c
sched_reprioritizertr.c sched: remove param in nxsched_remove_readytorun 2024-10-10 08:44:52 +08:00
sched_roundrobin.c sched/tickless: Fix SCHED_RR timeslice accounting on preemption 2026-09-07 10:17:46 -03:00
sched_rrgetinterval.c sched/sched/sched_rrgetinterval.c: coverity HIS_metric_violation: RETURN 2026-01-27 22:28:59 +08:00
sched_self.c
sched_setaffinity.c sched/sched: change [FIRST|LAST]_ASSIGNED_STATE to [FIRST|LAST]_READY_TO_RUN_STATE in nxsched_set_affinity 2024-11-04 17:19:59 +08:00
sched_setparam.c sched: Centralize sporadic parameter validation 2026-09-13 10:29:49 +08:00
sched_setpriority.c sched/setpriority: handle CPU affinity change for running task 2026-08-05 21:13:56 +08:00
sched_setscheduler.c sched: Centralize sporadic parameter validation 2026-09-13 10:29:49 +08:00
sched_sleep.c sched/sched: add nxsched_abstick_sleep() 2026-02-26 17:04:47 +08:00
sched_smp.c smpcall: we directly call the function to handle local smpcall 2024-11-07 09:25:11 +09:00
sched_sporadic.c sched: Centralize sporadic parameter validation 2026-09-13 10:29:49 +08:00
sched_suspend.c arch, sched/signal: Fix compilation with ENABLE_PARTIAL_SIGNALS=y 2026-06-16 17:07:32 +08:00
sched_switchcontext.c sched/tickless: Fix SCHED_RR timeslice accounting on preemption 2026-09-07 10:17:46 -03:00
sched_sysinfo.c sched_sysinfo.c: coverity HIS_metric_violation: RETURN 2026-01-31 02:53:58 +08:00
sched_unlock.c sched/sched: Modify the critical section interface name. 2026-01-26 21:13:05 +08:00
sched_verifytcb.c
sched_wait.c
sched_waitid.c sched/waitid: honor WNOWAIT instead of discarding child status 2026-09-11 03:00:15 +08:00
sched_waitpid.c sched: fix parent process check using wrong pid field 2026-09-11 03:00:15 +08:00
sched_yield.c