Re: [PATCH v8] riscv: errata: Add C-SKY ERRATA WRITE_ONCE fixup
From: Drew Fustini
Date: Sun Nov 29 2026 - 22:27:15 EST
On Mon, Nov 30, 2026 at 01:58:35AM +0000, GUO Ren (XuanTie) wrote:
> The early version of C-SKY C910 core has a store merge buffer
It is confusing to me that this now says C-SKY. If it is going to be
changed from the previous revision, then I think there needs to be an
explanation. It is not clear what the difference is between T-HEAD and
C-SKY.
> delay problem. The store merge buffer could improve the store queue
> performance by merging multi-store requests, but when there are not
> continued store requests, the prior single store request would be
> waiting in the store queue for a long time. That would cause
> significant problems for communication between multi-cores. This
> problem was found on sg2042 platform with the qspinlock lock torture
> test.
>
> So appending a fence w.o could immediately flush the store merge
> buffer and let other cores see the write result.
>
> This will apply the WRITE_ONCE errata to handle the non-standard
> behavior via appending a fence w.o instruction for WRITE_ONCE().
>
> This problem is only observed on the sg2042 hardware platform: it
> takes hours of locktorture stress testing to trigger the livelock
> once, and an interrupt can break the livelock. No user space
> application has been observed to hit this problem, so there is no
> need to modify user space WRITE_ONCE(). The vDSO code runs in user
> space context as well, so its WRITE_ONCE() does not need the errata
> fence either.
>
> Acked-by: Arnd Bergmann <arnd@xxxxxxxx>
> Reviewed-by: Alexandre Ghiti <alexghiti@xxxxxxxxxxxx>
> Reviewed-by: Leonardo Bras <leobras@xxxxxxxxxx>
> Reviewed-by: Inochi Amaoto <inochiama@xxxxxxxxx>
> Tested-by: Han Gao <gaohan@xxxxxxxxxxx>
> Tested-by: Yao Zi <me@xxxxxxxx>
> Cc: Chen Wang <unicorn_wang@xxxxxxxxxxx>
> Cc: Xiaoguang Xing <xiaoguang.xing@xxxxxxxxxx>
> Cc: Paul Walmsley <pjw@xxxxxxxxxx>
> Cc: Drew Fustini <fustini@xxxxxxxxxx>
> Co-developed-by: Han Gao <gaohan@xxxxxxxxxxx>
> Signed-off-by: Han Gao <gaohan@xxxxxxxxxxx>
> Reviewed-by: Drew Fustini <fustini@xxxxxxxxxx>
> Signed-off-by: GUO Ren (XuanTie) <guoren@xxxxxxxxxx>
[..]
> diff --git a/arch/riscv/Kconfig.errata b/arch/riscv/Kconfig.errata
> index 4f77b3c6d7fd..dfa99f1cfd4e 100644
> --- a/arch/riscv/Kconfig.errata
> +++ b/arch/riscv/Kconfig.errata
> @@ -179,4 +179,22 @@ config ERRATA_THEAD_GHOSTWRITE
>
> If you don't know what to do here, say "Y".
>
> +config ERRATA_THEAD_WRITE_ONCE
> + bool "Apply C-SKY WRITE_ONCE errata"
Also, here it is ERRATA_THEAD_WRITE_ONCE but "C-SKY WRITE_ONCE"
Thanks,
Drew