Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

OSPP 2026 idea: Lazy FP/RVV context switching for RISC-V

オープン
#11,786 コメント 5 件 リアクション 2 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
c

調査の方向性

まず、RISC-V のスレッドコンテキスト切り替え実装と qemu-virt64-riscv のテスト設定を見つけます。既存の FPU 状態がどのように扱われているかを読み、次に mstatus.FS と mstatus.VS、および RT_USING_RVV の設定境界を調査します。完了条件は、FP と RVV の状態を lazy に扱えること、vector スレッドと plain スレッドを混在させたテストで破損が発生しないこと、single-hart システム向けにコンテキスト切り替え前後のベンチマークがあることです。

索引モデルが issue の本文から書いたものです。

説明

Arch: RISC-V enhancement Kernel
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.

  1. 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.
  2. 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.
  3. Add tests on qemu-virt64-riscv with vector using threads mixed with
    plain threads to catch any state corruption.
  4. 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

主要言語
C
スター
12.3k
フォーク
5.5k
平均マージ
4日 12時間
マージ済み PR(30日)
32

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

RT-Thread/rt-thread のほかの issue

RT-Thread/rt-thread の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。