From 3e24e46c70330f8f98588f973bc775c5506c3c9c Mon Sep 17 00:00:00 2001 From: Bo Chen Date: Mon, 11 Oct 2021 17:38:45 -0700 Subject: [PATCH 1/2] virtcontainers: clh: Turn-off serial and virtio-console by default We will need to have console output from the guest only for debugging purposes. As a result, we can turn-off both the serial and virtio-console devices by default for better boot time. Fixes: #2820 Signed-off-by: Bo Chen --- src/runtime/virtcontainers/clh.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/runtime/virtcontainers/clh.go b/src/runtime/virtcontainers/clh.go index 50479880a6..be2d0e6688 100644 --- a/src/runtime/virtcontainers/clh.go +++ b/src/runtime/virtcontainers/clh.go @@ -285,11 +285,12 @@ func (clh *cloudHypervisor) createSandbox(ctx context.Context, id string, networ clh.vmconfig.Pmem = &[]chclient.PmemConfig{*pmem} } - // set the serial console to the cloud hypervisor + // Use serial port as the guest console only in debug mode, + // so that we can gather early OS booting log if clh.config.Debug { clh.vmconfig.Serial = chclient.NewConsoleConfig(cctTTY) } else { - clh.vmconfig.Serial = chclient.NewConsoleConfig(cctNULL) + clh.vmconfig.Serial = chclient.NewConsoleConfig(cctOFF) } clh.vmconfig.Console = chclient.NewConsoleConfig(cctOFF) @@ -988,9 +989,8 @@ func (clh *cloudHypervisor) launchClh() (int, error) { //########################################################################### const ( - cctOFF string = "Off" - cctNULL string = "Null" - cctTTY string = "Tty" + cctOFF string = "Off" + cctTTY string = "Tty" ) const ( From 7b2bfd4eca526b20ef8bcc7bd974edeb545d0575 Mon Sep 17 00:00:00 2001 From: Bo Chen Date: Mon, 11 Oct 2021 17:41:13 -0700 Subject: [PATCH 2/2] virtcontainers: clh: Use 'quiet' as the default kernel parameter The 'quiet' kernel parameter can avoid guest kernel logs while booting, which can reduce boot time. Fix: #2820 Signed-off-by: Bo Chen --- src/runtime/virtcontainers/clh.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/runtime/virtcontainers/clh.go b/src/runtime/virtcontainers/clh.go index be2d0e6688..6788993e40 100644 --- a/src/runtime/virtcontainers/clh.go +++ b/src/runtime/virtcontainers/clh.go @@ -257,6 +257,9 @@ func (clh *cloudHypervisor) createSandbox(ctx context.Context, id string, networ // Followed by extra debug parameters if debug enabled in configuration file if clh.config.Debug { params = append(params, clhDebugKernelParams...) + } else { + // start the guest kernel with 'quiet' in non-debug mode + params = append(params, Param{"quiet", ""}) } // Followed by extra kernel parameters defined in the configuration file