]> xenbits.xensource.com Git - people/andrewcoop/xen-test-framework.git/commitdiff
Introduce hypercall_poll() infrastructure for the console
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 4 Jul 2017 09:05:37 +0000 (09:05 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 18 Jul 2017 13:53:04 +0000 (14:53 +0100)
The current write() path stays using yield() until the xl/xenconsoled race
condition it tickles is understood.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
common/console.c
include/xtf/hypercall.h
include/xtf/types.h

index c008a4bd6a6425141b49aaeaef022e4aeaaaf238..7cb2361d531dd12f1f21fac2b1bef2b1bacb414d 100644 (file)
@@ -1,9 +1,11 @@
 #include <xtf/types.h>
 #include <xtf/atomic.h>
+#include <xtf/bitops.h>
 #include <xtf/console.h>
 #include <xtf/hypercall.h>
 #include <xtf/lib.h>
 #include <xtf/libc.h>
+#include <xtf/traps.h>
 
 /*
  * Output functions, registered if/when available.
@@ -79,6 +81,9 @@ static void pv_console_write(const char *buf, size_t len)
 
 void init_pv_console(xencons_interface_t *ring, evtchn_port_t port)
 {
+    if ( port >= (sizeof(shared_info.evtchn_pending) * CHAR_BIT) )
+        panic("evtchn %u out of evtchn_pending[] range\n", port);
+
     pv_ring = ring;
     pv_evtchn = port;
     register_console_callback(pv_console_write);
index 63c16f3ec1ac90e3dd9b7d6e384f68fc81d21ae0..17e9636560771e12768797e0b59d59ebb976eba8 100644 (file)
@@ -149,6 +149,13 @@ static inline void hypercall_yield(void)
     hypercall_sched_op(SCHEDOP_yield, NULL);
 }
 
+static inline long hypercall_poll(evtchn_port_t port)
+{
+    struct sched_poll poll = { .ports = &port, .nr_ports = 1 };
+
+    return hypercall_sched_op(SCHEDOP_poll, &poll);
+}
+
 static inline int hypercall_register_callback(const xen_callback_register_t *arg)
 {
     return hypercall_callback_op(CALLBACKOP_register, arg);
index 4b827c2df8a826956f4e3a0e6e9ddf431fbbfd7f..a2ab15e4ade81ae3273e9ab01e4409cea194002b 100644 (file)
@@ -13,6 +13,7 @@
 #include <stdarg.h>
 #include <stddef.h>
 #include <inttypes.h>
+#include <limits.h>
 
 /**
  * An array which the linker resolves to 0.