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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 2, 2020 at 9:22 AM Song Liu <song@xxxxxxxxxx> wrote:
>
> On Mon, Jun 1, 2020 at 10:04 PM Andrii Nakryiko <andriin@xxxxxx> 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 <andriin@xxxxxx>
>
> Acked-by: Song Liu <songliubraving@xxxxxx>

Applied. Thanks.

I also pushed trivial commit to fix test_verifier.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux