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

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



Reviewed-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>

On 06/14/2018 04:12 PM, Simon Kuenzer wrote:
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);

--
Dr. Florian Schmidt
フローリアン・シュミット
Research Scientist,
Systems and Machine Learning Group
NEC Laboratories Europe
Kurfürsten-Anlage 36, D-69115 Heidelberg
Tel.     +49 (0)6221 4342-265
Fax:     +49 (0)6221 4342-155
e-mail:  florian.schmidt@xxxxxxxxx
============================================================
Registered at Amtsgericht Mannheim, Germany, HRB728558

_______________________________________________
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®.