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

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



Hi,

You want to add a commit message here explaining why the flush. You cover letter seems a good candidate for that.

On 10/25/18 5:05 PM, Birlea Costin wrote:
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..3df06d4 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()
+{
+       struct xencons_interface *intf;
+
+       if (!console_ready)
+               return;
+
+       intf = console_ring;
+       if (unlikely(!intf))
+               return ;
+
+       while (intf->out_cons < intf->out_prod)

The compiler is free to assume that the value of out_const and out_prod will never change. So the following optimization is valid:

a = intf->out_cons;
b = intf->out_prod;
while (a  < b);

And will result to potentially an infinite loop. You can request the compiler to always read out_cons and out_prod by adding a barrier in the loop. I.e:

while (intf->out_cons < int->out_prod)
{
    barrier();
}

Cheers,

--
Julien Grall

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