OSPP 2026 idea: Lazy FP/RVV context switching for RISC-V
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- c
- Domain
- embedded-iot, operating-systems
Research direction
Start by locating the RISC-V thread context-switch implementation and the qemu-virt64-riscv test setup. Read how existing FPU state is handled, then investigate mstatus.FS and mstatus.VS and the RT_USING_RVV configuration boundary. Done means lazy FP and RVV state handling, mixed vector/plain-thread tests without corruption, and before-and-after context-switch benchmarks for single-hart systems.
Written by the indexing model from the issue text.
Description
Affected area
Kernel
Hardware/BSP vendor
Not applicable / Other
Architecture
RISC-V
Describe problem solved by the proposed feature
On the RISC-V port, every context switch saves and restores the full FPU
state unconditionally, even for threads that never touch it. There is also
no support for the Vector (RVV) extension at all. Vector registers are not
part of the thread context right now, so any thread using V instructions
would have its state silently corrupted by a context switch. Both gaps are
noted in #10722.
Describe your preferred solution
Make extension state save and restore lazy instead of unconditional, using
the mstatus.FS and mstatus.VS dirty bits the hardware already provides.
- Only save and restore FP state when a thread has actually used it since
its last switch (FS dirty bit), instead of doing it on every switch. - Add RVV 1.0 vector register state to the thread context, saved and
restored the same lazy way using the VS bit, behind an RT_USING_RVV
Kconfig option so boards without V are not affected. - Add tests on qemu-virt64-riscv with vector using threads mixed with
plain threads to catch any state corruption. - Benchmark context switch cost before and after.
I want to keep the scope to a single hart for now. SMP correctness, full
RVA23 compliance, and a generic extension discovery API can be natural
follow ups later, so this stays achievable as an OSPP 2026 project.
This is a project idea I want to propose for OSPP 2026, along with this
solution. Happy to hear if this is useful to the community or if someone
is already working on something similar.
Describe possible alternatives
No response
- Dominant language
- C
- Stars
- 12.4k
- Forks
- 5.5k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 79
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from RT-Thread/rt-thread
-
Arch: ARM/AArch64 Doc
Difficulty 1/5 Under an hour Newbie friendliness 90/100
RT-Thread/rt-thread#12082 · 1 comment ·
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
RT-Thread/rt-thread#11951 · 2 comments ·
Maintainers usually reply within 2 days
-
[Bug] [libc] timer_gettime 拆秒前将总纳秒截断为 uint32_t,剩余时间查询错误May be free again @Yunlk claimed this 28 days ago, and no pull request is open. Openin progress
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
RT-Thread/rt-thread#11924 · 7 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
[Bug] dfs_v2 tmpfs: ftruncate(fd, 0) frees the file buffer but reports success — use-after-free read/write and double free from a legal POSIX callPossibly taken @remukisama claimed this 33 days ago. Openin progress
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
RT-Thread/rt-thread#11902 · 4 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
[bsp][stm32][bluepill] README「快速上手」缺少重新生成 MDK 工程这一步,按文档操作无法编译通过May be free again @moment-NEW claimed this 50 days ago, and no pull request is open. Openin progress
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
RT-Thread/rt-thread#11818 · 4 comments · 1 assignee ·
Maintainers usually reply within 2 days
All issues in RT-Thread/rt-thread
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
ESPresense/ESPresense#2680 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ImageMagick/ImageMagick#9134 ·
Maintainers usually reply within 1 day
-
Builder: a structure opened without calculation data shows the Diffraction (fibre) view by defaultOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
FriendsofECCE/ECCE#1245 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/nuttx-apps#4108 · 4 comments ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 84/100
VirtualBox/virtualbox#996 ·
Maintainers usually reply within 6 days