[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v3 8/8] plat/linuxu: Correct timeout calculation for ukplat_lcpu_halt_to()



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 17335c5..7d7e168 100644
--- a/plat/linuxu/lcpu.c
+++ b/plat/linuxu/lcpu.c
@@ -59,7 +59,12 @@ void halt(void)
 void time_block_until(__snsec until)
 {
        struct 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.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.