ZXFoundation™ 26h2
Loading...
Searching...
No Matches
core.cxxm File Reference

Scheduler types. More...

import std;
import arch.s390x.cpu.irq;
import zxfoundation.sched.rq.types;
import zxfoundation.sys.timer.types;
import lib.error;
import zxfoundation.dgp.domain.types;
import zxfoundation.base.types;
import zxfoundation.sched.policy;
Include dependency graph for core.cxxm:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

auto zxfoundation::sched::cpu_down (u16 cpu_id) noexcept -> ::std::expected< void, ::lib::kernel_error >
 Notify the scheduler that a CPU is going offline.
auto zxfoundation::sched::cpu_rq (u16 cpu_id) noexcept -> run_queue &
auto zxfoundation::sched::cpu_timer (u16 cpu_id) noexcept -> zxfoundation::sys::timer::kernel_timer &
 Return the per-CPU periodic tick timer used by the nohz machinery.
auto zxfoundation::sched::cpu_timer_tick () noexcept -> void
 CPU timer quantum enforcement — fires when a strand's quantum expires.
auto zxfoundation::sched::cpu_up (u16 cpu_id) noexcept -> ::std::expected< void, ::lib::kernel_error >
 Notify the scheduler that a CPU has come online.
 zxfoundation::sched::declscope (C) auto __switch_to_asm(strand *prev
auto zxfoundation::sched::dequeue_domain (domain *d) noexcept -> void
auto zxfoundation::sched::dequeue_strand (strand *s) noexcept -> void
auto zxfoundation::sched::enqueue_domain (domain *d) noexcept -> void
auto zxfoundation::sched::enqueue_strand (strand *s) noexcept -> void
auto zxfoundation::sched::idle_enter () noexcept -> void
auto zxfoundation::sched::irq_handler_cpu_timer (u16 irq, arch::s390x::cpu::irq::irq_frame *frame, void *data) noexcept -> void
 CPU timer IRQ handler — dispatches vector EXT_IRQ_CPU_TIMER.
auto zxfoundation::sched::need_resched () noexcept -> bool
auto zxfoundation::sched::preempt_schedule () noexcept -> void
auto zxfoundation::sched::quiesce_domain (domain &d) noexcept -> std::expected< void, lib::kernel_error >
 Quiesce every strand owned by a domain before identity teardown.
auto zxfoundation::sched::sched_active () noexcept -> bool
auto zxfoundation::sched::sched_init () noexcept -> void
auto zxfoundation::sched::sched_init_ap (u16 cpu_id) noexcept -> void
auto zxfoundation::sched::sched_resched_current () noexcept -> void
 Mark the currently executing domain as needing rescheduling.
auto zxfoundation::sched::schedule () noexcept -> void
auto zxfoundation::sched::scheduler_tick () noexcept -> void
 Periodic scheduler tick.
auto zxfoundation::sched::strand_admit_policy (strand &s, const zxfoundation::sched::sched_policy &policy) noexcept -> std::expected< zxfoundation::sched::sched_admission_result, lib::kernel_error >
 Admit a scheduler policy for a strand before run-queue insertion.
auto zxfoundation::sched::strand_spawn (const zxfoundation::dgp::domain::strand_create_request &request) noexcept -> std::expected< zxfoundation::dgp::domain::strand *, lib::kernel_error >
 Create and optionally enqueue a secondary strand for a DGP domain.
auto zxfoundation::sched::strand_trampoline_exit () noexcept -> void
auto zxfoundation::sched::this_rq () noexcept -> run_queue &

Detailed Description

Scheduler types.

Scheduler core — schedule(), tick, init, work-stealing, softirq, nohz.

SPDX-License-Identifier: Apache-2.0

Function Documentation

◆ cpu_down()

auto zxfoundation::sched::cpu_down ( u16 cpu_id) ->::std::expected< void,::lib::kernel_error >
nodiscardexportnoexcept

Notify the scheduler that a CPU is going offline.

Parameters
[in]cpu_idLogical CPU ID going offline.
Returns
Success or kernel_error.

◆ quiesce_domain()

auto zxfoundation::sched::quiesce_domain ( domain & d) ->std::expected< void, lib::kernel_error >
nodiscardexportnoexcept

Quiesce every strand owned by a domain before identity teardown.

Parameters
[in]dDomain entering the dying state.
Returns
Success when no strand is running and all runnable strands are removed.

◆ strand_admit_policy()

auto zxfoundation::sched::strand_admit_policy ( strand & s,
const zxfoundation::sched::sched_policy & policy )->std::expected< zxfoundation::sched::sched_admission_result, lib::kernel_error >
nodiscardexportnoexcept

Admit a scheduler policy for a strand before run-queue insertion.

Parameters
[in,out]sStrand receiving the policy metadata.
[in]policyRequested scheduler policy.
Returns
Admission record on success, or kernel_error when DGP/class policy denies the request.

◆ strand_spawn()

auto zxfoundation::sched::strand_spawn ( const zxfoundation::dgp::domain::strand_create_request & request) ->std::expected< zxfoundation::dgp::domain::strand *, lib::kernel_error >
nodiscardexportnoexcept

Create and optionally enqueue a secondary strand for a DGP domain.

Parameters
[in]requestExecutor-style creation request selecting one of three strand kinds:
  • Kernel-thread: entry != nullptr, uregs == nullptr. The strand's first __switch_to_asm dispatches via ret_from_fork to domain_trampoline, which invokes entry(arg) on the kernel stack and then tail-calls sched_strand_trampoline_exit (the do_exit analog).
  • User-process: entry == nullptr, uregs != nullptr with psw_addr != 0. The strand's first __switch_to_asm dispatches via ret_from_fork to ret_to_user, which LPSWEs into user mode at uregs->psw_addr with uregs->psw_mask. The AR/VR/FPC state from uregs is pre-staged in the strand's save area so __switch_to_asm itself restores them onto the CPU before control reaches ret_from_fork.
  • Bare (idle): entry == nullptr AND uregs == nullptr. The strand is allocated but no first-switch frame is written. request.enqueue MUST be false (a bare strand with no entry must not be admitted to a run queue — scheduling it would LPSWE into garbage). Useful for SCOMS bookkeeping paths that need a strand object but have no runnable work yet.
Returns
Pointer to the created strand, or kernel_error if validation, allocation, or admission fails.
Warning
The kernel-thread and user-process modes are mutually exclusive: entry != nullptr AND uregs != nullptr is rejected with invalid_arg. The bare mode requires enqueue == false.

The kthread vs user split mirrors Linux copy_thread:

  • Kernel-thread: entry(arg) runs on the new strand's kernel stack and tail-calls sched_strand_trampoline_exit on return.
  • User-process: the new strand's first context switch LPSWEs into user mode at uregs->psw_addr with uregs->psw_mask.
Parameters
[in]requestExecutor-style creation request selecting one of three strand kinds (kernel-thread, user-process, bare). See zxfoundation::dgp::domain::strand_create_request for the full duality documentation.
Returns
Pointer to the created strand, or kernel_error if validation, allocation, or admission fails.