Assertion failure in philosophers sample program

61 views
Skip to first unread message

Richard Miller

unread,
Nov 30, 2018, 8:55:29 AM11/30/18
to RISC-V Soft CPU Discussion
I'm seeing this message after running the philosophers program for some minutes, using my SoC both in simulation and on the Upduino board:

ASSERTION FAIL [mutex->owner == _kernel.current] @ /usr/local/share/zephyr/kernel/mutex.c:215:

Running the same program on a Hifive1 with a standard zephyr build, I see the same error but only after a few hours.  If I push the demo to run faster, by making the change below, I see the error on Hifive1 after a few minutes too.

--- a/samples/philosophers/src/main.c
+++ b/samples/philosophers/src/main.c
@@ -183,3 +183,3 @@ void philosopher(void *id, void *unused1, void *unused2)
 
-               delay = get_random_delay(my_id, 25);
+               delay = get_random_delay(my_id, 1);
                print_phil_state
(my_id, "  EATING  [ %s%d ms ] ", delay);
@@ -191,3 +191,3 @@ void philosopher(void *id, void *unused1, void *unused2)
 
-               delay = get_random_delay(my_id, 25);
+               delay = get_random_delay(my_id, 1);
                print_phil_state
(my_id, " THINKING [ %s%d ms ] ", delay);


I think the RTC on my SoC is running faster than real time.  But it seems to me that the correctness of synchronisation primitives should not depend on having sufficient delay between calls.

Would anyone like to try the speed-up experiment on their SoC, or run the unmodified program overnight, and see if the same assertion falure occurs?


Angel

unread,
Nov 30, 2018, 9:02:25 AM11/30/18
to millerr...@gmail.com, softcpu...@riscv.org
I could try this night, using the unmodified program, using my SoC for the riscv-contest (and using a 64-bit timer @ 100 MHz). Is that ok?

--
You received this message because you are subscribed to the Google Groups "RISC-V Soft CPU Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to softcpu-discu...@riscv.org.
To post to this group, send email to softcpu...@riscv.org.
Visit this group at https://groups.google.com/a/riscv.org/group/softcpu-discuss/.
To view this discussion on the web visit https://groups.google.com/a/riscv.org/d/msgid/softcpu-discuss/c3ba8852-4a02-4d93-b24f-ed68009909b9%40riscv.org.
For more options, visit https://groups.google.com/a/riscv.org/d/optout.

Frank Buss

unread,
Nov 30, 2018, 9:14:24 AM11/30/18
to RISC-V Soft CPU Discussion
On Friday, November 30, 2018 at 2:55:29 PM UTC+1, Richard Miller wrote:
I'm seeing this message after running the philosophers program for some minutes, using my SoC both in simulation and on the Upduino board:

ASSERTION FAIL [mutex->owner == _kernel.current] @ /usr/local/share/zephyr/kernel/mutex.c:215:


I saw a similar bug with my C++ emulator and compiled for the QEMU target, as described at the beginning of the source code:


You can always see the error after a second, if you comment line 1416 in my code and use "mtime += 5;" in line 1419, meaning mtime is increased by 5 for every RISC-V instruction. But it fails with the assertion in line 217 in mutex.c. I guess it is a Zephyr bug. A bug in my emulator is unlikely, because the rest works, except a minor bug with a CSR register for the benchmark.

Richard Miller

unread,
Nov 30, 2018, 10:29:49 AM11/30/18
to RISC-V Soft CPU Discussion
Yes thanks, that would be an interesting experiment.

Angel Terrones

unread,
Dec 5, 2018, 1:24:13 PM12/5/18
to RISC-V Soft CPU Discussion
Hi Richard.

Sorry for the late replay. 
I tried the program, unmodified. After 3.5 hours, using the FPGA, the program halted without any message.

Nicolas Bértolo

unread,
Dec 5, 2018, 1:35:45 PM12/5/18
to RISC-V Soft CPU Discussion
We found the same problem in our implementation. It turned out to be a Zephyr bug.
This patch has been merged into the master branch: https://github.com/zephyrproject-rtos/zephyr/pull/11849
Reply all
Reply to author
Forward
0 new messages