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

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



Hello,

Please find the comments inline:

On 08/20/2018 01:21 PM, Florian Schmidt wrote:
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 afb1d7e..ee8baf1 100644
--- a/plat/linuxu/lcpu.c
+++ b/plat/linuxu/lcpu.c
@@ -60,7 +60,12 @@ void halt(void)
  void time_block_until(__snsec until)
  {
        struct timespec timeout;

We are using this timespec from nolibc in the platform library. I would suggest we define a single design principle and stick with it.
+       __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);

Thanks & Regards
Sharan

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