|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [UNIKRAFT PATCH RFCv4 32/35] plat/arm/generic_timer: Fix assert in ns_to_ticks
There is a UK_ASSERT hit when testing nginx app with backtrace:
[ 88.612809] CRIT: [libkvmplat] generic_timer.c @ 84 : Assertion failure:
ns <= (3600UL*((1) * 1000000000ULL))
[ 88.614229] Info: [libkvmplat] shutdown.c @ 35 : Unikraft halted
[0x4010514c] uk_dump_backtrace+0/0x4c
[0x40100d78] ns_to_ticks+0x68/0x98
[0x40101028] generic_timer_cpu_block_until+0x94/0xd8
[0x40100a08] time_block_until+0x18/0x5c
[0x401049ec] ukplat_lcpu_halt_to+0x1c/0x30
[0x4011f258] schedcoop_schedule+0x370/0x414
[0x4011f7d0] schedcoop_yield+0x14/0x20
[0x40141568] uk_sched_yield+0xf4/0x100
[0x40141d60] uk_9preq_waitreply+0x94/0xe4
[0x40144a24] send_and_wait_zc+0x94/0xc4
[0x40144a80] send_and_wait_no_zc+0x2c/0x34
[0x40145370] uk_9p_open+0xcc/0x19c
[0x4013941c] uk_9pfs_write+0x118/0x2a4
[0x40132790] vfs_write+0xb8/0x134
[0x4012a744] sys_write+0x158/0x188
[0x4012dd5c] pwrite+0x78/0xdc
[0x4012dee0] __uk_syscall_e_write+0x28/0x30
[0x4012deb0] uk_syscall_e_write+0x34/0x3c
[0x4012dde4] write+0x24/0x2c
[0x4022da44] ngx_write_fd+0x24/0x2c
[0x4022dd70] ngx_log_error_core+0x324/0x45c
[0x40235f90] ngx_destroy_pool+0x16c/0x228
[0x4027a278] ngx_http_close_connection+0x9c/0xa8
[0x40279584] ngx_http_keepalive_handler+0x26c/0x348
[0x402564dc] ngx_event_process_posted+0xfc/0x11c
[0x40250bd8] ngx_process_events_and_timers+0x1c8/0x1d8
[0x4025c368] ngx_single_process_cycle+0xf4/0x294
[0x4021b4fc] nginx_main+0x560/0x580
[0x4021ae7c] main+0x1c/0x24
This fixes it by acquiring until_ticks only when now_ns < until_ns
Signed-off-by: Jia He <justin.he@xxxxxxx>
---
plat/common/arm/generic_timer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/plat/common/arm/generic_timer.c b/plat/common/arm/generic_timer.c
index 58a9f40..1b63f84 100644
--- a/plat/common/arm/generic_timer.c
+++ b/plat/common/arm/generic_timer.c
@@ -220,10 +220,10 @@ void generic_timer_cpu_block_until(uint64_t until_ns)
/* Record current ns and until_ticks for timer */
now_ns = ukplat_monotonic_clock();
- until_ticks = generic_timer_get_ticks()
- + ns_to_ticks(until_ns - now_ns);
if (now_ns < until_ns) {
+ until_ticks = generic_timer_get_ticks()
+ + ns_to_ticks(until_ns - now_ns);
generic_timer_update_compare(until_ticks);
generic_timer_enable();
generic_timer_unmask_irq();
--
2.17.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |