Page MenuHomeFreeBSD

Predict that the userspace trap will likely be syscall
Needs ReviewPublic

Authored by trasz on Oct 3 2020, 5:27 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Predict that the userspace trap will likely be syscall. Shaves off
15 instructions.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 34014
Build 31203: arc lint + arc unit

Event Timeline

trasz requested review of this revision.Oct 3 2020, 5:27 PM

So, I guess the intent of this and related changes is to decrease time spent in the syscall path. Does this pessimize the other cases? I do not have enough intuition to say what percentage of user traps are syscalls compared to page faults or interrupts, but I would still expect a non-trivial amount of the latter two.

We also might consider calling svc_handler directly from asm and skip the generic trap handler.

sys/riscv/riscv/trap.c
161

IMO we should either keep the trapframe argument or just inline the contents of svc_handler completely.

332

This assert seems less useful than before, since the assignment it checks for is now visible a few lines prior.

So, I guess the intent of this and related changes is to decrease time spent in the syscall path. Does this pessimize the other cases? I do not have enough intuition to say what percentage of user traps are syscalls compared to page faults or interrupts, but I would still expect a non-trivial amount of the latter two.

Yes, by about two instructions. However, other traps are usually quite slow anyway.

And yeah, I'm not quite sure about it either.

We also might consider calling svc_handler directly from asm and skip the generic trap handler.

Good idea, thanks.