mbox series

[bug#60129,0/2] VM-optimized Linux-Libre variant

Message ID 20221216221147.13945-1-marius@gnu.org
Headers show
Series VM-optimized Linux-Libre variant | expand

Message

Marius Bakke Dec. 16, 2022, 10:11 p.m. UTC
Hello Guix!

This patch adds a kernel optimized for running inside a VM.

It includes drivers for the popular hypervisors and not much else.
Building it takes ~9 minutes on my machine (7,5 if we disable
CONFIG_TRIM_UNUSED_KSYMS).

The config was created by taking the linux-libre config and removing
things that are generally useless in VMs: hardware drivers, firmware
loading, sleep/hibernate, etc.

The only drivers included are for various hypervisors, the ones required
by our initrd[*], as well as popular emulated hardware (e1000, rtl8169,
sound hardware supported by QEMU, etc).  It's possible some things need
to be re-added to support all the different VPS providers out there.

The kernel is tailored towards server workloads running on a VPS, but
should work fine as a default for "guix system vm", etc.

Some statistics:

  | benchmark               | linux-libre   | linux-libre-virtual |
  |-------------------------|---------------|---------------------|
  | guix size               | 101.4 MiB     | 36.2 MiB            |
  | cpu events/s            | 2707.92       | 2709.19             |
  | 200GiB random mem wr    | 1203.26 MiB/s | 1204.26 MiB/s       |
  | avg thread latency      | 0.89ms        | 0.86ms              |

These numbers were obtained by running two identical VMs mapped to the
same physical cores on an idle host (with static CPU frequency).

(the benchmarks in question were taken with 'sysbench', with the
best out of 3 runs.  Generally -virtual is marginally ahead.)

Thoughts?  Is this useful at all?  Any more interesting benchmarks?

[*] I considered making it module-less; i.e. everything built-in, but
most of our tooling expects an initrd, so maybe not worth the trouble.

Marius Bakke (2):
  activation: Firmware activation handles missing support in kernel.
  gnu: Add linux-libre-virtual.

 Makefile.am                                   |    1 +
 gnu/build/activation.scm                      |    9 +-
 .../linux-libre/6.0-x86_64-virtual.conf       | 5881 +++++++++++++++++
 gnu/packages/linux.scm                        |   11 +
 4 files changed, 5899 insertions(+), 3 deletions(-)
 create mode 100644 gnu/packages/aux-files/linux-libre/6.0-x86_64-virtual.conf

Comments

Ludovic Courtès Dec. 17, 2022, 4:32 p.m. UTC | #1
Hello!

(Cc: kernel “team”.  I’m guessing that the whole team may well
unanimously welcome you on board.  :-))

Marius Bakke <marius@gnu.org> skribis:

> The kernel is tailored towards server workloads running on a VPS, but
> should work fine as a default for "guix system vm", etc.

For a second I wondered whether we should change
‘virtualized-operating-system’ to put it in the ‘kernel’ field
unconditionally.  But it’s probably not a good idea because we have
system tests targeting specific kernels, and because users may want to
test “actual” kernels in QEMU.

>   | benchmark               | linux-libre   | linux-libre-virtual |
>   |-------------------------|---------------|---------------------|
>   | guix size               | 101.4 MiB     | 36.2 MiB            |

Wo0t!

>   activation: Firmware activation handles missing support in kernel.
>   gnu: Add linux-libre-virtual.

You may want a better-informed opinion on the linux-libre bits, but
otherwise LGTM!

Ludo’.
Leo Famulari Dec. 23, 2022, 6:14 p.m. UTC | #2
On Sat, Dec 17, 2022 at 05:32:09PM +0100, Ludovic Courtès wrote:
> You may want a better-informed opinion on the linux-libre bits, but
> otherwise LGTM!

If it's working for your use case, Marius, then LGTM. Thanks!