[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAADnVQL9CYGyFM-hpi4=jSA6gp3vs_0i5+bVJ5sduPtO_cPsZg@mail.gmail.com>
Date: Tue, 2 Jun 2020 12:00:07 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Song Liu <song@...nel.org>
Cc: Andrii Nakryiko <andriin@...com>, bpf <bpf@...r.kernel.org>,
Networking <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii.nakryiko@...il.com>,
Kernel Team <kernel-team@...com>
Subject: Re: [PATCH bpf-next] selftests/bpf: fix sample_cnt shared between two threads
On Tue, Jun 2, 2020 at 9:22 AM Song Liu <song@...nel.org> wrote:
>
> On Mon, Jun 1, 2020 at 10:04 PM Andrii Nakryiko <andriin@...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 <andriin@...com>
>
> Acked-by: Song Liu <songliubraving@...com>
Applied. Thanks.
I also pushed trivial commit to fix test_verifier.
Powered by blists - more mailing lists