[PATCH v4 0/4] riscv: optimize Vector context restore on syscall
From: Andy Chiu
Date: Thu May 28 2026 - 15:17:19 EST
This patch series optimizes riscv vector state handling across syscall
boundaries and context switches. The kernel now keeps track of the
INITIAL state in status.vs to optimize unnecessary context management
operations.
Link to v3: https://lore.kernel.org/all/20260521162521.188629-1-tchiu@xxxxxxxxxxxxxxx/
Patch summary:
- Updated patches: 1, 2, 4
Changelog v4:
- Fix a build warning (1)
- Prevent setting INIT when it is already and provide performance
meassurements (2)
- Address comments from sashiko (4)
Changelog v3:
- Refactor function names. (1, 2)
- Merge daichengrong's patch, with a fix and optimzation. (2)
- Fix ptrace GETREGSET failure. (3)
- Strengthen ptrace SETREGSET semantics and add a test to cover it. (3,
4)
- Fix a potential ABI break in signal and add a test to prevent future
breaks. (3, 4)
Link to v2: https://lore.kernel.org/linux-riscv/20260402043414.2421916-1-andybnac@xxxxxxxxx/
Changelog v2: rebase on top of for-next
Andy Chiu (3):
riscv: vector: refactor vector context operations
riscv: vector: adjust ptrace and signal behavior for INITIAL state
selftests: riscv: Extend vector tests for sigreturn and ptrace
daichengrong (1):
riscv: clarify vector state semantics on syscall and context switch
arch/riscv/include/asm/kvm_vcpu_vector.h | 8 +-
arch/riscv/include/asm/vector.h | 52 ++++----
arch/riscv/kernel/kernel_mode_vector.c | 29 ++++-
arch/riscv/kernel/ptrace.c | 13 +-
arch/riscv/kernel/signal.c | 11 +-
arch/riscv/kernel/vector.c | 39 +++++-
arch/riscv/kvm/vcpu_vector.c | 8 +-
.../selftests/riscv/sigreturn/sigreturn.c | 71 +++++++++++
.../selftests/riscv/vector/vstate_ptrace.c | 111 +++++++++++++++++-
9 files changed, 294 insertions(+), 48 deletions(-)
--
2.43.0