Commit 50aa11e
committed
drivers: timer: native_sim_timer: keep the model ticking at the tick period
hwtimer_enable() sets the period the timer model free-runs at, so arming
the next announce with it stretched that period out to the whole span and
let the model reach the deadline in a single step.
The model paces simulated time against real time once per tick expiry, so
one step of the whole span leaves nothing to pace it. Under
CONFIG_NATIVE_SIM_SLOWDOWN_TO_REAL_TIME an idle with no timeout arms
0x7fffffff ticks, simulated time leaves the wall clock ~248 days behind in
one go, and the model then tries to sleep off the difference. Simulated
time is no longer related to real time and anything sharing the simulation
with a real-world peer stalls: CI hit this on the native offloaded sockets
tests that talk to a host TLS server (net.sockets.tls12.ec_kex,
net.sockets.tls12.psk_kex and sample.net.sockets.http_get.nsos.https all
hung in connect()).
Arm through hwtimer_set_silent_ticks() instead, as the driver did before
the conversion: the period stays at one tick, the model keeps stepping --
and pacing -- a tick at a time, and the ticks up to the deadline are passed
over without raising an interrupt. hwtimer_enable() goes back to the single
call at init that sets that period.
Fixes: 0342c93 ("drivers: timer: native_sim_timer: use the generic timer core")
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-51 parent 7fe0fd9 commit 50aa11e
1 file changed
Lines changed: 22 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
29 | 35 | | |
30 | | - | |
31 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
32 | 45 | | |
33 | 46 | | |
34 | 47 | | |
35 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
36 | 51 | | |
37 | 52 | | |
38 | 53 | | |
| |||
44 | 59 | | |
45 | 60 | | |
46 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
47 | 65 | | |
48 | 66 | | |
49 | 67 | | |
| |||
81 | 99 | | |
82 | 100 | | |
83 | 101 | | |
84 | | - | |
| 102 | + | |
85 | 103 | | |
86 | 104 | | |
87 | 105 | | |
| |||
0 commit comments