[Feature Request] Defer RISC-V callee-saved register handling on no-switch timer interrupts
Les mainteneurs répondent en général sous 3 jours
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 15/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- c
- Domaine
- embedded-iot, operating-systems
Piste de recherche
Start from the RISC-V timer interrupt entry and the xTaskIncrementTick() call that decides whether a context switch happens, then read how the full integer context is saved and restored around vTaskSwitchContext(). Work is already under way in linked pull request #1482, so check that before starting. Done means the no-switch path saves only caller-saved registers, the switch path still saves s0-s11, and the QEMU M-mode test configurations pass.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Is your feature request related to a problem? Please describe.
The GCC RISC-V port saves and restores the complete integer context on every
machine-timer interrupt, even when xTaskIncrementTick() returns pdFALSE.
On this no-switch path, saving s0-s11 is unnecessary because the RISC-V ABI
requires the called C functions to preserve them.
Describe the solution you'd like
Keep the existing task-frame layout, but split integer context handling into
caller-saved and callee-saved parts:
- Save caller-saved registers on timer entry.
- Call
xTaskIncrementTick(). - On
pdFALSE, restore caller-saved registers and return. - On
pdTRUE, saves0-s11into their reserved frame slots before
vTaskSwitchContext(), then use the existing full restore path.
Other trap and yield paths remain unchanged. FPU, vector, and chip-specific
additional contexts retain their current behavior.
For RV64, the no-switch path avoids 12 sd and 12 ld instructions, reducing
stack traffic by 192 bytes per tick.
Describe alternatives you've considered
Keeping the current full save is simpler but performs unnecessary memory
traffic on the common no-switch path. A separate short interrupt frame would
require larger changes to the existing frame ABI.
Additional context
Validated with:
- QEMU M-mode: no-switch, task-switch, FPU, vector, additional-context, and
combined configurations. - JH7110/U74 M-mode hardware: baseline and optimized versions both passed
single-task and two-task tests for 1,000,000 ticks. - 10,000 hardware no-switch samples:
- median: 59 → 50 cycles
- mean: 155.281 → 144.746 cycles
P99 and maximum did not improve.
If the approach is acceptable, I can submit a focused two-commit PR:
a context-helper refactor followed by the timer-path optimization.
How many devices will this feature impact?
Generic GCC RISC-V M-mode port; currently validated on one JH7110 board.
What are your project timelines?
Implementation and validation are complete. A PR can be submitted after
maintainer feedback.
- Langage dominant
- C
- Étoiles
- 4.6k
- Forks
- 1.6k
- Merge moyen
- 2 j 22 h
- PR mergées (30 j)
- 4
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de FreeRTOS/FreeRTOS-Kernel
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
FreeRTOS/FreeRTOS-Kernel#1542 ·
Les mainteneurs répondent en général sous 3 jours
-
[BUG] Release asset FreeRTOS-KernelV11.3.2.zip has the files of main, not of the tag V11.3.2Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
FreeRTOS/FreeRTOS-Kernel#1520 ·
Les mainteneurs répondent en général sous 3 jours
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
FreeRTOS/FreeRTOS-Kernel#1494 · 3 commentaires ·
Les mainteneurs répondent en général sous 3 jours
-
enhancement
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
FreeRTOS/FreeRTOS-Kernel#1554 ·
Les mainteneurs répondent en général sous 3 jours
-
[BUG] event_wait_timed can't return falsePeut-être pris @TedLyngmo l’a pris il y a 39 jours. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 38/100
FreeRTOS/FreeRTOS-Kernel#1546 ·
Les mainteneurs répondent en général sous 3 jours
Toutes les issues de FreeRTOS/FreeRTOS-Kernel
Issues similaires
-
RecompLauncher supportOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
shinyquagsire23/OpenJKDF2#540 ·
Les mainteneurs répondent en général sous 12 jours
-
Prison work hall: laundry and kitchen stations stand at bare walls, the hatch has no counter or signOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Life-Framework/Life-Framework#5939 ·
Les mainteneurs répondent en général sous 1 jour
-
autoconf failes to find libsodium even when present due to implicit function declarationPeut-être pris @coderjoe l’a pris aujourd’hui. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 13 jours
-
SessionInterfaceHandler is throwing a deprecation notice as a warning instead of a deprecationOuverteBug Status: Needs Triage
Difficulté 1/5 Moins d'une heure Accessibilité débutants 74/100
Les mainteneurs répondent en général sous 1 jour
-
enhancement_package: a site operand of another JSON type raises TypeError, not a named refusalOuvertebug python
Difficulté 2/5 1-3 heures Accessibilité débutants 87/100
Jstar269/nakagawa-recomp#3521 ·
Les mainteneurs répondent en général sous 1 jour