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

[Minios-devel] [UNIKRAFT PATCH v3] plat/xen: Add flush for xen console



Add flush function for xen console. Shutdown can be requested
before the hypervisor gets to print everything to the console
and stops trying. This happens in ukutest and does not get to
print Passed(x/y). This patch assures everything is written
before shutting down.

Signed-off-by: Birlea Costin <costin.birlea@xxxxxxxxx>
---
 plat/xen/console.c                | 14 ++++++++++++++
 plat/xen/include/common/console.h |  3 +++
 plat/xen/shutdown.c               |  3 +++
 3 files changed, 20 insertions(+)

diff --git a/plat/xen/console.c b/plat/xen/console.c
index c0b35c7..a70ec5f 100644
--- a/plat/xen/console.c
+++ b/plat/xen/console.c
@@ -203,6 +203,20 @@ static void hvconsole_input(evtchn_port_t port __unused,
        /* NOT IMPLEMENTED YET */
 }
 
+void hvconsole_flush(void)
+{
+       struct xencons_interface *intf;
+
+       if (!console_ready)
+               return;
+
+       intf = console_ring;
+       if (unlikely(!intf))
+               return;
+
+       while (intf->out_cons < intf->out_prod)
+               barrier();
+}
 
 void _libxenplat_init_console(void)
 {
diff --git a/plat/xen/include/common/console.h 
b/plat/xen/include/common/console.h
index c51c69b..b4f1b51 100644
--- a/plat/xen/include/common/console.h
+++ b/plat/xen/include/common/console.h
@@ -45,4 +45,7 @@ void _libxenplat_prepare_console(void);
  */
 void _libxenplat_init_console(void);
 
+
+void hvconsole_flush(void);
+
 #endif /* __CONSOLE_H__ */
diff --git a/plat/xen/shutdown.c b/plat/xen/shutdown.c
index e1758ff..272ece4 100644
--- a/plat/xen/shutdown.c
+++ b/plat/xen/shutdown.c
@@ -40,6 +40,7 @@
 #include <errno.h>
 
 #include <xen/xen.h>
+#include <common/console.h>
 
 #if defined __X86_32__
 #include <xen-x86/hypercall32.h>
@@ -65,6 +66,8 @@ void ukplat_terminate(enum ukplat_gstate request)
                break;
        }
 
+       hvconsole_flush();
+
        for (;;) {
                struct sched_shutdown sched_shutdown = { .reason = reason };
 
-- 
2.11.0


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