feat: P0-P6 kernel scheduler + relibc threading comprehensive implementation
P0-P2: Barrier SMP, sigmask/pthread_kill races, robust mutexes, RT scheduling, POSIX sched API P3: PerCpuSched struct, per-CPU wiring, work stealing, load balancing, initial placement P4: 64-shard futex table, REQUEUE, PI futexes (LOCK_PI/UNLOCK_PI/TRYLOCK_PI), robust futexes, vruntime tracking, min-vruntime SCHED_OTHER selection P5: setpriority/getpriority, pthread_setaffinity_np, pthread_setname_np, pthread_setschedparam (Redox) P6: Cache-affine scheduling (last_cpu + vruntime bonus), NUMA topology kernel hints + numad userspace daemon Stability fixes: make_consistent stores 0 (dead TID fix), cond.rs error propagation, SPIN_COUNT adaptive spinning, Sys::open &str fix, PI futex CAS race, proc.rs lock ordering, barrier destroy Patches: 33 kernel + 58 relibc patches, all tracked in recipes Docs: KERNEL-SCHEDULER-MULTITHREAD-IMPROVEMENT-PLAN.md updated, SCHEDULER-REVIEW-FINAL.md created Architecture: NUMA topology parsing stays userspace (numad daemon), kernel stores lightweight NumaTopology hints
This commit is contained in:
@@ -6,6 +6,8 @@ patches = [
|
||||
"P0-workspace-add-bootstrap.patch",
|
||||
"P0-bootstrap-workspace-fix.patch",
|
||||
"P2-i2c-gpio-ucsi-drivers.patch",
|
||||
"P3-pcid-bind-scheme.patch",
|
||||
"P3-acpi-wave12-hardening.patch",
|
||||
]
|
||||
|
||||
[build]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[source]
|
||||
git = "https://gitlab.redox-os.org/redox-os/kernel.git"
|
||||
patches = ["redox.patch", "P0-canary.patch", "P1-memory-map-overflow.patch", "../../../local/patches/kernel/P4-supplementary-groups.patch"]
|
||||
patches = ["redox.patch", "P0-canary.patch", "P1-memory-map-overflow.patch", "../../../local/patches/kernel/P4-supplementary-groups.patch", "../../../local/patches/kernel/P4-s3-suspend-resume.patch", "../../../local/patches/kernel/P5-sched-policy-context.patch", "../../../local/patches/kernel/P5-sched-rt-policy.patch", "../../../local/patches/kernel/P5-proc-setschedpolicy.patch", "../../../local/patches/kernel/P5-scheme-sched-id.patch", "../../../local/patches/kernel/P5-context-mod-sched.patch", "../../../local/patches/kernel/P6-vruntime-context.patch", "../../../local/patches/kernel/P6-percpu-runqueues.patch", "../../../local/patches/kernel/P6-futex-sharding.patch", "../../../local/patches/kernel/P6-vruntime-switch.patch", "../../../local/patches/kernel/P7-cache-affine-context.patch", "../../../local/patches/kernel/P7-cache-affine-switch.patch", "../../../local/patches/kernel/P7-proc-setname.patch", "../../../local/patches/kernel/P7-proc-setpriority.patch", "../../../local/patches/kernel/P8-futex-requeue.patch", "../../../local/patches/kernel/P8-futex-pi.patch", "../../../local/patches/kernel/P8-futex-robust.patch", "../../../local/patches/kernel/P8-percpu-wiring.patch", "../../../local/patches/kernel/P8-percpu-sched.patch", "../../../local/patches/kernel/P9-proc-lock-ordering.patch", "../../../local/patches/kernel/P9-futex-pi-cas-fix.patch"]
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
|
||||
@@ -22,6 +22,7 @@ patches = [
|
||||
"../../../local/patches/relibc/P3-select-not-epoll-timeout.patch",
|
||||
"../../../local/patches/relibc/P3-tls-get-addr-panic-fix.patch",
|
||||
"../../../local/patches/relibc/P3-pthread-yield.patch",
|
||||
"../../../local/patches/relibc/P3-barrier-smp-futex.patch",
|
||||
"../../../local/patches/relibc/P3-secure-getenv.patch",
|
||||
"../../../local/patches/relibc/P3-getentropy.patch",
|
||||
"../../../local/patches/relibc/P3-dup3.patch",
|
||||
@@ -38,10 +39,19 @@ patches = [
|
||||
"../../../local/patches/relibc/P3-header-mod-spawn-threads.patch",
|
||||
"../../../local/patches/relibc/P3-spawn.patch",
|
||||
"../../../local/patches/relibc/P3-threads.patch",
|
||||
"../../../local/patches/relibc/P3-pthread-signal-races.patch",
|
||||
"../../../local/patches/relibc/P3-sysv-ipc.patch",
|
||||
"../../../local/patches/relibc/P3-sysv-sem-impl.patch",
|
||||
"../../../local/patches/relibc/P3-sysv-shm-impl.patch",
|
||||
"../../../local/patches/relibc/P4-setgroups-getgroups.patch",
|
||||
"../../../local/patches/relibc/P5-robust-mutexes.patch",
|
||||
"../../../local/patches/relibc/P5-sched-api.patch",
|
||||
"../../../local/patches/relibc/P5-pthread-sigmask-race.patch",
|
||||
"../../../local/patches/relibc/P4-setgroups-unsafe-fix.patch",
|
||||
"../../../local/patches/relibc/P7-setpriority.patch",
|
||||
"../../../local/patches/relibc/P7-pthread-affinity.patch",
|
||||
"../../../local/patches/relibc/P7-pthread-setname.patch",
|
||||
"../../../local/patches/relibc/P9-spin-and-barrier.patch",
|
||||
]
|
||||
|
||||
[build]
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../local/recipes/drivers/ehcid
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../local/recipes/drivers/ohcid
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../local/recipes/drivers/redox-driver-core
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../local/recipes/drivers/redox-driver-pci
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../local/recipes/drivers/uhcid
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../local/recipes/drivers/usb-core
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../local/recipes/kde/kf6-pty
|
||||
@@ -22,6 +22,137 @@ script = """
|
||||
DYNAMIC_STATIC_INIT
|
||||
COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
ac_cv_have_decl_program_invocation_name=no
|
||||
ac_cv_objext=o
|
||||
ac_cv_prog_cc_c_o=yes
|
||||
ac_cv_exeext=
|
||||
acl_cv_rpath=done
|
||||
)
|
||||
|
||||
# Restore the pristine configure scripts on every build, then layer our Redox
|
||||
# cross-build fixes on top. Host autoconf 2.72 regenerates an invalid top-level
|
||||
# configure for this recipe in our environment, so we patch the shipped script
|
||||
# instead of regenerating it.
|
||||
python3 - <<'PYEOF'
|
||||
import os
|
||||
import tarfile
|
||||
from pathlib import Path
|
||||
|
||||
source_dir = Path(os.environ["COOKBOOK_SOURCE"])
|
||||
source_tar = Path(os.environ["COOKBOOK_RECIPE"]) / "source.tar"
|
||||
with tarfile.open(source_tar) as tf:
|
||||
for relative in ("configure", "libcharset/configure"):
|
||||
member = next(m for m in tf.getmembers() if m.name.endswith("/" + relative))
|
||||
target = source_dir / relative
|
||||
target.write_text(tf.extractfile(member).read().decode("utf-8", errors="replace"))
|
||||
PYEOF
|
||||
|
||||
# Upgrade bundled libtool glue in both the top-level tree and nested
|
||||
# libcharset tree to the current host libtool (2.6.0) so generated libtool
|
||||
# helpers match the host ltmain.sh version.
|
||||
for subdir in "${COOKBOOK_SOURCE}" "${COOKBOOK_SOURCE}/libcharset"; do
|
||||
if [ -d "${subdir}" ]; then
|
||||
mkdir -p "${subdir}/m4" "${subdir}/build-aux"
|
||||
cp -f /usr/share/aclocal/libtool.m4 "${subdir}/m4/"
|
||||
cp -f /usr/share/aclocal/ltoptions.m4 "${subdir}/m4/"
|
||||
cp -f /usr/share/aclocal/ltsugar.m4 "${subdir}/m4/"
|
||||
cp -f /usr/share/aclocal/ltversion.m4 "${subdir}/m4/"
|
||||
cp -f /usr/share/aclocal/lt~obsolete.m4 "${subdir}/m4/"
|
||||
cp -f /usr/share/libtool/build-aux/ltmain.sh "${subdir}/build-aux/"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -d "${COOKBOOK_SOURCE}/libcharset" ]; then
|
||||
(
|
||||
cd "${COOKBOOK_SOURCE}/libcharset"
|
||||
cp -f ../srcm4/relocatable.m4 m4/
|
||||
cp -f ../srcm4/codeset.m4 m4/
|
||||
cp -f ../srcm4/fcntl-o.m4 m4/
|
||||
cp -f ../srcm4/visibility.m4 m4/
|
||||
)
|
||||
fi
|
||||
|
||||
# libcharset templates currently keep @HAVE_VISIBILITY@ unsubstituted on our
|
||||
# Redox cross build. Patch the source templates before configure so every
|
||||
# generated header gets a stable fallback value.
|
||||
for template in \
|
||||
"${COOKBOOK_SOURCE}/libcharset/include/libcharset.h.build.in" \
|
||||
"${COOKBOOK_SOURCE}/libcharset/include/localcharset.h.build.in" \
|
||||
"${COOKBOOK_SOURCE}/include/iconv.h.build.in"
|
||||
do
|
||||
if [ -f "${template}" ]; then
|
||||
sed -i 's/@HAVE_VISIBILITY@/0/g' "${template}"
|
||||
fi
|
||||
done
|
||||
|
||||
export CPP="${GNU_TARGET}-gcc -E"
|
||||
|
||||
# Force cross mode in the shipped top-level configure and keep the rest of the
|
||||
# generated shell structure intact.
|
||||
sed -i '0,/cross_compiling=maybe/s//cross_compiling=yes/' "${COOKBOOK_SOURCE}/configure"
|
||||
python3 - <<'PYEOF'
|
||||
from pathlib import Path
|
||||
import os
|
||||
for relative in ('configure', 'libcharset/configure'):
|
||||
path = Path(os.environ['COOKBOOK_SOURCE']) / relative
|
||||
lines = path.read_text().splitlines()
|
||||
for i, line in enumerate(lines):
|
||||
if "macro_version='2.4.7'" in line or "macro_version='2.5.4-redox-9510'" in line:
|
||||
lines[i] = "macro_version='2.6.0'"
|
||||
if "macro_revision='2.4.7'" in line or "macro_revision='2.5.4-redox-9510'" in line:
|
||||
lines[i] = "macro_revision='2.6.0'"
|
||||
if "grep -v '^ *+' conftest.err >conftest.er1" in line:
|
||||
lines[i] = "test -f conftest.err && grep -v '^ *+' conftest.err > conftest.er1.tmp && mv -f conftest.er1.tmp conftest.er1 || :"
|
||||
if 'cat conftest.er1 >&5' in line:
|
||||
lines[i] = 'test -f conftest.er1 && cat conftest.er1 >&5 || :'
|
||||
if 'mv -f conftest.er1 conftest.err' in line:
|
||||
lines[i] = 'test -f conftest.er1 && mv -f conftest.er1 conftest.err || :'
|
||||
if line.strip() == 'rm -f conftest conftest$ac_cv_exeext':
|
||||
lines[i] = 'rm -rf conftest conftest$ac_cv_exeext'
|
||||
path.write_text("\\n".join(lines) + "\\n")
|
||||
PYEOF
|
||||
|
||||
cookbook_configure
|
||||
"""
|
||||
|
||||
# libcharset's configure currently leaves @HAVE_VISIBILITY@ unsubstituted in
|
||||
# generated headers on our Redox cross build. Normalize the generated headers
|
||||
# so the compile path matches the already-published libiconv artifact.
|
||||
for header in \
|
||||
include/libcharset.h \
|
||||
include/localcharset.h \
|
||||
libcharset/include/libcharset.h \
|
||||
libcharset/include/localcharset.h
|
||||
do
|
||||
if [ -f "${header}" ]; then
|
||||
sed -i 's/@HAVE_VISIBILITY@/0/g' "${header}"
|
||||
fi
|
||||
done
|
||||
|
||||
# Force the nested libcharset configure step now, then patch the generated
|
||||
# headers in the build tree before the top-level make descends into libcharset.
|
||||
if [ -d "libcharset" ]; then
|
||||
(
|
||||
cd libcharset
|
||||
"${COOKBOOK_SOURCE}/libcharset/configure" \
|
||||
--disable-option-checking \
|
||||
--prefix=/usr \
|
||||
--host="${GNU_TARGET}" \
|
||||
--enable-shared \
|
||||
--enable-static \
|
||||
ac_cv_have_decl_program_invocation_name=no \
|
||||
CC="${GNU_TARGET}-gcc" \
|
||||
LDFLAGS="${LDFLAGS}" \
|
||||
CPPFLAGS="${CPPFLAGS}" \
|
||||
--cache-file=/dev/null \
|
||||
--srcdir="${COOKBOOK_SOURCE}/libcharset"
|
||||
)
|
||||
for header in \
|
||||
libcharset/include/libcharset.h \
|
||||
libcharset/include/localcharset.h
|
||||
do
|
||||
if [ -f "${header}" ]; then
|
||||
sed -i 's/@HAVE_VISIBILITY@/0/g' "${header}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
"""
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../local/recipes/system/cpufreqd
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../local/recipes/system/driver-manager
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../local/recipes/system/hwrngd
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../local/recipes/system/numad
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../local/recipes/system/thermald
|
||||
Reference in New Issue
Block a user