From ef823ba338eb5ff75dcbbe6667c7414730fbbe90 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Mon, 10 Jul 2023 22:09:28 +0100 Subject: [PATCH 1/5] linuxKernel.kernels.linux_zen: 6.4.1-zen1 -> 6.4.2-zen1 --- pkgs/os-specific/linux/kernel/zen-kernels.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/zen-kernels.nix b/pkgs/os-specific/linux/kernel/zen-kernels.nix index 2c9eb76b4548..cf8ff9ff614c 100644 --- a/pkgs/os-specific/linux/kernel/zen-kernels.nix +++ b/pkgs/os-specific/linux/kernel/zen-kernels.nix @@ -4,9 +4,9 @@ let # comments with variant added for update script # ./update-zen.py zen zenVariant = { - version = "6.4.1"; #zen + version = "6.4.2"; #zen suffix = "zen1"; #zen - sha256 = "05a3dplzz6vy5gjz9yd1hz7n4xf3mlr2q112kf3yabg8k8izqnys"; #zen + sha256 = "1swd3y97w55wh9vl6k1bsrx6fqi6b6ssbw306h87nxn36xwzx8cd"; #zen isLqx = false; }; # ./update-zen.py lqx From 322da8a27c29be88cd70c768a38824ad0c6fb27f Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Mon, 10 Jul 2023 22:12:15 +0100 Subject: [PATCH 2/5] linuxKernel.kernels.linux_lqx: 6.3.11-lqx2 -> 6.4.2-lqx1 --- pkgs/os-specific/linux/kernel/zen-kernels.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/zen-kernels.nix b/pkgs/os-specific/linux/kernel/zen-kernels.nix index cf8ff9ff614c..113968e13c04 100644 --- a/pkgs/os-specific/linux/kernel/zen-kernels.nix +++ b/pkgs/os-specific/linux/kernel/zen-kernels.nix @@ -11,9 +11,9 @@ let }; # ./update-zen.py lqx lqxVariant = { - version = "6.3.11"; #lqx - suffix = "lqx2"; #lqx - sha256 = "0hpzafw2zwy25ss4cwj6mm8pr1nnv680m8bfcal29f7gaxbm96k8"; #lqx + version = "6.4.2"; #lqx + suffix = "lqx1"; #lqx + sha256 = "14hr88lbwm2pz3knw6nxlahdk4pwwb4ya63mrd7zg7g1x2xhfb59"; #lqx isLqx = true; }; zenKernelsFor = { version, suffix, sha256, isLqx }: buildLinux (args // { From 7ff753d4495c2b4cd9deba97def55507f151b87a Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Mon, 10 Jul 2023 23:03:48 +0100 Subject: [PATCH 3/5] linuxKernel.kernels.linux_{lqx,zen}: add thiagokokada as maintainer --- pkgs/os-specific/linux/kernel/zen-kernels.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/kernel/zen-kernels.nix b/pkgs/os-specific/linux/kernel/zen-kernels.nix index 113968e13c04..edc949a308b8 100644 --- a/pkgs/os-specific/linux/kernel/zen-kernels.nix +++ b/pkgs/os-specific/linux/kernel/zen-kernels.nix @@ -32,7 +32,7 @@ let extraMeta = { branch = lib.versions.majorMinor version + "/master"; - maintainers = with lib.maintainers; [ ]; + maintainers = with lib.maintainers; [ thiagokokada ]; description = "Built using the best configuration and kernel sources for desktop, multimedia, and gaming workloads." + lib.optionalString isLqx " (Same as linux_zen but less aggressive release schedule)"; }; From be1d7789aa82fabb1f4ce5d9420c62963eeff118 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Mon, 10 Jul 2023 22:59:26 +0100 Subject: [PATCH 4/5] linuxKernel.kernels.linux_{lqx,zen}: add custom extra config This is based on the following sources: - https://gitlab.archlinux.org/archlinux/packaging/packages/linux-zen/-/blob/main/config - https://github.com/damentz/liquorix-package/blob/6.4/master/linux-liquorix/debian/config/kernelarch-x86/config-arch-64 - https://liquorix.net/ This is not supposed to be exhaustive, so we may not completely match upstream here. However, we should get most of the improvements in upstream webpage, and there is always space for further tuning in the future. Fixes: #241986 --- pkgs/os-specific/linux/kernel/zen-kernels.nix | 72 ++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/kernel/zen-kernels.nix b/pkgs/os-specific/linux/kernel/zen-kernels.nix index edc949a308b8..776c0c656040 100644 --- a/pkgs/os-specific/linux/kernel/zen-kernels.nix +++ b/pkgs/os-specific/linux/kernel/zen-kernels.nix @@ -28,13 +28,83 @@ let inherit sha256; }; + # This is based on the following sources: + # - zen: https://gitlab.archlinux.org/archlinux/packaging/packages/linux-zen/-/blob/main/config + # - lqx: https://github.com/damentz/liquorix-package/blob/6.4/master/linux-liquorix/debian/config/kernelarch-x86/config-arch-64 + # - Liquorix features: https://liquorix.net/ + # The list below is not exhaustive, so the kernels probably doesn't match + # the upstream, but should bring most of the improvements that will be + # expected by users + structuredExtraConfig = with lib.kernel; { + # Zen Interactive tuning + ZEN_INTERACTIVE = yes; + + # FQ-Codel Packet Scheduling + NET_SCH_DEFAULT = yes; + DEFAULT_FQ_CODEL = yes; + DEFAULT_NET_SCH = freeform "fq_codel"; + + # Preempt (low-latency) + PREEMPT = lib.mkOverride 60 yes; + PREEMPT_VOLUNTARY = lib.mkOverride 60 no; + + # Preemptible tree-based hierarchical RCU + TREE_RCU = yes; + PREEMPT_RCU = yes; + RCU_EXPERT = yes; + TREE_SRCU = yes; + TASKS_RCU_GENERIC = yes; + TASKS_RCU = yes; + TASKS_RUDE_RCU = yes; + TASKS_TRACE_RCU = yes; + RCU_STALL_COMMON = yes; + RCU_NEED_SEGCBLIST = yes; + RCU_FANOUT = freeform "64"; + RCU_FANOUT_LEAF = freeform "16"; + RCU_BOOST = yes; + RCU_BOOST_DELAY = freeform "500"; + RCU_NOCB_CPU = yes; + RCU_LAZY = yes; + + # Futex WAIT_MULTIPLE implementation for Wine / Proton Fsync. + FUTEX = yes; + FUTEX_PI = yes; + + # Preemptive Full Tickless Kernel at 1000Hz + HZ = freeform "1000"; + HZ_1000 = yes; + } // lib.optionalAttrs (isLqx) { + # Google's BBRv2 TCP congestion Control + TCP_CONG_BBR2 = yes; + DEFAULT_BBR2 = yes; + DEFAULT_TCP_CONG = freeform "bbr2"; + + # PDS Process Scheduler + SCHED_ALT = yes; + SCHED_PDS = yes; + + # Swap storage is compressed with LZ4 using zswap + ZSWAP_COMPRESSOR_DEFAULT_LZ4 = yes; + ZSWAP_COMPRESSOR_DEFAULT = freeform "lz4"; + + # Fix error: unused option: XXX. + CFS_BANDWIDTH = lib.mkForce (option no); + PSI = lib.mkForce (option no); + RT_GROUP_SCHED = lib.mkForce (option no); + SCHED_AUTOGROUP = lib.mkForce (option no); + SCHED_CORE = lib.mkForce (option no); + + # ERROR: modpost: "sched_numa_hop_mask" [drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko] undefined! + MLX5_CORE = no; + }; + passthru.updateScript = [ ./update-zen.py (if isLqx then "lqx" else "zen") ]; extraMeta = { branch = lib.versions.majorMinor version + "/master"; maintainers = with lib.maintainers; [ thiagokokada ]; description = "Built using the best configuration and kernel sources for desktop, multimedia, and gaming workloads." + - lib.optionalString isLqx " (Same as linux_zen but less aggressive release schedule)"; + lib.optionalString isLqx " (Same as linux_zen, but less aggressive release schedule and additional extra config)"; }; } // (args.argsOverride or { })); From b2a4f6a735455415d780926f807db53d21af258e Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 11 Jul 2023 15:50:15 +0100 Subject: [PATCH 5/5] linuxKernel.kernels.linux_{lqx,zen}: mark as broken in aarch64 --- pkgs/os-specific/linux/kernel/zen-kernels.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/kernel/zen-kernels.nix b/pkgs/os-specific/linux/kernel/zen-kernels.nix index 776c0c656040..9455f887dd28 100644 --- a/pkgs/os-specific/linux/kernel/zen-kernels.nix +++ b/pkgs/os-specific/linux/kernel/zen-kernels.nix @@ -1,4 +1,4 @@ -{ lib, fetchFromGitHub, buildLinux, ... } @ args: +{ lib, stdenv, fetchFromGitHub, buildLinux, ... } @ args: let # comments with variant added for update script @@ -105,6 +105,7 @@ let maintainers = with lib.maintainers; [ thiagokokada ]; description = "Built using the best configuration and kernel sources for desktop, multimedia, and gaming workloads." + lib.optionalString isLqx " (Same as linux_zen, but less aggressive release schedule and additional extra config)"; + broken = stdenv.isAarch64; }; } // (args.argsOverride or { }));