diff options
author | Andy Chiu <andy.chiu@sifive.com> | 2024-01-15 06:59:23 +0100 |
---|---|---|
committer | Palmer Dabbelt <palmer@rivosinc.com> | 2024-01-16 16:13:56 +0100 |
commit | 7df56cbc27e4239807b5d8860f79a7350d63a741 (patch) | |
tree | 7148017078dbea3bd7592311867b80df2d6de810 /include/acpi/acpi.h | |
parent | riscv: Add vector extension XOR implementation (diff) | |
download | linux-7df56cbc27e4239807b5d8860f79a7350d63a741.tar.xz linux-7df56cbc27e4239807b5d8860f79a7350d63a741.zip |
riscv: sched: defer restoring Vector context for user
User will use its Vector registers only after the kernel really returns
to the userspace. So we can delay restoring Vector registers as long as
we are still running in kernel mode. So, add a thread flag to indicates
the need of restoring Vector and do the restore at the last
arch-specific exit-to-user hook. This save the context restoring cost
when we switch over multiple processes that run V in kernel mode. For
example, if the kernel performs a context swicth from A->B->C, and
returns to C's userspace, then there is no need to restore B's
V-register.
Besides, this also prevents us from repeatedly restoring V context when
executing kernel-mode Vector multiple times.
The cost of this is that we must disable preemption and mark vector as
busy during vstate_{save,restore}. Because then the V context will not
get restored back immediately when a trap-causing context switch happens
in the middle of vstate_{save,restore}.
Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Björn Töpel <bjorn@rivosinc.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20240115055929.4736-5-andy.chiu@sifive.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions