Use qatomic_read/set() in the S390 CPU state accessors. This avoids non-atomic reads in s390_cpu_has_work().
Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- target/s390x/cpu.h | 2 +- target/s390x/cpu-system.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index bf9f6ed1de2..ef73b15218e 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -855,7 +855,7 @@ static inline void s390_cpu_set_state(S390CpuState cpu_state, S390CPU *cpu) #endif /* CONFIG_USER_ONLY */ static inline S390CpuState s390_cpu_get_state(const S390CPU *cpu) { - return cpu->env.cpu_state; + return qatomic_read(&cpu->env.cpu_state); } diff --git a/target/s390x/cpu-system.c b/target/s390x/cpu-system.c index fffac09f241..d38de4fea2b 100644 --- a/target/s390x/cpu-system.c +++ b/target/s390x/cpu-system.c @@ -272,7 +272,7 @@ void s390_cpu_set_state(S390CpuState cpu_state, S390CPU *cpu) if (kvm_enabled() && s390_cpu_get_state(cpu) != cpu_state) { kvm_s390_set_cpu_state(cpu, cpu_state); } - cpu->env.cpu_state = cpu_state; + qatomic_set(&cpu->env.cpu_state, cpu_state); } void s390_cmma_reset(void) -- 2.53.0
