zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.59k stars 6.48k forks source link

Sleep calls are off on qemu_x86 #30964

Closed GroteGnoom closed 3 years ago

GroteGnoom commented 3 years ago

Describe the bug When running the dining philosophers sample on qemu_x86, the philosophers don't sleep when eating, and they should.

So, for example, this philosopher does not sleep for 450 ms:

Philosopher 0 [P: 0]   EATING  [  450 ms ] 

The generated build.ninja has a -icount shift=5,align=off,sleep=off in the qemo-system-i386 command, and when sleep=on the problem is fixed. The origin of this seems to be /zephyr/cmake/emu/qemu.cmake.

To Reproduce

west build -b qemu_x86 samples/philosophers
west build -t run

Expected behavior I expected

k_msleep(delay);

to work. Any kind of sleep calls seem to sleep far shorter than the indicated time.

Impact Annoyance. The readme philosophers example does not work as intended.

Environment:

Further info: Maybe this was introduced here: https://github.com/zephyrproject-rtos/zephyr/issues/14173. It is unclear to me why sleep should be off.

GroteGnoom commented 3 years ago

Ah, I only searched the open issues, my bad. This has been reported here as well: https://github.com/zephyrproject-rtos/zephyr/issues/29518 Shouldn't this be fixed in general, instead of everybody removing their icounts?

nashif commented 3 years ago

you will need to disable icount if you want correct timing. icount is enabled by default to resolve issues in CI.

nashif commented 3 years ago

closing as a non-bug.