[v2, 1/5] riscv: sched: defer restoring Vector context for user
Björn Töpel
bjorn at kernel.org
Tue Aug 15 03:41:33 PDT 2023
Andy Chiu <andy.chiu at sifive.com> writes:
> 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 for the upcoming kenel-mode
> Vector patches.
>
> Signed-off-by: Andy Chiu <andy.chiu at sifive.com>
> Acked-by: Conor Dooley <conor.dooley at microchip.com>
Reviewed-by: Björn Töpel <bjorn at rivosinc.com>
More information about the linux-riscv
mailing list