Re: [PATCH bpf-next] selftests/bpf: fix sample_cnt shared between two threads

2020-06-02 Thread Alexei Starovoitov
On Tue, Jun 2, 2020 at 9:22 AM Song Liu wrote: > > On Mon, Jun 1, 2020 at 10:04 PM Andrii Nakryiko 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 inc

Re: [PATCH bpf-next] selftests/bpf: fix sample_cnt shared between two threads

2020-06-02 Thread Song Liu
On Mon, Jun 1, 2020 at 10:04 PM Andrii Nakryiko 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 > t

[PATCH bpf-next] selftests/bpf: fix sample_cnt shared between two threads

2020-06-01 Thread Andrii Nakryiko
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 beca