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

[Xen-devel] [PATCH v4 4/7] add nspin_sleep function to time manager



this function spin sleeps for t nanoseconds

Signed-off-by: Paul Semel <phentex@xxxxxxxxx>
---

Notes:
    v4:
    - new patch version

 common/time.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/common/time.c b/common/time.c
index 8489f3b..232e134 100644
--- a/common/time.c
+++ b/common/time.c
@@ -139,6 +139,18 @@ int gettimeofday(struct timeval *tp, void *restrict tzp)
     return 0;
 }
 
+static inline void nspin_sleep(uint64_t t)
+{
+    uint64_t curr = since_boot_time();
+    uint64_t end = curr + t;
+
+    if ( end < curr )
+        panic("end value overflows counter\n");
+
+    while ( since_boot_time() < end )
+        asm volatile ("pause");
+}
+
 /*
  * Local variables:
  * mode: C
-- 
2.16.1


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

 


Rackspace

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