-
Notifications
You must be signed in to change notification settings - Fork 1.3k
sched: Add max delay tick limitation for wdog/wqueue. #16394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hm. I am experiencing an assertion in the test on rv-virt:smp, with updated nuttx-apps and this PR still: [CPU1] Assertion failed : at file: wdog.c:312 task(CPU1): ostest process: ostest 0x80011b46 Perhaps check what happens in the test when interval -1 is passed as an argument to wd_start... ? |
Rebased the PR and tested with the latest nuttx-apps(a5709532577ff0b3276a78bc8d278e8bf8a1b037). It works fine for me. |
This commit added max delay tick limitation for the workqueue. Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
Yes, I can confirm that it now works, I had a messed-up environment myself. |
@Fix-Point why ci still fail? |
This commit changed the type of the delay ticks to the unsigned, which can reduce the useless branch conditions Besides, this commit added max delay tick limitation to fix incorrect timing behavior if we delay SCLOCK_MAX in the SMP build. Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
Summary
This PR fixes bugs in the wqueue and wdog modules. When delay is the maximum ticks
(CLOCK_MAX >> 1)
orSCLOCK_MAX
, If there are expired wdog timer in the wdog queue,clock_compare
might be incorrect.E.g. Current tick is
123
, and there is an expired wdog timer with the expired ticks100
. If we insert a wdog timer with delayCLOCK_MAX >> 1
, where the absolute ticks is123 + CLOCK_MAX >> 1
, thenclock_compare(100, 123 + CLOCK_MAX >> 1)
will returnfalse
, leading to the new wdog timer queued before the expired wdog timer.So we limited the delay ticks to or . Assume all expired wdog timer can be processed within
CLOCK_MAX >> 2
, which isWDOG_MAX_DELAY
ticks after the expiration, this ensure the correct enqueue of the wdog timer.Besides, this PR changed the semantic of the
wd_start
. So we should also change thewdog_test
. See apache/nuttx-apps#3076.Impact
This PR affects the wqueue and wdog modules, especially the semantic of the
wd_start
.Testing
Tested on
QEMU/x86_64
,sim
andQEMU/riscv32
.