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

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



Hello,

This patch looks fine.

On 08/31/2018 08:57 AM, 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 8e9ae35..316351a 100644
--- a/plat/linuxu/lcpu.c
+++ b/plat/linuxu/lcpu.c
@@ -61,7 +61,12 @@ void halt(void)

Not related to this patch but why do we use a signed nanosecond as against an unsigned nanosecond.
  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);

Reviewed-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>

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