|
|
e76f14 |
From 26a13abce6cc73595eb2adf3db46d25c017c2e06 Mon Sep 17 00:00:00 2001
|
|
|
e76f14 |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
e76f14 |
Date: Thu, 17 Mar 2016 08:35:54 +0000
|
|
|
e76f14 |
Subject: [PATCH] appliance: Pass "quiet" option to kernel when !verbose.
|
|
|
e76f14 |
|
|
|
e76f14 |
The quiet option suppresses kernel messages. On my laptop it improves
|
|
|
e76f14 |
appliance boot times by about 40% (3.5s -> 2.5s).
|
|
|
e76f14 |
|
|
|
e76f14 |
The emulated UART is slow and has a fixed, small FIFO (16 bytes). But
|
|
|
e76f14 |
it has the advantage of being a simple ISA device which is available
|
|
|
e76f14 |
very early in boot, thus enabling us to diagnose early boot problems.
|
|
|
e76f14 |
So the aim is to reduce our usage of this UART on fast paths.
|
|
|
e76f14 |
|
|
|
e76f14 |
Of course when we are in verbose mode, we should not add this flag
|
|
|
e76f14 |
because we want to see all the messages.
|
|
|
e76f14 |
|
|
|
e76f14 |
This change is not entirely invisible:
|
|
|
e76f14 |
|
|
|
e76f14 |
(1) Progress messages use the "Linux version ..." string from kernel
|
|
|
e76f14 |
output in order to determine part of where we are in the boot process.
|
|
|
e76f14 |
This string will no longer be detected. We should probably use a BIOS
|
|
|
e76f14 |
message or maybe drop this altogether. I have added a comment to the
|
|
|
e76f14 |
code.
|
|
|
e76f14 |
|
|
|
e76f14 |
(2) It is possible for programs to be listening for
|
|
|
e76f14 |
GUESTFS_EVENT_APPLIANCE events, and they will see fewer messages now
|
|
|
e76f14 |
(although what kernel messages programs see is never defined).
|
|
|
e76f14 |
|
|
|
e76f14 |
(cherry picked from commit ed739e71f634b363c3cf6a0a4eca559eaae7f7b3)
|
|
|
e76f14 |
---
|
|
|
e76f14 |
src/launch.c | 4 ++--
|
|
|
e76f14 |
src/proto.c | 3 +++
|
|
|
e76f14 |
2 files changed, 5 insertions(+), 2 deletions(-)
|
|
|
e76f14 |
|
|
|
e76f14 |
diff --git a/src/launch.c b/src/launch.c
|
|
|
e76f14 |
index de50774..229069f 100644
|
|
|
e76f14 |
--- a/src/launch.c
|
|
|
e76f14 |
+++ b/src/launch.c
|
|
|
e76f14 |
@@ -359,7 +359,7 @@ guestfs_int_appliance_command_line (guestfs_h *g, const char *appliance_dev,
|
|
|
e76f14 |
" cgroup_disable=memory" /* saves us about 5 MB of RAM */
|
|
|
e76f14 |
"%s" /* root=appliance_dev */
|
|
|
e76f14 |
" %s" /* selinux */
|
|
|
e76f14 |
- "%s" /* verbose */
|
|
|
e76f14 |
+ " %s" /* quiet/verbose */
|
|
|
e76f14 |
"%s" /* network */
|
|
|
e76f14 |
" TERM=%s" /* TERM environment variable */
|
|
|
e76f14 |
"%s%s" /* handle identifier */
|
|
|
e76f14 |
@@ -370,7 +370,7 @@ guestfs_int_appliance_command_line (guestfs_h *g, const char *appliance_dev,
|
|
|
e76f14 |
lpj_s,
|
|
|
e76f14 |
root,
|
|
|
e76f14 |
g->selinux ? "selinux=1 enforcing=0" : "selinux=0",
|
|
|
e76f14 |
- g->verbose ? " guestfs_verbose=1" : "",
|
|
|
e76f14 |
+ g->verbose ? "guestfs_verbose=1" : "quiet",
|
|
|
e76f14 |
g->enable_network ? " guestfs_network=1" : "",
|
|
|
e76f14 |
term ? term : "linux",
|
|
|
e76f14 |
STRNEQ (g->identifier, "") ? " guestfs_identifier=" : "",
|
|
|
e76f14 |
diff --git a/src/proto.c b/src/proto.c
|
|
|
e76f14 |
index a4fc987..1bc349a 100644
|
|
|
e76f14 |
--- a/src/proto.c
|
|
|
e76f14 |
+++ b/src/proto.c
|
|
|
e76f14 |
@@ -129,6 +129,9 @@ guestfs_int_log_message_callback (guestfs_h *g, const char *buf, size_t len)
|
|
|
e76f14 |
const char *sentinel;
|
|
|
e76f14 |
size_t slen;
|
|
|
e76f14 |
|
|
|
e76f14 |
+ /* Since 2016-03, if !verbose, then we add the "quiet" flag to the
|
|
|
e76f14 |
+ * kernel, so the following sentinel will never be produced. XXX
|
|
|
e76f14 |
+ */
|
|
|
e76f14 |
sentinel = "Linux version"; /* kernel up */
|
|
|
e76f14 |
slen = strlen (sentinel);
|
|
|
e76f14 |
if (memmem (buf, len, sentinel, slen) != NULL)
|
|
|
e76f14 |
--
|
|
|
aa0300 |
2.7.4
|
|
|
e76f14 |
|