Re: KCSAN: data-race in __alloc_file / __alloc_file

From: Linus Torvalds
Date: Fri Nov 08 2019 - 13:12:40 EST


On Fri, Nov 8, 2019 at 10:02 AM Eric Dumazet <edumazet@xxxxxxxxxx> wrote:
>
> Another interesting KCSAN report :
>
> static inline s64 percpu_counter_read_positive(struct percpu_counter *fbc)
> {
> s64 ret = fbc->count; // data-race ....

Yeah, I think that's fundamentally broken on 32-bit. It might need a
sequence lock instead of that raw_spinlock_t to be sanely done
properly on 32-bit.

Or we just admit that 32-bit doesn't really matter any more in the
long run, and that this is not a problem in practice because the
32-bit overflow basically never happens on small machines anyway.

Linus