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

Re: [Minios-devel] [UNIKRAFT PATCH] lib/ukboot: fflush() after banner is printed



On 29.01.20 10:46, Gaulthier Gain wrote:
Hi Simon,

I tested with musl. Now, we can see the "Unikraft banner" however application 
output is not displayed.

I think that we need to fix this issue in the musl implementation.

I tested that doing fflush to stdout and stderr in the application works, too. The issue with putting an fflush after calling main() is that we can't know what it does with the file descriptors. Probably, the fix is to do an fflush() in helloworld app or to get musl somehow flush the buffers on Unikernel exit. It anyways surprises me that the fflush does not happen automatically on '\n' with this musl port. Is msul behaving the same when on Linux?

However, independent of all this, I still think this patch alone makes sense since it is ensuring the order when the banner is printed during boot. Since uk_pr_* variants suppose to bypass the normal libc printing system, we may have different behavior between printf and uk_pr_* that could cause interleaved or out-of-order output.


Gaulthier

On 27 Jan 2020, at 10:16, Simon Kuenzer <simon.kuenzer@xxxxxxxxx> wrote:

For the case that a libc is adding buffering `stdout`, we are flushing
`stdout` after printing the "Welcome to Unirkaft" banner. This is to
make sure that the output stays in order and does not get mixed with
the kernel and debug output.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
lib/ukboot/boot.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/lib/ukboot/boot.c b/lib/ukboot/boot.c
index 3f5046ca..9bd15ca8 100644
--- a/lib/ukboot/boot.c
+++ b/lib/ukboot/boot.c
@@ -100,6 +100,7 @@ static void main_thread_func(void *arg)
        printf("\\_,_/_//_/_/_/\\_\\/_/  \\_,_/_/ \\__/\n");
        printf("%35s\n",
               STRINGIFY(UK_CODENAME) " " STRINGIFY(UK_FULLVERSION));
+       fflush(stdout);
#endif
        /*
         * Application
--
2.20.1



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