Skip to content

sched/wdog: watchdog timer improvements. - #16343

Merged
xiaoxiang781216 merged 8 commits into
apache:masterfrom
Fix-Point:timer-improve
May 12, 2025
Merged

xiaoxiang781216 merged 8 commits into
apache:masterfrom
Fix-Point:timer-improve

Conversation

@Fix-Point

Copy link
Copy Markdown
Contributor

Summary

    1. Simplified the nxsched_timer_process function to enhance readability and maintainability.
    1. Improved absolute timer accuracy by moving the tick++ operation to the relative watchdog timer, removing unnecessary tick increments for absolute timers.
    1. Added CONFIG_TIMER_ADJUST_USEC to support time compensation for watchdog timers, reducing interrupt latency by setting the timer adjustment value to the Best-Case Execution Time (BCET).

Impact

    1. Improves code maintainability and readability without functional changes.
    1. Improves the accuracy of absolute timers by optimizing the tick increment process.
    1. Enhances timer precision by compensating for interrupt latency.

Testing

Tested on QEMU/x86_64 and sim.

@github-actions github-actions Bot added Area: OS Components OS Components issues Size: M The size of the change in this PR is medium labels May 8, 2025
xiaoxiang781216
xiaoxiang781216 previously approved these changes May 8, 2025
xiaoxiang781216
xiaoxiang781216 previously approved these changes May 9, 2025
@Fix-Point
Fix-Point force-pushed the timer-improve branch 4 times, most recently from c191142 to e97ec75 Compare May 9, 2025 07:32
@lupyuen

lupyuen commented May 9, 2025

Copy link
Copy Markdown
Member

Hmmm why is codespell failing?

include/nuttx/clock.h:579: leapyear ==> leap year

Even through we didn't change this code?

int clock_daysbeforemonth(int month, bool leapyear);

Do we need to add leapyear to .codespellrc?

@lupyuen

lupyuen commented May 9, 2025

Copy link
Copy Markdown
Member

@nuttxpr test avaota-a1:nsh

@nuttxpr

nuttxpr commented May 9, 2025

Copy link
Copy Markdown

[Experimental Bot, please feedback here]

Build and Test FAILED (avaota-a1:nsh)
https://gitlab.com/lupyuen/nuttx-build-log/-/snippets/4841520

$ git clone https://github.com/Fix-Point/nuttx nuttx --branch timer-improve
$ git clone https://github.com/apache/nuttx-apps apps --branch master
$ pushd nuttx
$ git reset --hard HEAD
HEAD is now at e97ec75fbc clock: Fix timing error.
$ popd
$ pushd apps
$ git reset --hard HEAD
HEAD is now at 376cc5a73 testing/ostest: Add checking of signal delivery TID to signest test
$ popd
NuttX Source: https://github.com/apache/nuttx/tree/e97ec75fbc7a26a7fd4390d8f886b22667b5aaf5
NuttX Apps: https://github.com/apache/nuttx-apps/tree/376cc5a731d9b43a34dd619fece8c49015238fd1
$ cd nuttx
$ tools/configure.sh avaota-a1:nsh
$ make -j
$ make -j export
$ pushd ../apps
$ ./tools/mkimport.sh -z -x ../nuttx/nuttx-export-0.0.0.tar.gz
$ make -j import
$ popd
$ genromfs -f initrd -d ../apps/bin -V NuttXBootVol
$ head -c 65536 /dev/zero
$ cat nuttx.bin /tmp/nuttx.pad initrd
$ scp Image thinkcentre:/tmp/Image
$ ssh thinkcentre sudo /home/user/copy-image.sh
$ sd-mux-ctrl --device-serial=sd-wire_02-09 --ts
$ mkdir -p /tmp/sda1
$ mount /dev/sda1 /tmp/sda1
$ cp /tmp/Image /tmp/sda1/
$ rm /tmp/Image
$ umount /tmp/sda1
$ sd-mux-ctrl --device-serial=sd-wire_02-09 --dut
$ cd /home/luppy/nuttx-build-farm
$ ssh thinkcentre
nsh> uname -a
NuttX 0.0.0 e97ec75fbc May  9 2025 16:08:43 arm64 avaota-a1
nsh> ostest
up_dump_register: SCTLR_EL1: 0x30d0180d        
test: Simple case:
  Total signalled 1180  Odd=580 Even=600
  Total handled   1180  Odd=580 Even=600
  Total nested    0    Odd=0   Even=0  
waiter_action: Delivered to wrong TID 12, expected 58
waiter_action: Delivered to wrong TID 61, expected 58
Now running https://github.com/lupyuen/nuttx-build-farm/blob/main/avaota-power.sh off
----- Power off Avaota-A1
[]

@lupyuen

lupyuen commented May 9, 2025

Copy link
Copy Markdown
Member

@nuttxpr test milkv_duos:nsh

@nuttxpr

nuttxpr commented May 9, 2025

Copy link
Copy Markdown

[Experimental Bot, please feedback here]

Build and Test FAILED (milkv_duos:nsh)
https://gitlab.com/lupyuen/nuttx-build-log/-/snippets/4841523

$ git clone https://github.com/Fix-Point/nuttx nuttx --branch timer-improve
$ git clone https://github.com/apache/nuttx-apps apps --branch master
$ pushd nuttx
$ git reset --hard HEAD
HEAD is now at e97ec75fbc clock: Fix timing error.
$ popd
$ pushd apps
$ git reset --hard HEAD
HEAD is now at 376cc5a73 testing/ostest: Add checking of signal delivery TID to signest test
$ popd
NuttX Source: https://github.com/apache/nuttx/tree/e97ec75fbc7a26a7fd4390d8f886b22667b5aaf5
NuttX Apps: https://github.com/apache/nuttx-apps/tree/376cc5a731d9b43a34dd619fece8c49015238fd1
$ cd nuttx
$ tools/configure.sh milkv_duos:nsh
$ make -j
$ make -j export
$ pushd ../apps
$ ./tools/mkimport.sh -z -x ../nuttx/nuttx-export-0.0.0.tar.gz
$ make -j import
$ popd
$ genromfs -f initrd -d ../apps/bin -V NuttXBootVol
$ head -c 65536 /dev/zero
$ cat nuttx.bin /tmp/nuttx.pad initrd
$ scp Image tftpserver:/tftpboot/Image-sg2000
$ cd /home/luppy/nuttx-build-farm
$ ssh tftpserver
OpenSBI v0.9
nsh> uname -a
NuttX 0.0.0 e97ec75fbc May  9 2025 16:20:55 risc-v milkv_duos
nsh> ostest
signest_test: Started interfere_main pid=55
signest_test: Simple case:
  Total signalled 1240  Odd=620 Even=620
  Total handled   1240  Odd=620 Even=620
  Total nested    0    Odd=0   Even=0  
waiter_action: Delivered to wrong TID 11, expected 54
ostest_main: Exiting with status 256
nsh> Now running https://github.com/lupyuen/nuttx-build-farm/blob/main/oz64-power.sh off
----- Power off Oz64
[]

@lupyuen

lupyuen commented May 9, 2025

Copy link
Copy Markdown
Member

Sorry @Fix-Point could you check why this PR is crashing OSTest on Arm64 Avaota-A1 T527 and RISC-V SG2000? Thanks!

Arm64 Avaota-A1 SBC (Allwinner T527)

https://gitlab.com/lupyuen/nuttx-build-log/-/snippets/4841520#L1381

waiter_main: Waiting on semaphoredump_assert_info: Current Version: NuttX  0.0.0 e97ec75fbc May  9 2025 16:08:46 arm64
dump_assert_info: Assertion failed (_Bool)0: at file: signest.c:115 task: ostest process: ostest 0xc000195c 

signest_test: Started interfere_main pid=61
signest_dump_assert_info: Current Version: NuttX  0.0.0 e97ec75fbc May  9 2025 16:08:46 arm64
dump_assert_info: Assertion failed (_Bool)0: at file: signest.c:115 task: ostest process: ostest 0xc000a8b8 

test: Simple case:
  Total signalled 1180  Odd=580 Even=600
  Total handled   1180  Odd=580 Even=600
  Total nested    0    Odd=0   Even=0  
waiter_action: Delivered to wrong TID 12, expected 58
waiter_action: Delivered to wrong TID 61, expected 58

RISC-V Oz64 SBC (Sophgo SG2000)

https://gitlab.com/lupyuen/nuttx-build-log/-/snippets/4841523#L1087

waiter_main: Waiting on semaphoredump_assert_info: Current Version: NuttX  0.0.0 e97ec75fbc May  9 2025 16:20:58 risc-v
dump_assert_info: Assertion failed (_Bool)0: at file: signest.c:115 task: ostest process: ostest 0xc000001a 

signest_test: Started interfere_main pid=55
signest_test: Simple case:
  Total signalled 1240  Odd=620 Even=620
  Total handled   1240  Odd=620 Even=620
  Total nested    0    Odd=0   Even=0  
waiter_action: Delivered to wrong TID 11, expected 54
ostest_main: Exiting with status 256

@lupyuen lupyuen left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Fix-Point OSTest is also failing on rv-virt:knsh64. Here's how to reproduce the failure: https://gist.github.com/lupyuen/0912fbfedd1b17b592321f828d6c7e5d

$ tools/configure.sh rv-virt:knsh64
$ make -j
$ make -j export
$ pushd ../apps
$ ./tools/mkimport.sh -z -x ../nuttx/nuttx-export-0.0.0.tar.gz
$ make -j import
$ popd
$ qemu-system-riscv64 -semihosting -M virt,aclint=on -cpu rv64 -kernel nuttx -nographic
$ ostest
signest_test: Simple case:
  Total signalled 1240  Odd=620 Even=620
  Total handled   1240  Odd=620 Even=620
  Total nested    0    Odd=0   Even=0  
waiter_action: Delivered to wrong TID 10, expected 53
[   57.406911] dump_assert_info: Current Version: NuttX  0.0.0 e97ec75fbc May  9 2025 16:38:42 risc-v
[   57.409460] dump_assert_info: Assertion failed : at file: signest.c:115 task: ostest process: ostest 0xc000001a

jerpelea
jerpelea previously approved these changes May 9, 2025
@lupyuen

lupyuen commented May 9, 2025

Copy link
Copy Markdown
Member

@nuttxpr test avaota-a1:nsh

@nuttxpr

nuttxpr commented May 9, 2025

Copy link
Copy Markdown

[Experimental Bot, please feedback here]

Build and Test Successful (avaota-a1:nsh)
https://gitlab.com/lupyuen/nuttx-build-log/-/snippets/4841540

$ git clone https://github.com/Fix-Point/nuttx nuttx --branch timer-improve
$ git clone https://github.com/apache/nuttx-apps apps --branch master
$ pushd nuttx
$ git reset --hard HEAD
HEAD is now at c6fabab53a clock: Fix timing error.
$ popd
$ pushd apps
$ git reset --hard HEAD
HEAD is now at 376cc5a73 testing/ostest: Add checking of signal delivery TID to signest test
$ popd
NuttX Source: https://github.com/apache/nuttx/tree/c6fabab53ad1bbd5707f4f9faf42aa86cca3e64b
NuttX Apps: https://github.com/apache/nuttx-apps/tree/376cc5a731d9b43a34dd619fece8c49015238fd1
$ cd nuttx
$ tools/configure.sh avaota-a1:nsh
$ make -j
$ make -j export
$ pushd ../apps
$ ./tools/mkimport.sh -z -x ../nuttx/nuttx-export-0.0.0.tar.gz
$ make -j import
$ popd
$ genromfs -f initrd -d ../apps/bin -V NuttXBootVol
$ head -c 65536 /dev/zero
$ cat nuttx.bin /tmp/nuttx.pad initrd
$ scp Image thinkcentre:/tmp/Image
$ ssh thinkcentre sudo /home/user/copy-image.sh
$ sd-mux-ctrl --device-serial=sd-wire_02-09 --ts
$ mkdir -p /tmp/sda1
$ mount /dev/sda1 /tmp/sda1
$ cp /tmp/Image /tmp/sda1/
$ rm /tmp/Image
$ umount /tmp/sda1
$ sd-mux-ctrl --device-serial=sd-wire_02-09 --dut
$ cd /home/luppy/nuttx-build-farm
$ ssh thinkcentre
nsh> uname -a
NuttX 0.0.0 c6fabab53a May  9 2025 17:28:25 arm64 avaota-a1
nsh> ostest
arena        a000    28000
ordblks         2        4
mxordblk     5ff8    1bff8
uordblks     27b8     66d0
fordblks     7848    21930
user_main: Exiting
ostest_main: Exiting with status 0
nNow running https://github.com/lupyuen/nuttx-build-farm/blob/main/avaota-power.sh off
----- Power off Avaota-A1
[]

@lupyuen

lupyuen commented May 9, 2025

Copy link
Copy Markdown
Member

@nuttxpr test milkv_duos:nsh

@nuttxpr

nuttxpr commented May 9, 2025

Copy link
Copy Markdown

[Experimental Bot, please feedback here]

Build and Test Successful (milkv_duos:nsh)
https://gitlab.com/lupyuen/nuttx-build-log/-/snippets/4841541

$ git clone https://github.com/Fix-Point/nuttx nuttx --branch timer-improve
$ git clone https://github.com/apache/nuttx-apps apps --branch master
$ pushd nuttx
$ git reset --hard HEAD
HEAD is now at c6fabab53a clock: Fix timing error.
$ popd
$ pushd apps
$ git reset --hard HEAD
HEAD is now at 376cc5a73 testing/ostest: Add checking of signal delivery TID to signest test
$ popd
NuttX Source: https://github.com/apache/nuttx/tree/c6fabab53ad1bbd5707f4f9faf42aa86cca3e64b
NuttX Apps: https://github.com/apache/nuttx-apps/tree/376cc5a731d9b43a34dd619fece8c49015238fd1
$ cd nuttx
$ tools/configure.sh milkv_duos:nsh
$ make -j
$ make -j export
$ pushd ../apps
$ ./tools/mkimport.sh -z -x ../nuttx/nuttx-export-0.0.0.tar.gz
$ make -j import
$ popd
$ genromfs -f initrd -d ../apps/bin -V NuttXBootVol
$ head -c 65536 /dev/zero
$ cat nuttx.bin /tmp/nuttx.pad initrd
$ scp Image tftpserver:/tftpboot/Image-sg2000
$ cd /home/luppy/nuttx-build-farm
$ ssh tftpserver
OpenSBI v0.9
nsh> uname -a
NuttX 0.0.0 c6fabab53a May  9 2025 17:33:03 risc-v milkv_duos
nsh> ostest
arena       81000    81000
ordblks         2        3
mxordblk    7cff8    78ff8
uordblks     2630     4540
fordblks    7e9d0    7cac0
user_main: Exiting
ostest_main: Exiting with status 0
nsh> Now running https://github.com/lupyuen/nuttx-build-farm/blob/main/oz64-power.sh off
----- Power off Oz64
[]

lupyuen
lupyuen previously approved these changes May 9, 2025

@lupyuen lupyuen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested OK on Real Hardware: Arm64 and RISC-V 64-bit. Thanks!

@lupyuen

lupyuen commented May 10, 2025

Copy link
Copy Markdown
Member

@nuttxpr test avaota-a1:nsh

@nuttxpr

nuttxpr commented May 10, 2025

Copy link
Copy Markdown

[Experimental Bot, please feedback here]

Build and Test Successful (avaota-a1:nsh)
https://gitlab.com/lupyuen/nuttx-build-log/-/snippets/4841768

$ git clone https://github.com/Fix-Point/nuttx nuttx --branch timer-improve
$ git clone https://github.com/apache/nuttx-apps apps --branch master
$ pushd nuttx
$ git reset --hard HEAD
HEAD is now at c00712069a clock: Add clock_delay2abstick.
$ popd
$ pushd apps
$ git reset --hard HEAD
HEAD is now at 376cc5a73 testing/ostest: Add checking of signal delivery TID to signest test
$ popd
NuttX Source: https://github.com/apache/nuttx/tree/c00712069a1207f3b921b3a03f6f7a156fdfd5de
NuttX Apps: https://github.com/apache/nuttx-apps/tree/376cc5a731d9b43a34dd619fece8c49015238fd1
$ cd nuttx
$ tools/configure.sh avaota-a1:nsh
$ make -j
$ make -j export
$ pushd ../apps
$ ./tools/mkimport.sh -z -x ../nuttx/nuttx-export-0.0.0.tar.gz
$ make -j import
$ popd
$ genromfs -f initrd -d ../apps/bin -V NuttXBootVol
$ head -c 65536 /dev/zero
$ cat nuttx.bin /tmp/nuttx.pad initrd
$ scp Image thinkcentre:/tmp/Image
$ ssh thinkcentre sudo /home/user/copy-image.sh
$ sd-mux-ctrl --device-serial=sd-wire_02-09 --ts
$ mkdir -p /tmp/sda1
$ mount /dev/sda1 /tmp/sda1
$ cp /tmp/Image /tmp/sda1/
$ rm /tmp/Image
$ umount /tmp/sda1
$ sd-mux-ctrl --device-serial=sd-wire_02-09 --dut
$ cd /home/luppy/nuttx-build-farm
$ ssh thinkcentre
nsh> uname -a
NuttX 0.0.0 c00712069a May 10 2025 17:25:53 arm64 avaota-a1
nsh> ostest
======== ======== ========
arena        a000    28000
ordblks         2        4
mxordblk     5ff8    1bff8
uordblks     27b8     66d0
fordblks     7848    21930
user_main: Exiting
ostest_main: Exiting with status 0Now running https://github.com/lupyuen/nuttx-build-farm/blob/main/avaota-power.sh off
----- Power off Avaota-A1
[]

@lupyuen

lupyuen commented May 10, 2025

Copy link
Copy Markdown
Member

@nuttxpr test milkv_duos:nsh

@nuttxpr

nuttxpr commented May 10, 2025

Copy link
Copy Markdown

[Experimental Bot, please feedback here]

Build and Test Successful (milkv_duos:nsh)
https://gitlab.com/lupyuen/nuttx-build-log/-/snippets/4841769

$ git clone https://github.com/Fix-Point/nuttx nuttx --branch timer-improve
$ git clone https://github.com/apache/nuttx-apps apps --branch master
$ pushd nuttx
$ git reset --hard HEAD
HEAD is now at c00712069a clock: Add clock_delay2abstick.
$ popd
$ pushd apps
$ git reset --hard HEAD
HEAD is now at 376cc5a73 testing/ostest: Add checking of signal delivery TID to signest test
$ popd
NuttX Source: https://github.com/apache/nuttx/tree/c00712069a1207f3b921b3a03f6f7a156fdfd5de
NuttX Apps: https://github.com/apache/nuttx-apps/tree/376cc5a731d9b43a34dd619fece8c49015238fd1
$ cd nuttx
$ tools/configure.sh milkv_duos:nsh
$ make -j
$ make -j export
$ pushd ../apps
$ ./tools/mkimport.sh -z -x ../nuttx/nuttx-export-0.0.0.tar.gz
$ make -j import
$ popd
$ genromfs -f initrd -d ../apps/bin -V NuttXBootVol
$ head -c 65536 /dev/zero
$ cat nuttx.bin /tmp/nuttx.pad initrd
$ scp Image tftpserver:/tftpboot/Image-sg2000
$ cd /home/luppy/nuttx-build-farm
$ ssh tftpserver
OpenSBI v0.9
nsh> uname -a
NuttX 0.0.0 c00712069a May 10 2025 17:31:05 risc-v milkv_duos
nsh> ostest
arena       81000    81000
ordblks         2        3
mxordblk    7cff8    78ff8
uordblks     2630     4540
fordblks    7e9d0    7cac0
user_main: Exiting
ostest_main: Exiting with status 0
nsh> Now running https://github.com/lupyuen/nuttx-build-farm/blob/main/oz64-power.sh off
----- Power off Oz64
[]

lupyuen
lupyuen previously approved these changes May 10, 2025

@lupyuen lupyuen left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retested OK with OSTest on Real Hardware. Thanks!

@lupyuen

lupyuen commented May 11, 2025

Copy link
Copy Markdown
Member

@Fix-Point: Please fix the Merge Conflict. Thanks!

  • sched/wqueue/kwork_queue.c

@acassis

acassis commented May 11, 2025

Copy link
Copy Markdown
Contributor

@lupyuen how can I add my milkv_duos to the CI? It should be nice if we could run this test automatically without calling the nuttxpr bot manually

Fix-Point added 3 commits May 12, 2025 09:33
This commit simplified `nxsched_timer_process` implementation and
improve its readability.

Signed-off-by: ouyangxiangzhen <[email protected]>
To improve the absolute timer accuracy, this commit move the tick++ to relative wdog timer.

Signed-off-by: ouyangxiangzhen <[email protected]>
This commit added CONFIG_TIMER_ADJUST_USEC to support the time compensation for wdog timer. Normally, timer event cannot triggered on exact time due to the existence of interrupt latency. Assuming that the interrupt latency is distributed within [Best-Case Execution Time, Worst-Case Excution Time], we can set the timer adjustment value to the BCET to reduce the latency.

Signed-off-by: ouyangxiangzhen <[email protected]>
@Fix-Point
Fix-Point dismissed stale reviews from lupyuen and xiaoxiang781216 via d620657 May 12, 2025 01:39
@xiaoxiang781216

Copy link
Copy Markdown
Contributor

@Fix-Point please fix:

 /home/runner/work/nuttx/nuttx/nuttx/include/nuttx/clock.h:601: leapyear ==> leap year

Fix-Point added 5 commits May 12, 2025 11:46
This commit fixed serveral word spelling mistakes.

Signed-off-by: ouyangxiangzhen <[email protected]>
This commit change the type of the constants to unsigned, avoiding signed integer division.

Signed-off-by: ouyangxiangzhen <[email protected]>
This commit is to prevent the insufficient sleep time.

Signed-off-by: ouyangxiangzhen <[email protected]>
This commit resolves a timing error caused by the round-up behavior in clock_time2ticks. In rare cases, this could lead to a two-tick increment within a single tick interval. To fix this, we introduced clock_time2ticks_floor, which guarantees the correct semantics for obtaining current system ticks.

Signed-off-by: ouyangxiangzhen <[email protected]>
This commit added a macro function clock_delay2abstick to calculate the
absolute tick after the delay.

Signed-off-by: ouyangxiangzhen <[email protected]>
@Fix-Point

Copy link
Copy Markdown
Contributor Author

@Fix-Point please fix:

 /home/runner/work/nuttx/nuttx/nuttx/include/nuttx/clock.h:601: leapyear ==> leap year

Done.

@xiaoxiang781216
xiaoxiang781216 merged commit 64a7049 into apache:master May 12, 2025
@lupyuen

lupyuen commented May 13, 2025

Copy link
Copy Markdown
Member

how can I add my milkv_duos to the CI? It should be nice if we could run this test automatically without calling the nuttxpr bot manually

@acassis Hmmm are we thinking of triggering the Hardware Test directly from CI? There's a problem: The PR might contain malicious scripts or code, that could mess up our Test PC and Network. We should review the PR Code before doing the Hardware Test.

We could do this instead (and it already works today)

  1. Anyone may post a PR comment: @nuttxpr test milkv_duos:nsh or @nuttxpr test avaota-a1:nsh
  2. Right now, this will trigger an Email Alert to me
  3. I will review the PR for malicious code
  4. Then I will start the PR Test Bot manually
  5. Please gimme some time to review the PR, in case I'm sick (or out for marathon training)

Or if we prefer to run the Hardware Test Manually, without calling any GitHub API:

git clone https://github.com/lupyuen/nuttx-build-farm
cd nuttx-build-farm

## For Milk-V Duo S and Oz64 SG2000:
## Build and Test github.com/Fix-Point/nuttx, branch timer-improve
./build-test.sh oz64 \
  /tmp/build-test.log \
  HEAD HEAD \
  https://github.com/Fix-Point/nuttx timer-improve \
  https://github.com/apache/nuttx-apps master

## For Avaota-A1: Change oz64 to avaota
## Needs a MicroSD Multiplexer

This requires:

  1. A TFTP Server to be installed for hosting the NuttX Image
  2. On Milk-V Duo S: U-Boot should be configured to boot NuttX over TFTP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Drivers Drivers issues Area: OS Components OS Components issues Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants