diff options
author | Halil Pasic <pasic@linux.ibm.com> | 2020-06-16 06:50:35 +0200 |
---|---|---|
committer | Cornelia Huck <cohuck@redhat.com> | 2020-07-03 11:15:59 +0200 |
commit | 45175361f1bfc2d3ccdcb4b22570c2352f3de754 (patch) | |
tree | 411f7e555d907b421add6a2d3458e50f5319d3df /pc-bios/s390-ccw/cio.h | |
parent | 1a8242f7c3f53341dd66253b142ecd06ce1d2a97 (diff) |
s390x/pci: fix set_ind_atomic
The atomic_cmpxchg() loop is broken because we occasionally end up with
old and _old having different values (a legit compiler can generate code
that accessed *ind_addr again to pick up a value for _old instead of
using the value of old that was already fetched according to the
rules of the abstract machine). This means the underlying CS instruction
may use a different old (_old) than the one we intended to use if
atomic_cmpxchg() performed the xchg part.
Let us use volatile to force the rules of the abstract machine for
accesses to *ind_addr. Let us also rewrite the loop so, we that the
new old is used to compute the new desired value if the xchg part
is not performed.
Fixes: 8cba80c3a0 ("s390: Add PCI bus support")
Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20200616045035.51641-3-pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'pc-bios/s390-ccw/cio.h')
0 files changed, 0 insertions, 0 deletions