Skip to content

Commit

Permalink
s390x/kvm: call cpu_synchronize_state() on every kvm_arch_handle_exit()
Browse files Browse the repository at this point in the history
Manually having to use cpu_synchronize_state() is error prone. And as
Christian Borntraeger discovered, e.g. handle_diag() is currently
missing a cpu_synchronize_state(), as decode_basedisp_s() uses a
general purpose register value internally.

So let's do an overall cpu_synchronize_state(), which fixes at least the
one mentioned BUG. We will clean up the superfluous cpu_synchronize_state()
calls later.

We now also call it (although maybe not neded) for
- KVM_EXIT_S390_RESET -> s390_reipl_request()
- KVM_EXIT_DEBUG -> kvm_arch_handle_debug_exit()
- unmanagable/unimplemented intercepts
- ICPT_CPU_STOP -> do_stop_interrupt() -> cpu gets halted
- Scenarios where we inject an operation exception
- handle_stsi()

I don't think any of these are performance critical. Especially as we
have all information directly contained in kvm_run, there are no
additional IOCTLs to issue on modern kernels.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <[email protected]>
Acked-by: Christian Borntraeger <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
  • Loading branch information
davidhildenbrand authored and cohuck committed Apr 9, 2018
1 parent 2a6bcfd commit eac53ac
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions target/s390x/kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1778,6 +1778,8 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)

qemu_mutex_lock_iothread();

cpu_synchronize_state(cs);

switch (run->exit_reason) {
case KVM_EXIT_S390_SIEIC:
ret = handle_intercept(cpu);
Expand Down

0 comments on commit eac53ac

Please sign in to comment.