[chip dv] SW tests run flakily
The SW tests at the chip level in DV environment which need to service interrupts run flakily. When run with multiple seeds, the same does not have a 100% pass rate. This is strange because the tests do not randomize anything. The only element of randomization is how long the DUT is held under reset. This IMO should have no bearing on the test progression. This for example is causing the private CI on PR #2066 to fail. The change in the said PR have absolutely nothing to do with the failing test (chip_uart_tx_rx). Indeed, the said test is also failing in the nightly regressions intermittently.
https://reports.opentitan.org/hw/top_earlgrey/dv/latest/results.html
We may need more eyes from Ibex design and the SW team to get to the bottom of this.
Can you extract the seed to give us the option to reproduce this issue?
Can you extract the seed to give us the option to reproduce this issue?
Yes, see failing test in the regression results link I provided. You can try 169394472.
./util/dvsim/dvsim.py hw/top_earlgrey/dv/chip_sim_cfg.hjson -i chip_uart_tx_rx --seed 169394472 --build-modes en_ibex_tracer --waves --dump vcd
Seed = 1 still passes in CI - so you can use that for the passing example.
Can you extract the seed to give us the option to reproduce this issue?
Yes, see failing test in the regression results link I provided. You can try 169394472.
./util/dvsim/dvsim.py hw/top_earlgrey/dv/chip_sim_cfg.hjson -i chip_uart_tx_rx --seed 169394472 --build-modes en_ibex_tracer --waves --dump vcd
We have a whole suite of tests that does not use the Ibex. So we disable the ibex tracer by default. The indicated option will allow you to turn it on for debugging it.
The sw test is located at: sw/device/tests/uart_tx_rx_test.c
I had a look at this - seems to be firing an assertion in Ibex:
ASSERT(IbexDataErrWithoutRvalid, data_err_i |-> data_rvalid_i)
I think the assertion is incorrect and can be removed - I'll push a fix in Ibex once I've confirmed.
edit: multiple issues in fact: https://github.com/lowRISC/ibex/pull/928
I had a look at this - seems to be firing an assertion in Ibex:
ASSERT(IbexDataErrWithoutRvalid, data_err_i |-> data_rvalid_i)I think the assertion is incorrect and can be removed - I'll push a fix in Ibex once I've confirmed. edit: multiple issues in fact: lowRISC/ibex#928
@tomroberts-lowrisc I think the assertion firing seems legitimate, considering the Ibex is fetching a bad address (it is not jumping to the ISR properly when the interrupt arrives). I still haven't gotten to the bottom of why this was happening. It seems like you have, so would you please elaborate on what bug(s) were found that had to be fixed? I will be worth revisiting our Ibex level DV testplan to see if we missed something. @udinator
@tomroberts-lowrisc please correct me if I'm wrong, but from looking at the PR you opened in Ibex, one main issue seems to be having an interrupt asserted at the same time a load/store instruction is in the decode stage? @sriyerg the current Ibex testplan has several tests that stress interrupt behavior in Ibex, my best guess as to why I haven't seen this issue before is due to the relatively small chance of the testbench firing an interrupt at the same time as a load/store instruction is in the ID stage. I'll go back to these tests and look into ways to improve them.
That's correct @udinator it needs an interrupt on the same cycle as a load/store - there might be some other timing conditions to hit as well (maybe zero delays on the load/store interface?). The bug causes a second bogus load/store to be issued to a bad address.
The assertion firing was convenient to spot something going wrong, but it's incorrect (that's not how the bus protocol works).
That's correct @udinator it needs an interrupt on the same cycle as a load/store - there might be some other timing conditions to hit as well (maybe zero delays on the load/store interface?). The bug causes a second bogus load/store to be issued to a bad address.
The assertion firing was convenient to spot something going wrong, but it's incorrect (that's not how the bus protocol works).
Yeah, you're right. I think without the assertion error, we would have run into an issue somewhere else eventually since the CPU is already thrown out of whack.
Is this ready to be closed (and have the test re-enabled for the private CI)? @udinator @tomroberts-lowrisc
lowRISC/ibex#1034 has been merged, so I think we should be ok to close this issue (note we need to vendor Ibex into OT to get the latest RTL updates). @GregAC @tomroberts-lowrisc can you confirm?
Closing this issue for now, given that the relevant fixes are in.