From ecf388e90b68e1437e124a02a4a7c44f71eaf342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20He=C3=9F?= Date: Fri, 22 Oct 2021 17:27:03 +0200 Subject: [PATCH] vmTools: Make msize larger to silence warning See https://issues.guix.gnu.org/47225 --- nixos/modules/virtualisation/qemu-vm.nix | 2 +- pkgs/build-support/vm/default.nix | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index 6ce4461babc7..67fde55faabe 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -306,7 +306,7 @@ in virtualisation.msize = mkOption { type = types.ints.positive; - default = 16384; + default = pkgs.vmTools.default9PMsizeBytes; description = '' The msize (maximum packet size) option passed to 9p file systems, in diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix index a6633d11286f..a0f3b5efbaeb 100644 --- a/pkgs/build-support/vm/default.nix +++ b/pkgs/build-support/vm/default.nix @@ -110,7 +110,7 @@ rec { echo "mounting Nix store..." mkdir -p /fs${storeDir} - mount -t 9p store /fs${storeDir} -o trans=virtio,version=9p2000.L,cache=loose + mount -t 9p store /fs${storeDir} -o trans=virtio,version=9p2000.L,cache=loose,msize=${toString default9PMsizeBytes} mkdir -p /fs/tmp /fs/run /fs/var mount -t tmpfs -o "mode=1777" none /fs/tmp @@ -119,7 +119,7 @@ rec { echo "mounting host's temporary directory..." mkdir -p /fs/tmp/xchg - mount -t 9p xchg /fs/tmp/xchg -o trans=virtio,version=9p2000.L + mount -t 9p xchg /fs/tmp/xchg -o trans=virtio,version=9p2000.L,msize=${toString default9PMsizeBytes} mkdir -p /fs/proc mount -t proc none /fs/proc @@ -1174,4 +1174,9 @@ rec { `debDistros' sets. */ diskImages = lib.mapAttrs (name: f: f {}) diskImageFuns; + # The default 9P msize value is 8 KiB, which according to QEMU is + # insufficient and would degrade performance. + # See: https://wiki.qemu.org/Documentation/9psetup#msize + # Use 500 KiB as a conservative default, see also https://github.com/NixOS/nixpkgs/pull/142577#issuecomment-953848731 + default9PMsizeBytes = 512000; }