[PATCH supermin 0/5] Make supermin mini-initrd quieter and faster.
Various patches to make supermin quieter. By outputting fewer messages on the fast path, we use the slow emulated UART less, and this improves boot times. Also remove some kernel modules that we cannot or should not be using, which also improves boot times. Rich.
--- init/init.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/init/init.c b/init/init.c index 80b2232..3014de2 100644 --- a/init/init.c +++ b/init/init.c @@ -71,10 +71,10 @@ static const char *moderror(int err) } } -/* Leave this enabled for now. When we get more confident in the boot - * process we can turn this off or make it configurable. +/* If "quiet" is found on the command line, set this which suppresses + * ordinary debug messages. */ -#define verbose 1 +static int quiet = 0; static void mount_proc (void); static void print_uptime (void); @@ -90,7 +90,6 @@ main () { mount_proc (); - print_uptime (); fprintf (stderr, "supermin: ext2 mini initrd starting up: " PACKAGE_VERSION #if defined(__dietlibc__) @@ -105,6 +104,12 @@ main () "\n"); read_cmdline (); + quiet = strstr (cmdline, "quiet") != NULL; + + if (!quiet) { + fprintf (stderr, "supermin: cmdline: %s\n", cmdline); + print_uptime (); + } /* Create some fixed directories. */ mkdir ("/dev", 0755); @@ -112,7 +117,7 @@ main () mkdir ("/sys", 0755); /* Mount /sys. */ - if (verbose) + if (!quiet) fprintf (stderr, "supermin: mounting /sys\n"); if (mount ("sysfs", "/sys", "sysfs", 0, "") == -1) { perror ("mount: /sys"); @@ -208,7 +213,7 @@ main () exit (EXIT_FAILURE); found: - if (verbose) + if (!quiet) fprintf (stderr, "supermin: picked %s as root device\n", path); fgets (line, sizeof line, fp); @@ -229,7 +234,7 @@ main () perror ("ioctl: TIOCSCTTY"); #endif - if (verbose) + if (!quiet) fprintf (stderr, "supermin: creating /dev/root as block special %d:%d\n", major, minor); @@ -239,7 +244,7 @@ main () } /* Mount new root and chroot to it. */ - if (verbose) + if (!quiet) fprintf (stderr, "supermin: mounting new root on /root\n"); if (mount ("/dev/root", "/root", "ext2", MS_NOATIME, "") == -1) { perror ("mount: /root"); @@ -250,7 +255,7 @@ main () * Documentation/filesystems/ramfs-rootfs-initramfs.txt * We could remove the old initramfs files, but let's not bother. */ - if (verbose) + if (!quiet) fprintf (stderr, "supermin: chroot\n"); if (chroot ("/root") == -1) { @@ -282,7 +287,7 @@ insmod (const char *filename) { size_t size; - if (verbose) + if (!quiet) fprintf (stderr, "supermin: internal insmod %s\n", filename); int fd = open (filename, O_RDONLY); @@ -323,7 +328,7 @@ mount_proc (void) if (access ("/proc/uptime", R_OK) == -1) { mkdir ("/proc", 0755); - if (verbose) + if (!quiet) fprintf (stderr, "supermin: mounting /proc\n"); if (mount ("proc", "/proc", "proc", 0, "") == -1) { @@ -370,8 +375,6 @@ read_cmdline (void) len = strlen (cmdline); if (len >= 1 && cmdline[len-1] == '\n') cmdline[len-1] = '\0'; - - fprintf (stderr, "supermin: cmdline: %s\n", cmdline); } /* Display a directory on stderr. This is used for debugging only. */ -- 2.5.0
In all modern kernels IDE support is provided by libata, not the ancient ide*.ko module. The other disadvantage of this wildcard was that it picked up various unrelated modules, eg. ideapad_slidebar.ko (plus dependencies). --- src/ext2_initrd.ml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ext2_initrd.ml b/src/ext2_initrd.ml index 09536d3..50ac924 100644 --- a/src/ext2_initrd.ml +++ b/src/ext2_initrd.ml @@ -38,7 +38,6 @@ let kmods = [ "ext2.ko*"; "ext4.ko*"; (* CONFIG_EXT4_USE_FOR_EXT23=y option might be set *) "virtio*.ko*"; - "ide*.ko*"; "libata*.ko*"; "piix*.ko*"; "scsi_transport_spi.ko*"; -- 2.5.0
The megaraid driver was added to test an old bug. Remove it since copying this driver to the mini-initrd and loading it each time is not free. This reverts commit 9da479658818738b2a2a68456e867cdb609472c8. --- src/ext2_initrd.ml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ext2_initrd.ml b/src/ext2_initrd.ml index 50ac924..f222bb8 100644 --- a/src/ext2_initrd.ml +++ b/src/ext2_initrd.ml @@ -50,7 +50,6 @@ let kmods = [ "crc*.ko*"; "libcrc*.ko*"; "ibmvscsic.ko*"; - "megaraid*.ko*"; ] let rec build_initrd debug tmpdir modpath initrd = -- 2.5.0
This module is described as "Filesystem Meta Information Block Cache (mbcache). The mbcache caches blocks of block devices that need to be located by their device/block number, as well as by other criteria (such as the block's contents)." It is compiled into the kernel in Fedora, and if it is required on other distros then it should be pulled in by module dependencies. --- src/ext2_initrd.ml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ext2_initrd.ml b/src/ext2_initrd.ml index f222bb8..730f806 100644 --- a/src/ext2_initrd.ml +++ b/src/ext2_initrd.ml @@ -46,7 +46,6 @@ let kmods = [ "sym53c8xx.ko*"; "ata_piix.ko*"; "sr_mod.ko*"; - "mbcache.ko*"; "crc*.ko*"; "libcrc*.ko*"; "ibmvscsic.ko*"; -- 2.5.0
Also drop the sr_mod module used by the deprecated guestfs_add_cdrom interface. --- src/ext2_initrd.ml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/ext2_initrd.ml b/src/ext2_initrd.ml index 730f806..5e841ea 100644 --- a/src/ext2_initrd.ml +++ b/src/ext2_initrd.ml @@ -40,12 +40,7 @@ let kmods = [ "virtio*.ko*"; "libata*.ko*"; "piix*.ko*"; - "scsi_transport_spi.ko*"; - "scsi_mod.ko*"; - "sd_mod.ko*"; - "sym53c8xx.ko*"; "ata_piix.ko*"; - "sr_mod.ko*"; "crc*.ko*"; "libcrc*.ko*"; "ibmvscsic.ko*"; -- 2.5.0
On 03/17/2016 12:07, Richard W.M. Jones wrote:
Also drop the sr_mod module used by the deprecated guestfs_add_cdrom interface. --- src/ext2_initrd.ml | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/src/ext2_initrd.ml b/src/ext2_initrd.ml index 730f806..5e841ea 100644 --- a/src/ext2_initrd.ml +++ b/src/ext2_initrd.ml @@ -40,12 +40,7 @@ let kmods = [ - "sd_mod.ko*";
sd_mod.ko is required on Debian jessie (with kernel from backports 4.3.0-0.bpo.1-amd64), otherwise it won't find /sys/block/sdb/dev. Best regards, -- Edwin Török | Co-founder and Lead Developer Skylable open-source object storage: reliable, fast, secure http://www.skylable.com
On Sun, Mar 20, 2016 at 01:30:17PM +0200, Török Edwin wrote:
On 03/17/2016 12:07, Richard W.M. Jones wrote:
Also drop the sr_mod module used by the deprecated guestfs_add_cdrom interface. --- src/ext2_initrd.ml | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/src/ext2_initrd.ml b/src/ext2_initrd.ml index 730f806..5e841ea 100644 --- a/src/ext2_initrd.ml +++ b/src/ext2_initrd.ml @@ -40,12 +40,7 @@ let kmods = [ - "sd_mod.ko*";
sd_mod.ko is required on Debian jessie (with kernel from backports 4.3.0-0.bpo.1-amd64), otherwise it won't find /sys/block/sdb/dev.
Agreed. On Fedora it's compiled in, and also I notice that the virtio-scsi module doesn't require it so it won't be pulled in by module dependencies. scsi_mod.ko seems like it might be in a similar situation? I'll partially revert this patch, just sd_mod.ko for now. BTW please see also my series on analyzing the launch process. You might find it interesting. I'll post an updated patch series in a moment. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
On 03/20/2016 14:20, Richard W.M. Jones wrote:
On Sun, Mar 20, 2016 at 01:30:17PM +0200, Török Edwin wrote:
On 03/17/2016 12:07, Richard W.M. Jones wrote:
Also drop the sr_mod module used by the deprecated guestfs_add_cdrom interface. --- src/ext2_initrd.ml | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/src/ext2_initrd.ml b/src/ext2_initrd.ml index 730f806..5e841ea 100644 --- a/src/ext2_initrd.ml +++ b/src/ext2_initrd.ml @@ -40,12 +40,7 @@ let kmods = [ - "sd_mod.ko*";
sd_mod.ko is required on Debian jessie (with kernel from backports 4.3.0-0.bpo.1-amd64), otherwise it won't find /sys/block/sdb/dev.
Agreed. On Fedora it's compiled in, and also I notice that the virtio-scsi module doesn't require it so it won't be pulled in by module dependencies.
scsi_mod.ko seems like it might be in a similar situation?
scsi_mod gets pulled in by sd_mod so depending just on sd_mod seems to be enough: kernel/drivers/scsi/sd_mod.ko: kernel/drivers/scsi/scsi_mod.ko
I'll partially revert this patch, just sd_mod.ko for now.
supermin HEAD works on Debian again now, thanks! FWIW this is the full list of what gets loaded on Debian: guestfish -a /dev/null run -v 2>&1|grep insmod supermin: internal insmod crc32-pclmul.ko supermin: internal insmod crc32c-intel.ko supermin: internal insmod crct10dif-pclmul.ko supermin: internal insmod crc32.ko supermin: internal insmod crc32c_generic.ko supermin: internal insmod scsi_mod.ko supermin: internal insmod libata.ko supermin: internal insmod ata_piix.ko supermin: internal insmod virtio.ko supermin: internal insmod virtio_ring.ko supermin: internal insmod virtio_blk.ko supermin: internal insmod rng-core.ko supermin: internal insmod virtio-rng.ko supermin: internal insmod virtio_console.ko supermin: internal insmod virtio_net.ko supermin: internal insmod sd_mod.ko supermin: internal insmod virtio_scsi.ko supermin: internal insmod virtio_balloon.ko supermin: internal insmod virtio_input.ko supermin: internal insmod virtio_pci.ko supermin: internal insmod jbd2.ko supermin: internal insmod mbcache.ko supermin: internal insmod crc16.ko supermin: internal insmod ext4.ko supermin: internal insmod crc-ccitt.ko supermin: internal insmod crc-itu-t.ko supermin: internal insmod crc7.ko supermin: internal insmod libcrc32c.ko
BTW please see also my series on analyzing the launch process. You might find it interesting.
I do, was trying to see if I can get QBoot working to compare but no luck.
I'll post an updated patch series in a moment.
Thanks, will followup there. Best regards, -- Edwin Török | Co-founder and Lead Developer Skylable open-source object storage: reliable, fast, secure http://www.skylable.com
On Thursday 17 March 2016 10:07:34 Richard W.M. Jones wrote:
Various patches to make supermin quieter. By outputting fewer messages on the fast path, we use the slow emulated UART less, and this improves boot times.
Also remove some kernel modules that we cannot or should not be using, which also improves boot times.
The series LGTM. Thanks, -- Pino Toscano
On Thu, Mar 17, 2016 at 10:07:34AM +0000, Richard W.M. Jones wrote:
Various patches to make supermin quieter. By outputting fewer messages on the fast path, we use the slow emulated UART less, and this improves boot times.
Also remove some kernel modules that we cannot or should not be using, which also improves boot times.
Trying to apply this series on current Git master fails for me. I'm here: $ git describe v5.1.15-10-gaa720f5 While applying, the first patch ("init: If "quiet" is found on the command line, suppress debug output") fails: $ git am `git-find-series-in-maildir \ ~/Mail/RH/libguestfs/cur/1458209606_0.20513.tesla\,U\=1561870\,FMD5\=d735770317fa502b04f5c5707608ec3c\:2\,FS` Applying: init: If "quiet" is found on the command line, suppress debug output. error: patch failed: init/init.c:71 error: init/init.c: patch does not apply Patch failed at 0001 init: If "quiet" is found on the command line, suppress debug output. The copy of the patch that failed is found in: /home/kashyapc/tinker-space/supermin/.git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". I don't mind applying patche series from list at all for testing, but just wondering -- have any convenient branch to test? I quickly checked on GitHub, but I couldn't your 'supermin' tree there. -- /kashyap
On Mon, Mar 21, 2016 at 07:02:32AM +0100, Kashyap Chamarthy wrote:
On Thu, Mar 17, 2016 at 10:07:34AM +0000, Richard W.M. Jones wrote:
Various patches to make supermin quieter. By outputting fewer messages on the fast path, we use the slow emulated UART less, and this improves boot times.
Also remove some kernel modules that we cannot or should not be using, which also improves boot times.
Trying to apply this series on current Git master fails for me.
I'm here:
$ git describe v5.1.15-10-gaa720f5
While applying, the first patch ("init: If "quiet" is found on the command line, suppress debug output") fails:
$ git am `git-find-series-in-maildir \ ~/Mail/RH/libguestfs/cur/1458209606_0.20513.tesla\,U\=1561870\,FMD5\=d735770317fa502b04f5c5707608ec3c\:2\,FS` Applying: init: If "quiet" is found on the command line, suppress debug output. error: patch failed: init/init.c:71 error: init/init.c: patch does not apply Patch failed at 0001 init: If "quiet" is found on the command line, suppress debug output. The copy of the patch that failed is found in: /home/kashyapc/tinker-space/supermin/.git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
I don't mind applying patche series from list at all for testing, but just wondering -- have any convenient branch to test? I quickly checked on GitHub, but I couldn't your 'supermin' tree there.
I think it's because I pushed all these patches upstream already. See: https://github.com/libguestfs/supermin You'll probably find the libguestfs patches for boot analysis more interesting. See: https://github.com/rwmjones/libguestfs/commits/master Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
On Mon, Mar 21, 2016 at 08:41:23AM +0000, Richard W.M. Jones wrote:
On Mon, Mar 21, 2016 at 07:02:32AM +0100, Kashyap Chamarthy wrote:
[...]
I don't mind applying patche series from list at all for testing, but just wondering -- have any convenient branch to test? I quickly checked on GitHub, but I couldn't your 'supermin' tree there.
I think it's because I pushed all these patches upstream already.
Ah, right. I wrongly assumed (and didn't bother to check `git log`) that you didn't yet, as I haven't seen a "Thanks, pushed" message on that thread. Sorry for the noise.
See:
https://github.com/libguestfs/supermin
You'll probably find the libguestfs patches for boot analysis more interesting. See:
Yep, I have them applied locally, but was yak-shaving on my slow network -- `make -j4` locally complains 'aclocal-1.13' is missing; while I have automake-1.15-4.fc23.noarch locally. -- /kashyap
participants (4)
-
Kashyap Chamarthy -
Pino Toscano -
Richard W.M. Jones -
Török Edwin