whiterose

linux unikernel
Log | Files | Refs | README | LICENSE | git clone https://git.ne02ptzero.me/git/whiterose

commit b4d6cab6f65c5d03420d428b549be0a6c9c55d58
parent b02efdec25d157be4ba92516b3bff08f944d0563
Author: Louis Solofrizzo <lsolofrizzo@online.net>
Date:   Thu, 25 Apr 2019 09:31:28 +0200

ukl: implementation of the hybrid unikernel

This patches introduces a new boot param: ukl-hybrid. When this
parameter is passed to the kernel, the UKL does not hand indefinetely
after launch, and instead launch the init process in userspace like a
normal boot. The idea behind this is to keep network conf / monitoring /
debug / access / etc in userspace, in order not to rewrite / port the
entire GNU userspace in kernel. The 'ukl' option still launch the UKL
without starting the userspace at all.

Signed-off-by: Louis Solofrizzo <lsolofrizzo@online.net>

Diffstat:
Minit/main.c | 22+++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/init/main.c b/init/main.c @@ -349,12 +349,23 @@ __setup("init=", init_setup); #ifdef CONFIG_UKL_LINUX bool ukl_mode = false; +bool ukl_hybrid_mode = false; + static int __init ukl_kernel(char *str) { ukl_mode = true; return 1; } early_param("ukl", ukl_kernel); + +static int __init ukl_hybrid_kernel(char *str) +{ + ukl_hybrid_mode = true; + ukl_mode = true; + return 1; +} +early_param("ukl-hybrid", ukl_hybrid_kernel); + #endif /* CONFIG_UKL_LINUX */ static int __init rdinit_setup(char *str) @@ -1021,8 +1032,14 @@ static int run_ukl_main(void) { printk("Launching Unikernel...\n"); kthread_run((void *)ukl_main, NULL, "UKL"); - while (1) - cond_resched(); + + /* On non-hybrid mode, let's do nothin till the end of time */ + if (!ukl_hybrid_mode) { + while (1) + cond_resched(); + } + + /* Else, let's launch the init ! */ return 0; } #endif /* CONFIG_UKL_LINUX */ @@ -1110,7 +1127,6 @@ static int __ref kernel_init(void *unused) #ifdef CONFIG_UKL_LINUX if (ukl_mode) { run_ukl_main(); - return 0; } #endif /* CONFIG_UKL_LINUX */