[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH v5 9/9] plat/linuxu: Correct timeout calculation for ukplat_lcpu_halt_to()
From: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> time_block_until() in plat/linuxu/lcpu.c was passing the until value directly as timeout value for the underlying pselect6 system call. This fix substracts the current value from the monotonic clock to retrieve the actual timeout value. Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> --- plat/linuxu/lcpu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plat/linuxu/lcpu.c b/plat/linuxu/lcpu.c index 8e9ae35..316351a 100644 --- a/plat/linuxu/lcpu.c +++ b/plat/linuxu/lcpu.c @@ -61,7 +61,12 @@ void halt(void) void time_block_until(__snsec until) { struct k_timespec timeout; + __nsec now = ukplat_monotonic_clock(); + if (until < 0 || (__nsec) until < now) + return; /* timeout expired already */ + + until -= now; timeout.tv_sec = until / ukarch_time_sec_to_nsec(1); timeout.tv_nsec = until % ukarch_time_sec_to_nsec(1); -- 2.18.0 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |