# -- sched_ext + BPF (required) --
# sched_ext scheduling class. Depends on BPF_SYSCALL + BPF_JIT + DEBUG_INFO_BTF.
CONFIG_BPF=y
CONFIG_BPF_SYSCALL=y
CONFIG_BPF_JIT=y
CONFIG_BPF_JIT_ALWAYS_ON=y
CONFIG_SCHED_CLASS_EXT=y

# -- Debug info (required) --
# BTF for monitor struct resolution, BPF CO-RE, probe output.
# DWARF for source locations in probe output.
# DEBUG_INFO_REDUCED breaks BTF generation — must stay off.
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
CONFIG_DEBUG_INFO_BTF=y
# Module BTF embeds BTF into .ko files. ktstr runs a monolithic
# kernel with no loadable modules — the scheduler is a BPF program,
# not a .ko. Disable to avoid resolve_btfids/pahole crashes during
# modfinal on some arm64 toolchains.
# CONFIG_DEBUG_INFO_BTF_MODULES is not set
# CONFIG_DEBUG_INFO_REDUCED is not set

# -- Tracing/probes (required) --
# Kprobes for ktstr probe pipeline. ftrace for dynamic attachment
# and scx scheduler tracing (e.g. LAVD futex tracing).
# PERF_EVENTS: explicit dep of BPF_EVENTS (provided by defconfig's
# PROFILING=y, but stated here so the tracing section is self-contained).
# FTRACE: top-level gate for all tracing infrastructure. arm64 defconfig
# disables it — without FTRACE=y, KPROBE_EVENTS, BPF_EVENTS, and
# FUNCTION_TRACER are silently dropped (inside `if FTRACE` in Kconfig).
CONFIG_FTRACE=y
CONFIG_KPROBES=y
CONFIG_KPROBE_EVENTS=y
CONFIG_PERF_EVENTS=y
# BPF_EVENTS: default y when deps met (KPROBE_EVENTS + PERF_EVENTS).
# Explicit for clarity.
CONFIG_BPF_EVENTS=y
CONFIG_DEBUG_FS=y
CONFIG_FUNCTION_TRACER=y
CONFIG_DYNAMIC_FTRACE=y

# -- Boot/console (required) --
# Init script mounts /proc (reads /proc/cmdline for SHM_BASE),
# /sys (sysfs for cgroups, tracing), and reads /dev/mem for
# SHM dump polling.
#
# Serial: x86 VMM uses ISA 16550 (COM1/COM2), arm64 uses ns16550a via MMIO.
# Both drivers are included so the same fragment works on either arch.
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
# FDT-based probing for 8250 ports — required on arm64 where the
# VMM's ns16550a UARTs are described in the device tree. Without
# this, the kernel has no driver to match the ns16550a FDT nodes
# and /dev/ttyS* devices are never created.
CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
# Virtio-console: MMIO transport, creates /dev/hvc0 for shell mode.
CONFIG_VIRTIO=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_RD_LZ4=y
CONFIG_TTY=y
CONFIG_UNIX98_PTYS=y
CONFIG_PROC_FS=y
CONFIG_SYSFS=y
CONFIG_DEVMEM=y
# CONFIG_STRICT_DEVMEM is not set
CONFIG_DEVTMPFS=y
CONFIG_TMPFS=y
CONFIG_SHMEM=y
CONFIG_BINFMT_SCRIPT=y
# x86 only — arm64 uses earlycon (auto-selected by PL011/8250 drivers).
CONFIG_EARLY_PRINTK=y

# -- Topology (required) --
# Multi-socket/core/thread VMs with NUMA.
# On x86_64, X86_64_ACPI_NUMA is def_bool y when NUMA + ACPI + PCI
# and selects ACPI_NUMA automatically.
CONFIG_SMP=y
CONFIG_NUMA=y

# -- Cgroups (required) --
# Scenario cpuset partitioning and CPU controller.
CONFIG_CGROUPS=y
CONFIG_CPUSETS=y
CONFIG_CGROUP_SCHED=y

# -- KVM guest (required) --
# Steal time accounting: guest scheduler sees actual CPU time
# (not wall clock including host preemption), producing
# bare-metal-like scheduling decisions.
# x86: kvmclock via HYPERVISOR_GUEST + PARAVIRT.
# arm64: SMCCC PV Time via PARAVIRT (auto-selected by
#        PARAVIRT_TIME_ACCOUNTING). HYPERVISOR_GUEST is
#        x86-only and silently ignored on arm64.
CONFIG_HYPERVISOR_GUEST=y
CONFIG_PARAVIRT=y
CONFIG_PARAVIRT_TIME_ACCOUNTING=y

# -- Scheduler features (safe, no behavioral change) --
# SCHEDSTATS: runtime-disabled by default (static key NOP).
# Opt in via sysctl kernel.sched_schedstats=1.
CONFIG_SCHEDSTATS=y
# SCHED_MC: multi-core scheduling awareness. Affects task
# placement across cores within a package.
CONFIG_SCHED_MC=y
# Symbols for monitor kallsyms resolution.
CONFIG_KALLSYMS_ALL=y
# Embedded .config for CONFIG_HZ detection by ktstr monitor.
# IKCONFIG_PROC exposes /proc/config.gz for runtime inspection.
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y

# -- Disabled (would alter scheduler behavior) --
# LOCKDEP: 10-100x lock overhead. Non-representative timing.
# Use for catching locking bugs, not for scheduler testing.
# CONFIG_PROVE_LOCKING is not set
# CONFIG_DEBUG_LOCKDEP is not set
# PSI: per-enqueue/dequeue/switch overhead (cgroup hierarchy
# walk). Active by default when compiled in. Opt in only.
# CONFIG_PSI is not set
# DEBUG_INFO_REDUCED: breaks BTF generation.
# CONFIG_DEBUG_INFO_SPLIT is not set

# -- Opt-in: changes scheduler behavior intentionally --
# Uncomment to enable broader test coverage at the cost of
# different scheduling characteristics.
#
# Full preemption (kernel preemptible at most points):
# CONFIG_PREEMPT=y
# CONFIG_PREEMPT_DYNAMIC=y
#
# NUMA page migration (auto-migrates pages to local node):
# CONFIG_NUMA_BALANCING=y
#
# Core scheduling (co-schedule trusted tasks on SMT siblings):
# CONFIG_SCHED_CORE=y

# -- Disable unnecessary subsystems (faster build) --
# CONFIG_SOUND is not set
# CONFIG_DRM is not set
# CONFIG_USB_SUPPORT is not set
# CONFIG_WIRELESS is not set
# CONFIG_BLUETOOTH is not set
# CONFIG_INPUT is not set
# CONFIG_FB is not set
# CONFIG_VGA_CONSOLE is not set
