summaryrefslogtreecommitdiff
path: root/arch/riscv/include/asm/vector.h
diff options
context:
space:
mode:
authorYong-Xuan Wang <yongxuan.wang@sifive.com>2025-11-17 21:19:29 -0700
committerPaul Walmsley <pjw@kernel.org>2025-11-19 09:19:28 -0700
commit6efb1a9462ef0023f3f96a7b88542e1f878e31a0 (patch)
treed46c26c65297a46b91b4c3e89db512bbfd8b06d1 /arch/riscv/include/asm/vector.h
parent3ac022bf389d60e696e4d3156b72f3ccd6e6368b (diff)
riscv: ptrace: Optimize the allocation of vector regset
The vector regset uses the maximum possible vlen value to estimate the .n field. But not all the hardwares support the maximum vlen. Linux might wastes time to prepare a large memory buffer(about 2^6 pages) for the vector regset. The regset can only copy vector registers when the process are using vector. Add .active callback and determine the n field of vector regset in riscv_v_setup_ctx_cache() doesn't affect the ptrace syscall and coredump. It can avoid oversized allocations and better matches real hardware limits. Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com> Reviewed-by: Greentime Hu <greentime.hu@sifive.com> Reviewed-by: Andy Chiu <andybnac@gmail.com> Tested-by: Andy Chiu <andybnac@gmail.com> Link: https://patch.msgid.link/20251013091318.467864-2-yongxuan.wang@sifive.com Signed-off-by: Paul Walmsley <pjw@kernel.org>
Diffstat (limited to 'arch/riscv/include/asm/vector.h')
-rw-r--r--arch/riscv/include/asm/vector.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/riscv/include/asm/vector.h b/arch/riscv/include/asm/vector.h
index b61786d43c20..e7aa449368ad 100644
--- a/arch/riscv/include/asm/vector.h
+++ b/arch/riscv/include/asm/vector.h
@@ -51,6 +51,7 @@ void put_cpu_vector_context(void);
void riscv_v_thread_free(struct task_struct *tsk);
void __init riscv_v_setup_ctx_cache(void);
void riscv_v_thread_alloc(struct task_struct *tsk);
+void __init update_regset_vector_info(unsigned long size);
static inline u32 riscv_v_flags(void)
{