Merged
Conversation
…o test Change the BUFFER static to RUN_QUEUE static using a config static for max size, add a basic idle task, static, no change possible for the dev calling it, and update the main function to create task and test. Need sleep primitive to continue on this branch
…e context_switch test
The CpusState structure will be used to store all useful flags per CPU core. Like scheduler flags, state flags, and more if needed.
…c API for CPUS_STATE The reschedule work only once, then it won't work after that, weird but there's still improvement
…bug log, fix the clear need resched bit to use correct bitwise
Trying to fix the bug on the idle task, after some time running task and idle task it crash. Don't know why
…port on primitives task test The test for context switch doesn't work, updating task context with mstatus broke the test. The context switch still work; just tested it in main. But the test mode need refactor to use correctly trap handling
…e_task feature on the idle task creation Added a idle_task feature for the idle task creation. Avoid to always have it enable.
Also update the Cargo.toml with comment on feature and add the idle_task feature
Update the definition of task with the structure, and add a small definition for the idle task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant improvements to the kernel's task management and scheduling system, with a focus on supporting an idle task, refining the scheduler, and enhancing context switching for RISC-V. The changes add new kernel features, update task context structures, improve rescheduling logic, and introduce new configuration options.
Key changes include:
Idle Task Support & Task Management
task_idle_task), and run-queue fallback when no other tasks are ready. The idle task is statically defined, lowest priority, and ensures the kernel always has something to run. [1] [2] [3] [4] [5]get_by_priorityandtask_list_get_idle_taskfunctions to retrieve tasks by priority, enabling the scheduler to select the idle task when needed. [1] [2]Scheduler & Run Queue Refactor
BUFFERwith a newRUN_QUEUEfor ready tasks, and improved blocked task queue management. Added configuration for queue sizes and CPU core count. [1] [2] [3] [4]CpusStatestructure inmisc.rs, with functions to set, clear, and read the reschedule bit per core. Scheduler now checks and clears this flag as needed. [1] [2] [3]Task Context & RISC-V Architecture Updates
TaskContextto includemstatus, with correct save/restore in context switch assembly, and default initialization to enable interrupts (mie). Updated context offsets and added a test to verify correct initialization. [1] [2] [3] [4] [5] [6] [7]Documentation & Versioning
TaskBlockControlenum for blocking reasons. [1] [2]Cargo.tomlandinfo.rs. [1] [2]Miscellaneous
current_cpu_core), and improved trap handling to trigger rescheduling when required. [1] [2]Cargo.toml, includingidle_task.These changes collectively improve the reliability, modularity, and extensibility of the kernel's multitasking and scheduling capabilities, laying groundwork for future multicore support and more sophisticated task management.