Re: [PATCH V2] MIPS: implement smp_cond_load_acquire() for Loongson-3

From: Will Deacon
Date: Wed Jul 11 2018 - 05:43:00 EST


Hi Huacai,

On Tue, Jul 10, 2018 at 07:45:22PM +0800, éåæ wrote:
> I don't think this is a hardware bug, in design, SFB will flushed to L1
> cache in three cases:
> 1, data in SFB is full (be a complete cache line);
> 2, there is a subsequent read access in the same cache line;
> 3, a 'sync' instruction is executed.

I'd expect successful LL/SC, cache maintenance (and potentially TLB)
operations to flush your SFB as well, not that I think that provides a
better workaround than throwing a 'sync' into cpu_relax(). I assume the
SFB is all physically addressed?

Generally, CPU architectures guarantee that store buffers drain "in finite
time" which is a pretty crappy guarantee, but one which tends to be
sufficient in practice and therefore relied upon by software.

Will