From f7c733c2d1e437b2f64041d96cdeaedc96872aa3 Mon Sep 17 00:00:00 2001 From: Jack O'Sullivan Date: Sat, 21 Nov 2026 23:57:13 +0000 Subject: [PATCH] nixos/spdk: Move to SPDK 26.09 SPDK 26.01 crashes while scanning the PCI bus with DPDK 26.07. Pick up the fork's bump to SPDK 26.09, which adds the 26.07 compatibility layer, and drop the 26.01-only DPDK 26.03 workaround. SPDK 26.09 sizes transport caches from the shared iobuf pool, so the RDMA transport on `cellar` starved the bdev and accel caches. Set its caches explicitly and enlarge the pools. Also retry `spdk-tgt` on failure, as loading its config can fail intermittently at startup. Co-Authored-By: Claude Opus 5.5 --- flake.lock | 6 +++--- nixos/boxes/home/palace/vms/cellar/spdk.nix | 19 ++++++++++++++++++- nixos/modules/spdk.nix | 12 +++--------- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/flake.lock b/flake.lock index 8e354e9..cac7ca8 100644 --- a/flake.lock +++ b/flake.lock @@ -893,11 +893,11 @@ }, "nixpkgs-mine": { "locked": { - "lastModified": 1795296436, - "narHash": "sha256-HXC2lD2la2+b9uWP9keGtnK/XOy2WmxL7i2dvQ/YqTI=", + "lastModified": 1795358527, + "narHash": "sha256-TTljUnAmsqpOpvEqzYqcMjU0GF/ZLkLc5F1AVrkwd/g=", "owner": "devplayer0", "repo": "nixpkgs", - "rev": "d49dd66c813e9c18778620a557e66a837936c3bd", + "rev": "320600d55ff67365e933b98b339acdeac238eb26", "type": "github" }, "original": { diff --git a/nixos/boxes/home/palace/vms/cellar/spdk.nix b/nixos/boxes/home/palace/vms/cellar/spdk.nix index bc4cbc4..7ca2a16 100644 --- a/nixos/boxes/home/palace/vms/cellar/spdk.nix +++ b/nixos/boxes/home/palace/vms/cellar/spdk.nix @@ -75,6 +75,18 @@ in ]; in { + # Sized with `scripts/calc-iobuf.py` for the 16-core mask: the bdev and accel caches + # plus the RDMA transport's, with headroom for in-flight I/O + iobuf = [ + { + method = "iobuf_set_options"; + params = { + small_pool_count = 16384; + large_pool_count = 2048; + }; + } + ]; + scheduler = [ { method = "framework_set_scheduler"; @@ -107,7 +119,12 @@ in nvmf = [ { method = "nvmf_create_transport"; - params.trtype = "RDMA"; + params = { + trtype = "RDMA"; + # The default takes whatever the shared pool has left, starving the other caches + iobuf_small_cache_size = 32; + iobuf_large_cache_size = 32; + }; } (nvmfListener "nqn.2014-08.org.nvmexpress.discovery") ] ++ (nvmfBdev { diff --git a/nixos/modules/spdk.nix b/nixos/modules/spdk.nix index a8c681a..599d03b 100644 --- a/nixos/modules/spdk.nix +++ b/nixos/modules/spdk.nix @@ -49,15 +49,6 @@ let spdk = pkgs.spdk.overrideAttrs (o: { configureFlags = o.configureFlags ++ (map (withFeature true) [ "rdma" "ublk" ]); buildInputs = o.buildInputs ++ (with pkgs; [ liburing ]); - # SPDK 26.01 recognizes prerelease DPDK 26.03, but selects the old PCI ABI for its release. - # TODO: Remove after upgrading to SPDK >= 26.05, which handles released DPDK 26.03: - # https://github.com/spdk/spdk/blob/v26.05/lib/env_dpdk/pci_dpdk.c - # nixos-unstable still packages 26.01 without this fix (checked 2026-11-15). - postPatch = (o.postPatch or "") + lib.optionalString (o.version == "26.01") '' - substituteInPlace lib/env_dpdk/pci_dpdk.c \ - --replace-fail 'else if (year == 25) {' \ - 'else if (year == 25 || (year == 26 && month == 3 && minor == 0)) {' - ''; }); spdk-rpc = (pkgs.writeShellScriptBin "spdk-rpc" '' exec ${pkgs.python3}/bin/python3 ${spdk.src}/scripts/rpc.py "$@" @@ -111,6 +102,9 @@ in serviceConfig = { ExecStartPre = "${spdk.src}/scripts/setup.sh"; ExecStart = "${spdk}/bin/spdk_tgt ${cfg.extraArgs} -c ${configJSON}"; + # Loading the config can fail intermittently at startup; an identical retry succeeds + Restart = "on-failure"; + RestartSec = "5s"; }; wantedBy = [ "multi-user.target" ]; # Other boxes' root disks; restart by hand when they can do without them