zephyr/kernel
Nicolas Pitre 6a51a10dec kernel/timer: fix period argument clamp handling
Commit 3e729b2b1c ("kernel/timer: Correctly clamp period argument")
increased the lower limit to 1 so that it wouldn't conflict with a
K_NO_WAIT. But in doing so it enforced a minimum period of 2 ticks.
And the subtraction must obviously be avoided if the period is zero, etc.

Instead of doing this masquerade in k_timer_start(), let's move the
subtraction and clamping in z_timer_expiration_handler() right before
registering a new timeout. It makes the code cleaner, and then it is
possible to have single-tick periods again.

Whith this, timer_jitter_drift in tests/kernel/timer/timer_behavior does
pass with any CONFIG_SYS_CLOCK_TICKS_PER_SEC value, even when the tick
period is equal or larger than the specified timer period for the test
which failed the test before.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-02-20 09:52:53 +01:00
..
include kernel: Add routine to walk a wait queue 2023-02-11 06:45:13 +09:00
paging
atomic_c.c
banner.c kernel: banner: Remove unnecessary header 2023-01-09 12:07:28 -05:00
CMakeLists.txt
compiler_stack_protect.c
condvar.c
device.c
errno.c
events.c
fatal.c
futex.c
idle.c
init.c kernel: mark z_cstart to not have stack protector 2023-01-24 13:04:45 -05:00
Kconfig kernel: Kconfig: Increase the main stack size for ARM when TEST 2022-12-09 21:59:10 +09:00
Kconfig.vm
kheap.c
mailbox.c
main_weak.c
mem_domain.c
mem_slab.c
mempool.c
mmu.c
msg_q.c kernel: k_msgq: add peek at function 2023-01-26 10:00:29 +00:00
mutex.c
pipes.c kernel: pipes: ISRs use a private pipe descriptor 2023-02-11 06:45:13 +09:00
poll.c
queue.c
sched.c kernel: pipes: Change method of unpending waiters 2023-02-11 06:45:13 +09:00
sem.c
smp.c
stack.c
system_work_q.c
thread.c
timeout.c kernel: resolve static analysis false positives 2023-01-05 18:23:04 +00:00
timer.c kernel/timer: fix period argument clamp handling 2023-02-20 09:52:53 +01:00
usage.c
userspace_handler.c
userspace.c
version.c
work.c kernel/work: Fix race under with delayed work item cancellation 2023-02-11 12:14:16 +09:00
xip.c