RISCV Vector unit disabled by default for new task (was Re: [PATCH v12 17/17] riscv: prctl to enable vector commands)

From: Vineet Gupta
Date: Fri Dec 09 2022 - 00:26:40 EST


Hi Darius, Andrew, Palmer

On 9/21/22 14:43, Chris Stillson wrote:
diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c

@@ -134,7 +135,6 @@ void start_thread(struct pt_regs *regs, unsigned long pc,
if (WARN_ON(!vstate->datap))
return;
}
- regs->status |= SR_VS_INITIAL;

Perhaps not obvious from the patch, but this is a major user experience change: As in V unit would be turned off for a new task and we will rely on a userspace prctl (also introduced in this patch) to enable V.

I know some of you had different opinion on this in the past [1], so this is to make sure everyone's on same page.
And if we agree this is the way to go, how exactly will this be done in userspace.

glibc dynamic loader will invoke the prctl() ? How will it decide whether to do this (or not) - will it be unconditional or will it use the hwcap - does latter plumbing exist already ? If so is it AT_HWCAP / HWCAP2.

Also for static linked executables, where will the prctl be called from ?

[1] https://sourceware.org/pipermail/libc-alpha/2021-November/132883.html