KVM: s390: interrupt: use READ_ONCE() before cmpxchg()
authorHeiko Carstens <hca@linux.ibm.com>
Mon, 9 Jan 2023 14:54:56 +0000 (15:54 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Feb 2023 07:27:18 +0000 (08:27 +0100)
commite15750aa28a6f038c709cb7b4dc4ab6603aeeb8f
tree89038224866f797487b7fa03bcc7724ddfecf40f
parent9300c65207f384022faa50f2624820c6de8997ce
KVM: s390: interrupt: use READ_ONCE() before cmpxchg()

[ Upstream commit 42400d99e9f0728c17240edb9645637ead40f6b9 ]

Use READ_ONCE() before cmpxchg() to prevent that the compiler generates
code that fetches the to be compared old value several times from memory.

Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Link: https://lore.kernel.org/r/20230109145456.2895385-1-hca@linux.ibm.com
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/s390/kvm/interrupt.c