OSDN Git Service

seqlock: use atomic writes for the sequence
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 30 Sep 2016 21:30:56 +0000 (22:30 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 4 Oct 2016 08:00:26 +0000 (10:00 +0200)
commitf96a8cc3c633b25d9269337408ae2417ebbbad8e
tree8d2f8fc029d7d988529bc0a4a2049d46b98cc045
parent550276ae0a88851edda2cb7fcdd64256dbb8e314
seqlock: use atomic writes for the sequence

There is a data race if the sequence is written concurrently to the
read.  In C11 this has undefined behavior.  Use atomic_set; the
read side is already using atomic_read.

Reported-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20160930213106.20186-6-alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/qemu/seqlock.h