Random corruption on SpacemiT K1 (and K3) with RVV

Aurelien Jarno aurelien at aurel32.net
Thu Oct 22 09:53:41 PDT 2026


Hi,

Some small update on that. Sorry it takes time, it's just the bug 
happens sporadically and I need a lot of testing to reach some 
conclusion (and when I can't reproduce the bug, I am still not sure it 
is not there).

On 2026-09-29 12:07, Vivian Wang wrote:
> On 9/28/26 12:32, Aurelien Jarno wrote:
> > Hi,
> >
> > On 2026-09-25 06:40, Aurelien Jarno wrote:
> >
> > [...]
> >
> > That said Han Gao pointed me to this patch:
> > https://lore.kernel.org/linux-riscv/20260807-vector_fpu_regs_status_rmw_fix-v1-1-0c16848b60db@intel.com/
> >
> > I have been testing it, and so far it seems to fix my issue with both 
> > CONFIG_RISCV_ISA_V_PREEMPTIVE enable and disabled. Or maybe it just 
> > hides the issue by changing the timing, as at this point, I haven't 
> > fully understood how the bug fixed by this patch can completely explain 
> > my observations.
> 
> I don't know how that would cause what you have observed either, but it
> does superficially appears to fix a real bug.
>
> > Unfortunately, I have been able to reproduce the issue, even with this 
> > patch applied. It just significantly reduces the frequency of the issue.
> >
> But this, I suppose, is still useful information that we just *might* be
> on the right track.
> 
> Can you perhaps try this hacked together patch below and see if it does
> anything? I just put guard(preempt)() or something around a bunch of
> places I could find that access regs->status. It should apply to 7.1 and
> 7.2 as is. (The coding style is deliberately horrible to minimize diff
> lines and discourage others from shipping it)
> 
> (This adds some more widely-scoped guards, and AFAICT /replaces/ the
> above linked patch from Guobin Zhang.)

Unfortunately that doesn't fix the problem. I am still able to reproduce 
it with this patch :(

I also have tried with a 7.3 kernel, and I am still able to reproduce 
the issue on both the K1 (the above usercopy issue or the not 
reproducible GCC ICE) and the K3 (only not reproducible GCC ICE). 

Disabling vector extension in the device tree fixes the issue in both 
cases. However the LLVM JIT doesn't care if it is enabled or not, it 
just matches by mvendorid / marchid / mimpid so you just get a SIGILL.

Regards
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien at aurel32.net                     http://aurel32.net



More information about the linux-riscv mailing list