From 31b07fedc73176c7f716192e4910e328110c6250 Mon Sep 17 00:00:00 2001 From: Eric Naim Date: Mon, 30 Dec 2024 19:04:33 +0700 Subject: [PATCH 1/4] PKGBUILD: Introduce rt $_preempt option In an attempt to correctly classify $_cpusched as strictly CPU schedulers, remove both `rt` and `rt-bore` from $_cpusched option and move it to $_preempt. In fact, this would be more correct and make more sense, since PREEMPT_RT only makes more code preemptible compared to PREEMPT and doesn't do anything else special. One of the blockers for this was sourcing the OOT patches that were needed for the i915 module to be compiled, but this is not a problem as there is a conditional check for rt to not build zfs. Signed-off-by: Eric Naim --- linux-cachyos-rc/PKGBUILD | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/linux-cachyos-rc/PKGBUILD b/linux-cachyos-rc/PKGBUILD index a7910d5e..f5323edf 100644 --- a/linux-cachyos-rc/PKGBUILD +++ b/linux-cachyos-rc/PKGBUILD @@ -18,8 +18,6 @@ _cachy_config=${_cachy_config-y} # 'hardened' - select 'BORE Scheduler hardened' ## kernel with hardened config and hardening patches with the bore scheduler # 'cachyos' - select 'CachyOS Default Scheduler (BORE)' # 'eevdf' - select 'EEVDF Scheduler' -# 'rt' - select EEVDF, but includes a series of realtime patches -# 'rt-bore' - select Burst-Oriented Response Enhancer, but includes a series of realtime patches _cpusched=${_cpusched-cachyos} ### Tweak kernel options prior to a build via nconfig @@ -76,7 +74,7 @@ _HZ_ticks=${_HZ_ticks-1000} ### Full tickless can give higher performances in various cases but, depending on hardware, lower consistency. _tickrate=${_tickrate-full} -## Choose between full(low-latency), lazy, voluntary or none +## Choose between rt(realtime), full(low-latency), lazy, voluntary or none _preempt=${_preempt-full} ### Transparent Hugepages @@ -224,8 +222,10 @@ if _is_lto_kernel; then fi # WARNING The ZFS module doesn't build with selected RT sched due to licensing issues. -if [[ "$_cpusched" = "rt" || "$_cpusched" = "rt-bore" ]]; then +if [ "$_preempt" = "rt" ]; then unset _build_zfs + # Uncomment this when the patch exists + #source+=("${_patchsource}/misc/0001-rt.patch") fi # ZFS support @@ -263,7 +263,7 @@ fi ## List of CachyOS schedulers case "$_cpusched" in - cachyos|bore|rt-bore|hardened) # CachyOS Scheduler (BORE) + cachyos|bore|hardened) # CachyOS Scheduler (BORE) source+=("${_patchsource}/sched/0001-bore-cachy.patch");;& bmq) ## Project C Scheduler source+=("${_patchsource}/sched/0001-prjc-cachy.patch");; @@ -332,8 +332,6 @@ prepare() { cachyos|bore|hardened) scripts/config -e SCHED_BORE;; bmq) scripts/config -e SCHED_ALT -e SCHED_BMQ;; eevdf) ;; - rt) scripts/config -d PREEMPT -e PREEMPT_RT;; - rt-bore) scripts/config -e SCHED_BORE -d PREEMPT -e PREEMPT_RT;; *) _die "The value $_cpusched is invalid. Choose the correct one again.";; esac @@ -411,12 +409,8 @@ prepare() { echo "Selecting '$_tickrate' tick type..." ### Select preempt type - - # We should not set up the PREEMPT for RT kernels - if [[ "$_cpusched" != "rt" || "$_cpusched" != "rt-bore" ]]; then - [ -z "$_preempt" ] && _die "The value is empty. Choose the correct one again." - case "$_preempt" in + rt) scripts/config -e PREEMPT_DYNAMIC -e PREEMPT -e PREEMPT_RT;; full) scripts/config -e PREEMPT_DYNAMIC -e PREEMPT -d PREEMPT_VOLUNTARY -d PREEMPT_LAZY -d PREEMPT_NONE;; lazy) scripts/config -e PREEMPT_DYNAMIC -d PREEMPT -d PREEMPT_VOLUNTARY -e PREEMPT_LAZY -d PREEMPT_NONE;; voluntary) scripts/config -d PREEMPT_DYNAMIC -e PREEMPT_VOLUNTARY_BUILD -d PREEMPT -e PREEMPT_VOLUNTARY -d PREEMPT_LAZY -d PREEMPT_NONE;; From 296411ae6ea632f7ba5ed7add0c410e9fa9aded1 Mon Sep 17 00:00:00 2001 From: Eric Naim Date: Mon, 30 Dec 2024 19:12:50 +0700 Subject: [PATCH 2/4] PKGBUILD: Remove `cachyos` from $cpusched options This option served two purposes in the past: 1. <6.6: Chooses BORE+EEVDF+sched-ext, at this time, CFS was still the default scheduler 2. <6.12: Chooses BORE+sched-ext Now, this option has no difference than `bore` and only serves to confuse the user. This can also help the PKGBUILDs that have `cachyos-$_cpusched` as suffixes, since unknowingly choosing `cachyos` will lead to a package name of `linux-cachyos-cachyos`. Signed-off-by: Eric Naim --- linux-cachyos-rc/PKGBUILD | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/linux-cachyos-rc/PKGBUILD b/linux-cachyos-rc/PKGBUILD index f5323edf..57f16b10 100644 --- a/linux-cachyos-rc/PKGBUILD +++ b/linux-cachyos-rc/PKGBUILD @@ -16,9 +16,8 @@ _cachy_config=${_cachy_config-y} # 'bore' - select 'Burst-Oriented Response Enhancer' # 'bmq' - select 'BMQ Scheduler' # 'hardened' - select 'BORE Scheduler hardened' ## kernel with hardened config and hardening patches with the bore scheduler -# 'cachyos' - select 'CachyOS Default Scheduler (BORE)' # 'eevdf' - select 'EEVDF Scheduler' -_cpusched=${_cpusched-cachyos} +_cpusched=${_cpusched-bore} ### Tweak kernel options prior to a build via nconfig _makenconfig=${_makenconfig-} @@ -263,7 +262,7 @@ fi ## List of CachyOS schedulers case "$_cpusched" in - cachyos|bore|hardened) # CachyOS Scheduler (BORE) + bore|hardened) # CachyOS Scheduler (BORE) source+=("${_patchsource}/sched/0001-bore-cachy.patch");;& bmq) ## Project C Scheduler source+=("${_patchsource}/sched/0001-prjc-cachy.patch");; @@ -329,7 +328,7 @@ prepare() { [ -z "$_cpusched" ] && _die "The value is empty. Choose the correct one again." case "$_cpusched" in - cachyos|bore|hardened) scripts/config -e SCHED_BORE;; + bore|hardened) scripts/config -e SCHED_BORE;; bmq) scripts/config -e SCHED_ALT -e SCHED_BMQ;; eevdf) ;; *) _die "The value $_cpusched is invalid. Choose the correct one again.";; From 6b48da603ff826a7102bd90cf381e253e9499b98 Mon Sep 17 00:00:00 2001 From: Eric Naim Date: Mon, 30 Dec 2024 19:20:52 +0700 Subject: [PATCH 3/4] PKGBUILD: Remove global `hardened` option from $_cpusched Like the default and handheld kernel, the hardened kernel differs from the other generic cachyos kernels in that it uses its own special config[1]. This means that you can't reproduce a "proper" hardened kernel by simply choosing the `hardened` $_cpusched option. Instead, we should source the patch directly in the main source array, like what we currently do with the handheld patches. This will be addressed in the coming 6.13 stable sync, where no functional changes are intended so even if hardened still stays on 6.12, it should be fine. [1] https://gitlab.archlinux.org/archlinux/packaging/packages/linux-hardened/-/blob/main/config Signed-off-by: Eric Naim --- linux-cachyos-rc/PKGBUILD | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/linux-cachyos-rc/PKGBUILD b/linux-cachyos-rc/PKGBUILD index 57f16b10..e4727ab0 100644 --- a/linux-cachyos-rc/PKGBUILD +++ b/linux-cachyos-rc/PKGBUILD @@ -15,7 +15,6 @@ _cachy_config=${_cachy_config-y} # ATTENTION - only one of the following values can be selected: # 'bore' - select 'Burst-Oriented Response Enhancer' # 'bmq' - select 'BMQ Scheduler' -# 'hardened' - select 'BORE Scheduler hardened' ## kernel with hardened config and hardening patches with the bore scheduler # 'eevdf' - select 'EEVDF Scheduler' _cpusched=${_cpusched-bore} @@ -262,12 +261,10 @@ fi ## List of CachyOS schedulers case "$_cpusched" in - bore|hardened) # CachyOS Scheduler (BORE) - source+=("${_patchsource}/sched/0001-bore-cachy.patch");;& + bore) # CachyOS Scheduler (BORE) + source+=("${_patchsource}/sched/0001-bore-cachy.patch");; bmq) ## Project C Scheduler source+=("${_patchsource}/sched/0001-prjc-cachy.patch");; - hardened) ## Hardened Patches - source+=("${_patchsource}/misc/0001-hardened.patch");; esac export KBUILD_BUILD_HOST=cachyos @@ -328,7 +325,7 @@ prepare() { [ -z "$_cpusched" ] && _die "The value is empty. Choose the correct one again." case "$_cpusched" in - bore|hardened) scripts/config -e SCHED_BORE;; + bore) scripts/config -e SCHED_BORE;; bmq) scripts/config -e SCHED_ALT -e SCHED_BMQ;; eevdf) ;; *) _die "The value $_cpusched is invalid. Choose the correct one again.";; From 923c3297d84bcd2bf157d7536dd617006e67e3cf Mon Sep 17 00:00:00 2001 From: Eric Naim Date: Mon, 30 Dec 2024 19:25:15 +0700 Subject: [PATCH 4/4] PKGBUILD: Add the PDS scheduler to $_cpusched This provides an easier way to use the PDS scheduler along with the CachyOS patchset. While it is very likely that we will not compile this for our repositories, it can be useful for the users that care about PDS. Signed-off-by: Eric Naim --- linux-cachyos-rc/PKGBUILD | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linux-cachyos-rc/PKGBUILD b/linux-cachyos-rc/PKGBUILD index e4727ab0..e32fa952 100644 --- a/linux-cachyos-rc/PKGBUILD +++ b/linux-cachyos-rc/PKGBUILD @@ -15,6 +15,7 @@ _cachy_config=${_cachy_config-y} # ATTENTION - only one of the following values can be selected: # 'bore' - select 'Burst-Oriented Response Enhancer' # 'bmq' - select 'BMQ Scheduler' +# 'pds' - select 'PDS scheduler' # 'eevdf' - select 'EEVDF Scheduler' _cpusched=${_cpusched-bore} @@ -263,7 +264,7 @@ fi case "$_cpusched" in bore) # CachyOS Scheduler (BORE) source+=("${_patchsource}/sched/0001-bore-cachy.patch");; - bmq) ## Project C Scheduler + bmq|pds) ## Project C Scheduler source+=("${_patchsource}/sched/0001-prjc-cachy.patch");; esac @@ -327,6 +328,7 @@ prepare() { case "$_cpusched" in bore) scripts/config -e SCHED_BORE;; bmq) scripts/config -e SCHED_ALT -e SCHED_BMQ;; + pds) scripts/config -e SCHED_ALT -e SCHED_PDS;; eevdf) ;; *) _die "The value $_cpusched is invalid. Choose the correct one again.";; esac