On Tue, Jun 2, 2020 at 9:22 AM Song Liu <s...@kernel.org> wrote: > > On Mon, Jun 1, 2020 at 10:04 PM Andrii Nakryiko <andr...@fb.com> wrote: > > > > Make sample_cnt volatile to fix possible selftests failure due to compiler > > optimization preventing latest sample_cnt value to be visible to main > > thread. > > sample_cnt is incremented in background thread, which is then joined into > > main > > thread. So in terms of visibility sample_cnt update is ok. But because it's > > not volatile, compiler might make optimizations that would prevent main > > thread > > to see latest updated value. Fix this by marking global variable volatile. > > > > Fixes: cb1c9ddd5525 ("selftests/bpf: Add BPF ringbuf selftests") > > Signed-off-by: Andrii Nakryiko <andr...@fb.com> > > Acked-by: Song Liu <songliubrav...@fb.com>
Applied. Thanks. I also pushed trivial commit to fix test_verifier.