Move syscall_thread_{enter,exit}() to the slow path. This is only
needed for syscalls from unloadable modules.
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 34442 Build 31546: arc lint + arc unit
Event Timeline
enter is needed for syscalls from _loadable_ modules, not unloadable.
That said, what is the point of the change ? It somewhat pessimizes syscalls from modules, while removing one test for SY_THR_STATIC.
The point of thread_syscall_enter() is to make it possibly to safely unload modules. You can easily do loading without it.
That said, what is the point of the change ? It somewhat pessimizes syscalls from modules, while removing one test for SY_THR_STATIC.
It removes one test from the fast path, while slightly pessimizing the slow path. That's what fast path/slow path idea is about.
If doing such reorg, it might make sense to de-commission syscall_thread_enter/exit, renaming underscored functions back to syscall_thread_.... Then you would fetch SY_THR_STATIC once and cache it in local var.
I've considered that. There are two reasons I hadn't done that: first is that this complicates the code somewhat, and I'm trying to simplify it instead. Second, looking at the RISC-V assembly output we're already using all the caller-saved registers; adding another local variable to be kept across the function calls would likely make the assembly even worse. Third - this is the slow path; avoiding a flag check in the slow path doesn't really buy us anything.
My long-term plan for this function is to keep expanding the fast path/slow path split, hopefully moving ptrace, ktrace, and KTR checks into the slow path.
I do not think that risc-v assembly has any influence there. Checking the flag once makes things more consistent and logical.
sys/kern/kern_syscalls.c | ||
---|---|---|
94 ↗ | (On Diff #79299) | I'll try, I'll need to refresh my understanding of those first. |